| 1 | # Copyrights 2010-2015 by [Mark Overmeer]. | ||||||||||||||||||||||||||||
| 2 | # For other contributors see ChangeLog. | ||||||||||||||||||||||||||||
| 3 | # See the manual pages for details on the licensing terms. | ||||||||||||||||||||||||||||
| 4 | # Pod stripped from pm file by OODoc 2.01. | ||||||||||||||||||||||||||||
| 5 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | package XML::eXistDB; | ||||||||||||||||||||||||||||
| 9 | 5 | ▶ | use vars '$VERSION'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 5 | $VERSION = '0.14'; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 5 | ▶ | use base 'XML::Compile::Cache'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 5 | ▶ | use Log::Report 'xml-existdb', syntax => 'SHORT'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 5 | ▶ | use XML::eXistDB::Util; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 5 | ▶ | use XML::Compile::Util qw/pack_type type_of_node/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 5 | ▶ | use XML::LibXML::Simple qw/XMLin/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 5 | my $coll_type = pack_type NS_COLLECTION_XCONF, 'collection'; | |||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | sub init($) | ||||||||||||||||||||||||||||
| 24 | 0 | ▶ | { my ($self, $args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
init: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | exists $args->{allow_undeclared} | ||||||||||||||||||||||||||||
| 27 | 0 | ▶ | or $args->{allow_undeclared} = 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 0 | ▶ | $args->{any_element} ||= 'SLOPPY'; # query results are sloppy | ||||||||||||||||||||||||||
|
Condition0%0/2
$args->{"any_element"} ||= "SLOPPY"
MC/DC0%0/1
$args->{"any_element"} ||= "SLOPPY"
$args->{"any_element"}
Truth table0%0/2
A
A= $args->{"any_element"}
| |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 0 | unshift @{$args->{opts_readers}} | |||||||||||||||||||||||||||
| 32 | , sloppy_integers => 1, sloppy_floats => 1; | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | $self->SUPER::init($args); | |||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 0 | (my $xsddir = __FILE__) =~ s,\.pm,/xsd-exist,; | |||||||||||||||||||||||||||
| 37 | 0 | my @xsds = glob "$xsddir/*.xsd"; | |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 0 | $self->addPrefixes(exist => NS_EXISTDB); | |||||||||||||||||||||||||||
| 40 | 0 | $self->importDefinitions(\@xsds); | |||||||||||||||||||||||||||
| 41 | 0 | $self; | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | sub createCollectionConfig($%) | ||||||||||||||||||||||||||||
| 46 | 0 | ▶ | { my ($self, $data, %args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
createCollectionConfig: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 0 | ▶ | my $format = (!exists $args{beautify} || $args{beautify}) ? 1 : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not exists $args{"beautify"} or $args{"beautify"}
MC/DC0%0/2
not exists $args{"beautify"} or $args{"beautify"}
not exists $args{"beautify"}
$args{"beautify"}
Truth table0%0/3
not(A) or B
A= not exists $args{"beautify"}B= $args{"beautify"}
| |||||||||||||||||||||||||||||
| 49 | 0 | my $string; | |||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | # create XML via XML::Compile | ||||||||||||||||||||||||||||
| 52 | my $writer = $self->{wr_coll_conf} ||= | ||||||||||||||||||||||||||||
| 53 | 0 | ▶ | $self->compile | ||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"wr_coll_conf"} ||= $self->compile("WRITER", $coll_type, "include_namespaces", 1, "sloppy_integers", 1)
MC/DC0%0/2
$self->{"wr_coll_conf"} ||= $self->compile("WRITER", $coll_type, "include_namespaces", 1, "sloppy_integers", 1)
$self->{"wr_coll_conf"}
$self->compile("WRITER", $coll_type, "include_namespaces", 1, "sloppy_integers", 1)
Truth table0%0/3
A ||= B
A= $self->{"wr_coll_conf"}B= $self->compile("WRITER", $coll_type, "include_namespaces", 1, "sloppy_integers", 1)
| |||||||||||||||||||||||||||||
| 54 | ( WRITER => $coll_type | ||||||||||||||||||||||||||||
| 55 | , include_namespaces => 1, sloppy_integers => 1 | ||||||||||||||||||||||||||||
| 56 | ); | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 0 | my $doc = XML::LibXML::Document->new('1.0', 'UTF-8'); | |||||||||||||||||||||||||||
| 59 | 0 | my $xml = $writer->($doc, $data); | |||||||||||||||||||||||||||
| 60 | 0 | $doc->setDocumentElement($xml); | |||||||||||||||||||||||||||
| 61 | 0 | $doc->toString($format); | |||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | # perl -MXML::eXistDB -e 'print XML::eXistDB->new->_coll_conf_template' | ||||||||||||||||||||||||||||
| 65 | 0 | ▶ | sub _coll_conf_template { shift->template(PERL => $coll_type) } | ||||||||||||||||||||||||||
|
Subroutine
_coll_conf_template: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | sub decodeXML($) | ||||||||||||||||||||||||||||
| 69 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
decodeXML: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 70 | 0 | my $xml = $self->dataToXML(shift); | |||||||||||||||||||||||||||
| 71 | 0 | my $type = type_of_node $xml; | |||||||||||||||||||||||||||
| 72 | 0 | my $known = $self->namespaces->find(element => $type); | |||||||||||||||||||||||||||
| 73 | 0 | ▶ | $known ? $self->reader($type)->($xml) : XMLin $xml; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 5 | 1; | |||||||||||||||||||||||||||