| 1 | # $Id$ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # This is free software, you may use it and distribute it under the same terms as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # Perl itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # Copyright 2001-2003 AxKit.com Ltd., 2002-2006 Christian Glahn, 2006-2009 Petr Pajas | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | package XML::LibXML; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 77 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 77 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | our ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 77 | $VERSION, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | $skipDTD, $skipXMLDeclaration, $setTagCompression, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | $MatchCB, $ReadCB, $OpenCB, $CloseCB, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 77 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 77 | ▶ | use constant XML_XMLNS_NS => 'http://www.w3.org/2000/xmlns/'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 77 | ▶ | use constant XML_XML_NS => 'http://www.w3.org/XML/1998/namespace'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 77 | ▶ | use XML::LibXML::Error; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 77 | ▶ | use XML::LibXML::NodeList; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 77 | ▶ | use XML::LibXML::XPathContext; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 77 | ▶ | use IO::Handle; # for FH reads called as methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 77 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 77 | $VERSION = "2.0213"; # VERSION TEMPLATE: DO NOT CHANGE | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 77 | our $ABI_VERSION = 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 77 | require Exporter; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 77 | ▶ | use XSLoader (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 77 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | sub VERSION { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
VERSION: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | my ($caller) = caller; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | my $req_abi = $ABI_VERSION; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | ▶ | if (UNIVERSAL::can($caller,'REQUIRE_XML_LIBXML_ABI_VERSION')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | $req_abi = $caller->REQUIRE_XML_LIBXML_ABI_VERSION(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } elsif ($caller eq 'XML::LibXSLT') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | # XML::LibXSLT without REQUIRE_XML_LIBXML_ABI_VERSION is an old and incompatible version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | $req_abi = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | unless ($req_abi == $ABI_VERSION) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | my $ver = @_ ? ' '.$_[0] : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | die ("This version of $caller requires XML::LibXML$ver (ABI $req_abi), which is incompatible with currently installed XML::LibXML $VERSION (ABI $ABI_VERSION). Please upgrade $caller, XML::LibXML, or both!"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | return $class->UNIVERSAL::VERSION(@_) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | # export information # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 77 | our %EXPORT_TAGS = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | all => [qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | XML_ELEMENT_NODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | XML_ATTRIBUTE_NODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | XML_TEXT_NODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | XML_CDATA_SECTION_NODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | XML_ENTITY_REF_NODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | XML_ENTITY_NODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | XML_PI_NODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | XML_COMMENT_NODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | XML_DOCUMENT_NODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | XML_DOCUMENT_TYPE_NODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | XML_DOCUMENT_FRAG_NODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | XML_NOTATION_NODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | XML_HTML_DOCUMENT_NODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | XML_DTD_NODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | XML_ELEMENT_DECL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | XML_ATTRIBUTE_DECL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | XML_ENTITY_DECL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | XML_NAMESPACE_DECL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | XML_XINCLUDE_END | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | XML_XINCLUDE_START | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | encodeToUTF8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | decodeFromUTF8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | XML_XMLNS_NS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | XML_XML_NS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | )], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | libxml => [qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | XML_ELEMENT_NODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | XML_ATTRIBUTE_NODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | XML_TEXT_NODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | XML_CDATA_SECTION_NODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | XML_ENTITY_REF_NODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | XML_ENTITY_NODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | XML_PI_NODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | XML_COMMENT_NODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | XML_DOCUMENT_NODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | XML_DOCUMENT_TYPE_NODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | XML_DOCUMENT_FRAG_NODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | XML_NOTATION_NODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | XML_HTML_DOCUMENT_NODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | XML_DTD_NODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | XML_ELEMENT_DECL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | XML_ATTRIBUTE_DECL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | XML_ENTITY_DECL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | XML_NAMESPACE_DECL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | XML_XINCLUDE_END | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | XML_XINCLUDE_START | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | )], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | encoding => [qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | encodeToUTF8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | decodeFromUTF8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | )], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | ns => [qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | XML_XMLNS_NS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | XML_XML_NS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | )], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | our @EXPORT_OK = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 77 | @{$EXPORT_TAGS{all}}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | our @EXPORT = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 77 | @{$EXPORT_TAGS{all}}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | # initialization of the global variables # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 77 | $skipDTD = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 77 | $skipXMLDeclaration = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 77 | $setTagCompression = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 77 | $MatchCB = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 77 | $ReadCB = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 77 | $OpenCB = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 77 | $CloseCB = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | # if ($threads::threads) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | # our $__THREADS_TID = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | # eval q{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | # use threads::shared; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | # our $__PROXY_NODE_REGISTRY_MUTEX :shared = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | # }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | # die $@ if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | # bootstrapping # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 77 | XSLoader::load( 'XML::LibXML', $VERSION ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 77 | undef &AUTOLOAD; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 77 | *encodeToUTF8 = \&XML::LibXML::Common::encodeToUTF8; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 77 | *decodeFromUTF8 = \&XML::LibXML::Common::decodeFromUTF8; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } # BEGIN | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | # libxml2 node names (see also XML::LibXML::Common # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 77 | ▶ | use constant XML_ELEMENT_NODE => 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 77 | ▶ | use constant XML_ATTRIBUTE_NODE => 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 77 | ▶ | use constant XML_TEXT_NODE => 3; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 77 | ▶ | use constant XML_CDATA_SECTION_NODE => 4; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 77 | ▶ | use constant XML_ENTITY_REF_NODE => 5; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 77 | ▶ | use constant XML_ENTITY_NODE => 6; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 77 | ▶ | use constant XML_PI_NODE => 7; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 77 | ▶ | use constant XML_COMMENT_NODE => 8; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 77 | ▶ | use constant XML_DOCUMENT_NODE => 9; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 77 | ▶ | use constant XML_DOCUMENT_TYPE_NODE => 10; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 77 | ▶ | use constant XML_DOCUMENT_FRAG_NODE => 11; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 77 | ▶ | use constant XML_NOTATION_NODE => 12; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 77 | ▶ | use constant XML_HTML_DOCUMENT_NODE => 13; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 77 | ▶ | use constant XML_DTD_NODE => 14; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 77 | ▶ | use constant XML_ELEMENT_DECL => 15; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 77 | ▶ | use constant XML_ATTRIBUTE_DECL => 16; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 77 | ▶ | use constant XML_ENTITY_DECL => 17; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 77 | ▶ | use constant XML_NAMESPACE_DECL => 18; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 77 | ▶ | use constant XML_XINCLUDE_START => 19; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 77 | ▶ | use constant XML_XINCLUDE_END => 20; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 77 | our ($__PROXY_NODE_REGISTRY, $__threads_shared, $__PROXY_NODE_REGISTRY_MUTEX, $__loaded); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 247 | ▶ | sub import { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
import: called CC=8 SCAR=33.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 247 | my $package=shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 247 | ▶ | if (grep /^:threads_shared$/, @_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | require threads; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | if (!defined($__threads_shared)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | if (INIT_THREAD_SUPPORT()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | eval q{ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | use threads::shared; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | share($__PROXY_NODE_REGISTRY_MUTEX); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | ▶ | if ($@) { # something went wrong | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | DISABLE_THREAD_SUPPORT(); # leave the library in a usable state | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | die $@; # and die | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | $__PROXY_NODE_REGISTRY = XML::LibXML::HashTable->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | $__threads_shared=1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | croak("XML::LibXML or Perl compiled without ithread support!"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | } elsif (!$__threads_shared) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | croak("XML::LibXML already loaded without thread support. Too late to enable thread support!"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | } elsif (defined $__loaded) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 93 | ▶ | $__threads_shared=0 if not defined $__threads_shared; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 247 | __PACKAGE__->export_to_level(1,$package,grep !/^:threads(_shared)?$/,@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | ▶ | sub threads_shared_enabled { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
threads_shared_enabled: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | ▶ | return $__threads_shared ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | # if ($threads::threads) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | # our $__PROXY_NODE_REGISTRY = XML::LibXML::HashTable->new(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | # test exact version (up to patch-level) # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 77 | my ($runtime_version) = LIBXML_RUNTIME_VERSION() =~ /^(\d+)/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 77 | ▶ | if ( $runtime_version < LIBXML_VERSION ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | warn "Warning: XML::LibXML compiled against libxml2 ".LIBXML_VERSION. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | ", but runtime libxml2 is older $runtime_version\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | # parser flags # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | # Copied directly from http://xmlsoft.org/html/libxml-parser.html#xmlParserOption | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 77 | ▶ | use constant { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 77 | XML_PARSE_RECOVER => 1, # recover on errors | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | XML_PARSE_NOENT => 2, # substitute entities | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | XML_PARSE_DTDLOAD => 4, # load the external subset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | XML_PARSE_DTDATTR => 8, # default DTD attributes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | XML_PARSE_DTDVALID => 16, # validate with the DTD | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | XML_PARSE_NOERROR => 32, # suppress error reports | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | XML_PARSE_NOWARNING => 64, # suppress warning reports | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | XML_PARSE_PEDANTIC => 128, # pedantic error reporting | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | XML_PARSE_NOBLANKS => 256, # remove blank nodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | XML_PARSE_SAX1 => 512, # use the SAX1 interface internally | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | XML_PARSE_XINCLUDE => 1024, # Implement XInclude substitution | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | XML_PARSE_NONET => 2048, # Forbid network access | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | XML_PARSE_NODICT => 4096, # Do not reuse the context dictionary | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | XML_PARSE_NSCLEAN => 8192, # remove redundant namespaces declarations | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | XML_PARSE_NOCDATA => 16384, # merge CDATA as text nodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | XML_PARSE_NOXINCNODE => 32768, # do not generate XINCLUDE START/END nodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | XML_PARSE_COMPACT => 65536, # compact small text nodes; no modification of the tree allowed afterwards | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | # (will possibly crash if you try to modify the tree) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | XML_PARSE_OLD10 => 131072, # parse using XML-1.0 before update 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | XML_PARSE_NOBASEFIX => 262144, # do not fixup XINCLUDE xml#base uris | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | XML_PARSE_HUGE => 524288, # relax any hardcoded limit from the parser | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | XML_PARSE_OLDSAX => 1048576, # parse using SAX2 interface from before 2.7.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | HTML_PARSE_RECOVER => (1<<0), # suppress error reports | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | HTML_PARSE_NOERROR => (1<<5), # suppress error reports | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 77 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 77 | our $XML_LIBXML_PARSE_DEFAULTS = ( XML_PARSE_NODICT ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | # this hash is made global so that applications can add names for new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | # libxml2 parser flags as temporary workaround | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 77 | our %PARSER_FLAGS = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | recover => XML_PARSE_RECOVER, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | expand_entities => XML_PARSE_NOENT, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | load_ext_dtd => XML_PARSE_DTDLOAD, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | complete_attributes => XML_PARSE_DTDATTR, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | validation => XML_PARSE_DTDVALID, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | suppress_errors => XML_PARSE_NOERROR, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | suppress_warnings => XML_PARSE_NOWARNING, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | pedantic_parser => XML_PARSE_PEDANTIC, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | no_blanks => XML_PARSE_NOBLANKS, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | expand_xinclude => XML_PARSE_XINCLUDE, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | xinclude => XML_PARSE_XINCLUDE, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | no_network => XML_PARSE_NONET, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | clean_namespaces => XML_PARSE_NSCLEAN, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | no_cdata => XML_PARSE_NOCDATA, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | no_xinclude_nodes => XML_PARSE_NOXINCNODE, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | old10 => XML_PARSE_OLD10, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | no_base_fix => XML_PARSE_NOBASEFIX, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | huge => XML_PARSE_HUGE, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | oldsax => XML_PARSE_OLDSAX, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 77 | my %OUR_FLAGS = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | recover => 'XML_LIBXML_RECOVER', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | line_numbers => 'XML_LIBXML_LINENUMBERS', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | URI => 'XML_LIBXML_BASE_URI', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | base_uri => 'XML_LIBXML_BASE_URI', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | gdome => 'XML_LIBXML_GDOME', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | ext_ent_handler => 'ext_ent_handler', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 167 | ▶ | sub _parser_options { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parser_options: called CC=8 SCAR=21.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 167 | my ($self, $opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | # currently dictionaries break XML::LibXML memory management | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 167 | my $flags; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 167 | ▶ | if (ref($self)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 30 | ▶ | $flags = ($self->{XML_LIBXML_PARSER_OPTIONS}||0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{'XML_LIBXML_PARSER_OPTIONS'} || 0
MC/DC0%0/1
$self->{'XML_LIBXML_PARSER_OPTIONS'} || 0
$self->{'XML_LIBXML_PARSER_OPTIONS'}
Truth table50%1/2
A
A= $self->{'XML_LIBXML_PARSER_OPTIONS'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 137 | $flags = $XML_LIBXML_PARSE_DEFAULTS; # safety precaution | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 167 | my ($key, $value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 167 | ▶ | while (($key,$value) = each %$opts) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 286 | my $f = $PARSER_FLAGS{ $key }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 286 | ▶ | if (defined $f) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 194 | ▶ | if ($value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 166 | $flags |= $f | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 28 | $flags &= ~$f; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | } elsif ($key eq 'set_parser_flags') { # this can be used to pass flags XML::LibXML does not yet know about | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | $flags |= $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | } elsif ($key eq 'unset_parser_flags') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | $flags &= ~$value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 167 | return $flags; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 77 | my %compatibility_flags = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | XML_LIBXML_VALIDATION => 'validation', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | XML_LIBXML_EXPAND_ENTITIES => 'expand_entities', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | XML_LIBXML_PEDANTIC => 'pedantic_parser', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | XML_LIBXML_NONET => 'no_network', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | XML_LIBXML_EXT_DTD => 'load_ext_dtd', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | XML_LIBXML_COMPLETE_ATTR => 'complete_attributes', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | XML_LIBXML_EXPAND_XINCLUDE => 'expand_xinclude', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | XML_LIBXML_NSCLEAN => 'clean_namespaces', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | XML_LIBXML_KEEP_BLANKS => 'keep_blanks', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | XML_LIBXML_LINENUMBERS => 'line_numbers', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | # parser constructor # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 223 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=13 SCAR=26.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 223 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 223 | my $self = bless { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | }, $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 223 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 78 | my %opts = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 78 | ▶ | if (ref($_[0]) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 61 | %opts = %{$_[0]}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | # old interface | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 17 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | %opts=( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 17 | ▶ | (($compatibility_flags{ $_ }||$_) => $args{ $_ }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$compatibility_flags{$_} || $_
MC/DC0%0/2
$compatibility_flags{$_} || $_
$compatibility_flags{$_}
$_
Truth table33%1/3
A || B
A= $compatibility_flags{$_}B= $_
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | } keys %args | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | # parser flags | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 78 | ▶ | $opts{no_blanks} = !$opts{keep_blanks} if exists($opts{keep_blanks}) and !exists($opts{no_blanks}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $opts{"keep_blanks"} and not exists $opts{"no_blanks"}
MC/DC0%0/2
exists $opts{"keep_blanks"} and not exists $opts{"no_blanks"}
exists $opts{"keep_blanks"}
not exists $opts{"no_blanks"}
Truth table33%1/3
A and not(B)
A= exists $opts{"keep_blanks"}B= not exists $opts{"no_blanks"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 78 | ▶ | $opts{load_ext_dtd} = $opts{expand_entities} if exists($opts{expand_entities}) and !exists($opts{load_ext_dtd}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
exists $opts{"expand_entities"} and not exists $opts{"load_ext_dtd"}
MC/DC100%2/2
exists $opts{"expand_entities"} and not exists $opts{"load_ext_dtd"}
exists $opts{"expand_entities"}
not exists $opts{"load_ext_dtd"}
Truth table100%3/3
A and not(B)
A= exists $opts{"expand_entities"}B= not exists $opts{"load_ext_dtd"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 78 | for (keys %OUR_FLAGS) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 468 | $self->{$OUR_FLAGS{$_}} = delete $opts{$_}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 78 | ▶ | $class->load_catalog(delete($opts{catalog})) if $opts{catalog}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 78 | $self->{XML_LIBXML_PARSER_OPTIONS} = XML::LibXML->_parser_options(\%opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | # store remaining unknown options directly in $self | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 78 | for (keys %opts) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 186 | ▶ | $self->{$_}=$opts{$_} unless exists $PARSER_FLAGS{$_}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 145 | $self->{XML_LIBXML_PARSER_OPTIONS} = $XML_LIBXML_PARSE_DEFAULTS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 223 | ▶ | if ( defined $self->{Handler} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | $self->set_handler( $self->{Handler} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 223 | $self->{_State_} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 223 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 13 | ▶ | sub _clone { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_clone: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 13 | my ($self)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | my $new = ref($self)->new({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | recover => $self->{XML_LIBXML_RECOVER}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | line_numbers => $self->{XML_LIBXML_LINENUMBERS}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | base_uri => $self->{XML_LIBXML_BASE_URI}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | gdome => $self->{XML_LIBXML_GDOME}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 13 | }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | # The parser options may contain some options that were zeroed from the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | # defaults so set_parser_flags won't work here. We need to assign them | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | # explicitly. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 13 | $new->{XML_LIBXML_PARSER_OPTIONS} = $self->{XML_LIBXML_PARSER_OPTIONS}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 13 | $new->input_callbacks($self->input_callbacks()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 13 | return $new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | # Threads support methods # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | # threads doc says CLONE's API may change in future, which would break | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | # an XS method prototype | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | ▶ | sub CLONE { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CLONE: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | ▶ | if ($XML::LibXML::__threads_shared) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | XML::LibXML::_CLONE( $_[0] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | ▶ | sub CLONE_SKIP { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CLONE_SKIP: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | ▶ | return $XML::LibXML::__threads_shared ? 0 : 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | ▶ | sub __proxy_registry { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__proxy_registry: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | my ($class)=caller; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | die "This version of $class uses API of XML::LibXML 1.66 which is not compatible with XML::LibXML $VERSION. Please upgrade $class!\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | # DOM Level 2 document constructor # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 14 | ▶ | sub createDocument { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
createDocument: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 14 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 14 | ▶ | if (!@_ or $_[0] =~ m/^\d\.\d$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not @_ or $_[0] =~ /^\d\.\d$/
MC/DC100%2/2
not @_ or $_[0] =~ /^\d\.\d$/
not @_
$_[0] =~ /^\d\.\d$/
Truth table100%3/3
not(A) or B
A= not @_B= $_[0] =~ /^\d\.\d$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | # for backward compatibility | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 10 | return XML::LibXML::Document->new(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | # DOM API: createDocument(namespaceURI, qualifiedName, doctype?) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 4 | my $doc = XML::LibXML::Document-> new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 4 | my $el = $doc->createElementNS(shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 4 | $doc->setDocumentElement($el); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 4 | ▶ | $doc->setExternalSubset(shift) if @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 4 | return $doc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | # callback functions # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | sub externalEntityLoader(;$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 51 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
externalEntityLoader: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 51 | return _externalEntityLoader($_[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 34 | ▶ | sub input_callbacks { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
input_callbacks: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 34 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 34 | my $icbclass = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 34 | ▶ | if ( defined $icbclass ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 10 | $self->{XML_LIBXML_CALLBACK_STACK} = $icbclass; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 34 | return $self->{XML_LIBXML_CALLBACK_STACK}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 723 | ▶ | sub match_callback { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
match_callback: called CC=4 SCAR=15.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 723 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 723 | ▶ | if ( ref $self ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 723 | ▶ | if ( scalar @_ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 4 | $self->{XML_LIBXML_MATCH_CB} = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 4 | $self->{XML_LIBXML_CALLBACK_STACK} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 723 | return $self->{XML_LIBXML_MATCH_CB}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | ▶ | $MatchCB = shift if scalar @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | return $MatchCB; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 723 | ▶ | sub read_callback { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
read_callback: called CC=4 SCAR=15.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 723 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 723 | ▶ | if ( ref $self ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 723 | ▶ | if ( scalar @_ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 4 | $self->{XML_LIBXML_READ_CB} = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 4 | $self->{XML_LIBXML_CALLBACK_STACK} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 723 | return $self->{XML_LIBXML_READ_CB}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | ▶ | $ReadCB = shift if scalar @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | return $ReadCB; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 723 | ▶ | sub close_callback { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
close_callback: called CC=4 SCAR=15.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 723 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 723 | ▶ | if ( ref $self ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 723 | ▶ | if ( scalar @_ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 4 | $self->{XML_LIBXML_CLOSE_CB} = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 4 | $self->{XML_LIBXML_CALLBACK_STACK} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 723 | return $self->{XML_LIBXML_CLOSE_CB}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | ▶ | $CloseCB = shift if scalar @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 0 | return $CloseCB; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 723 | ▶ | sub open_callback { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
open_callback: called CC=4 SCAR=15.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 723 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 723 | ▶ | if ( ref $self ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 723 | ▶ | if ( scalar @_ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 4 | $self->{XML_LIBXML_OPEN_CB} = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 4 | $self->{XML_LIBXML_CALLBACK_STACK} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 723 | return $self->{XML_LIBXML_OPEN_CB}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | ▶ | $OpenCB = shift if scalar @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | return $OpenCB; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | ▶ | sub callbacks { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
callbacks: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | ▶ | if ( ref $self ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | my ($match, $open, $read, $close) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | @{$self}{qw(XML_LIBXML_MATCH_CB XML_LIBXML_OPEN_CB XML_LIBXML_READ_CB XML_LIBXML_CLOSE_CB)} = ($match, $open, $read, $close); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | $self->{XML_LIBXML_CALLBACK_STACK} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | return @{$self}{qw(XML_LIBXML_MATCH_CB XML_LIBXML_OPEN_CB XML_LIBXML_READ_CB XML_LIBXML_CLOSE_CB)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | ( $MatchCB, $OpenCB, $ReadCB, $CloseCB ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | return ( $MatchCB, $OpenCB, $ReadCB, $CloseCB ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | # internal member variable manipulation # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 708 | ▶ | sub __parser_option { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__parser_option: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 708 | my ($self, $opt) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 708 | ▶ | if (@_>2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 117 | ▶ | if ($_[2]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 66 | $self->{XML_LIBXML_PARSER_OPTIONS} |= $opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 66 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 51 | $self->{XML_LIBXML_PARSER_OPTIONS} &= ~$opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 51 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 591 | ▶ | return ($self->{XML_LIBXML_PARSER_OPTIONS} & $opt) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 24 | ▶ | sub option_exists { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
option_exists: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 24 | my ($self,$name)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 24 | ▶ | return ($PARSER_FLAGS{$name} || $OUR_FLAGS{$name}) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$XML::LibXML::PARSER_FLAGS{$name} or $OUR_FLAGS{$name}
MC/DC100%2/2
$XML::LibXML::PARSER_FLAGS{$name} or $OUR_FLAGS{$name}
$XML::LibXML::PARSER_FLAGS{$name}
$OUR_FLAGS{$name}
Truth table100%3/3
A or B
A= $XML::LibXML::PARSER_FLAGS{$name}B= $OUR_FLAGS{$name}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 170 | ▶ | sub get_option { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_option: called CC=3 SCAR=11.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 170 | my ($self,$name)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 170 | my $flag = $OUR_FLAGS{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 170 | ▶ | return $self->{$flag} if $flag; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 136 | $flag = $PARSER_FLAGS{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 136 | ▶ | return $self->__parser_option($flag) if $flag; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | warn "XML::LibXML::get_option: unknown parser option $name\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 58 | ▶ | sub set_option { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_option: called CC=3 SCAR=11.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 58 | my ($self,$name,$value)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 58 | my $flag = $OUR_FLAGS{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 58 | ▶ | return ($self->{$flag}=$value) if $flag; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 39 | $flag = $PARSER_FLAGS{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 39 | ▶ | return $self->__parser_option($flag,$value) if $flag; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 0 | warn "XML::LibXML::get_option: unknown parser option $name\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 1 | ▶ | sub set_options { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_options: called CC=5 SCAR=20.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 1 | my $self=shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 1 | my $opts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 1 | ▶ | if (@_==1 and ref($_[0]) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
@_ == 1 and ref $_[0] eq "HASH"
MC/DC0%0/2
@_ == 1 and ref $_[0] eq "HASH"
@_ == 1
ref $_[0] eq "HASH"
Truth table33%1/3
A and B
A= @_ == 1B= ref $_[0] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 1 | $opts = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | } elsif (@_ % 2 == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 0 | $opts={@_}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | croak("Odd number of elements passed to set_options"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 1 | $self->set_option($_=>$opts->{$_}) foreach keys %$opts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 9 | ▶ | sub validation { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validation: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 9 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 9 | return $self->__parser_option(XML_PARSE_DTDVALID,@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 65 | ▶ | sub recover { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
recover: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 65 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 65 | ▶ | if (scalar @_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 5 | $self->{XML_LIBXML_RECOVER} = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 5 | $self->__parser_option(XML_PARSE_RECOVER,@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 65 | return $self->{XML_LIBXML_RECOVER}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 32 | ▶ | sub recover_silently { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
recover_silently: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 32 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 32 | my $arg = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 32 | ▶ | if ( defined($arg) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 2 | ▶ | $self->recover(($arg == 1) ? 2 : $arg); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 32 | ▶ | return (($self->recover()||0) == 2) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$self->recover || 0
MC/DC100%1/1
$self->recover || 0
$self->recover
Truth table100%2/2
A
A= $self->recover
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 17 | ▶ | sub expand_entities { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
expand_entities: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 17 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 17 | ▶ | if (scalar(@_) and $_[0]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
scalar @_ and $_[0]
MC/DC100%2/2
scalar @_ and $_[0]
scalar @_
$_[0]
Truth table100%3/3
A and B
A= scalar @_B= $_[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 7 | return $self->__parser_option(XML_PARSE_NOENT | XML_PARSE_DTDLOAD,1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 10 | return $self->__parser_option(XML_PARSE_NOENT,@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 36 | ▶ | sub keep_blanks { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
keep_blanks: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 36 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 36 | my @args; # we have to negate the argument and return negated value, since | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | # the actual flag is no_blanks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 36 | ▶ | if (scalar @_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 7 | ▶ | @args=($_[0] ? 0 : 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 36 | ▶ | return $self->__parser_option(XML_PARSE_NOBLANKS,@args) ? 0 : 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 36 | ▶ | sub pedantic_parser { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pedantic_parser: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 36 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 36 | return $self->__parser_option(XML_PARSE_PEDANTIC,@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 8 | ▶ | sub line_numbers { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
line_numbers: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 8 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 8 | ▶ | $self->{XML_LIBXML_LINENUMBERS} = shift if scalar @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 8 | return $self->{XML_LIBXML_LINENUMBERS}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 34 | ▶ | sub no_network { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
no_network: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 34 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 34 | return $self->__parser_option(XML_PARSE_NONET,@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 20 | ▶ | sub load_ext_dtd { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_ext_dtd: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 20 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 20 | return $self->__parser_option(XML_PARSE_DTDLOAD,@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 11 | ▶ | sub complete_attributes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
complete_attributes: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 11 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 11 | return $self->__parser_option(XML_PARSE_DTDATTR,@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 357 | ▶ | sub expand_xinclude { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
expand_xinclude: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 357 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 357 | return $self->__parser_option(XML_PARSE_XINCLUDE,@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 4 | ▶ | sub base_uri { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
base_uri: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 4 | ▶ | $self->{XML_LIBXML_BASE_URI} = shift if scalar @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 4 | return $self->{XML_LIBXML_BASE_URI}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 0 | ▶ | sub gdome_dom { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gdome_dom: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 0 | ▶ | $self->{XML_LIBXML_GDOME} = shift if scalar @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 0 | return $self->{XML_LIBXML_GDOME}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 8 | ▶ | sub clean_namespaces { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clean_namespaces: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 8 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 8 | return $self->__parser_option(XML_PARSE_NSCLEAN,@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | # set the optional SAX(2) handler # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 82 | ▶ | sub set_handler { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_handler: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 82 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 82 | ▶ | if ( defined $_[0] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 42 | $self->{HANDLER} = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 42 | $self->{SAX_ELSTACK} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 42 | $self->{SAX} = {State => 0}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | # undef SAX handling | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 40 | $self->{SAX_ELSTACK} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 40 | delete $self->{HANDLER}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | 40 | delete $self->{SAX}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | # helper functions # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 336 | ▶ | sub _auto_expand { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_auto_expand: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | 336 | my ( $self, $result, $uri ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | 336 | ▶ | $result->setBaseURI( $uri ) if defined $uri; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 336 | ▶ | if ( $self->expand_xinclude ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 16 | $self->{_State_} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 16 | eval { $self->processXIncludes($result); }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | 16 | my $err = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 16 | $self->{_State_} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 16 | ▶ | if ($err) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 1 | $self->_cleanup_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 1 | $result = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 1 | croak $err; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 335 | return $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 719 | ▶ | sub _init_callbacks { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_init_callbacks: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 719 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 719 | my $icb = $self->{XML_LIBXML_CALLBACK_STACK}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 719 | ▶ | unless ( defined $icb ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 197 | $self->{XML_LIBXML_CALLBACK_STACK} = XML::LibXML::InputCallback->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | 197 | $icb = $self->{XML_LIBXML_CALLBACK_STACK}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 719 | $icb->init_callbacks($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 719 | ▶ | sub _cleanup_callbacks { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_cleanup_callbacks: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | 719 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 719 | $self->{XML_LIBXML_CALLBACK_STACK}->cleanup_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 23 | ▶ | sub __read { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__read: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 23 | read($_[0], $_[1], $_[2]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 1 | ▶ | sub __write { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__write: called CC=2 SCAR=8.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | 1 | ▶ | if ( ref( $_[0] ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 1 | $_[0]->write( $_[1], $_[2] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 0 | $_[0]->write( $_[1] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 21 | ▶ | sub load_xml { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_xml: called CC=7 SCAR=19.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 21 | my $class_or_self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 21 | ▶ | my %args = map { ref($_) eq 'HASH' ? (%$_) : $_ } @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | 21 | my $URI = delete($args{URI}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 21 | ▶ | $URI = "$URI" if defined $URI; # stringify in case it is an URI object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 21 | my $parser; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | 21 | ▶ | if (ref($class_or_self)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 8 | $parser = $class_or_self->_clone(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | 8 | $parser->{XML_LIBXML_PARSER_OPTIONS} = $parser->_parser_options(\%args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 13 | $parser = $class_or_self->new(\%args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 21 | my $dom; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | 21 | ▶ | if ( defined $args{location} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | 1 | $dom = $parser->parse_file( "$args{location}" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | elsif ( defined $args{string} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | 18 | $dom = $parser->parse_string( $args{string}, $URI ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | elsif ( defined $args{IO} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 2 | $dom = $parser->parse_fh( $args{IO}, $URI ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 0 | croak("XML::LibXML->load: specify location, string, or IO"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | 21 | return $dom; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | 5 | ▶ | sub load_html { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_html: called CC=7 SCAR=23.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 5 | my ($class_or_self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 5 | ▶ | my %args = map { ref($_) eq 'HASH' ? (%$_) : $_ } @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 5 | my $URI = delete($args{URI}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | 5 | ▶ | $URI = "$URI" if defined $URI; # stringify in case it is an URI object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 5 | my $parser; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | 5 | ▶ | if (ref($class_or_self)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 5 | $parser = $class_or_self->_clone(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 0 | $parser = $class_or_self->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 5 | my $dom; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 5 | ▶ | if ( defined $args{location} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | 0 | $dom = $parser->parse_html_file( "$args{location}", \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | elsif ( defined $args{string} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | 5 | $dom = $parser->parse_html_string( $args{string}, \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | elsif ( defined $args{IO} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | 0 | $dom = $parser->parse_html_fh( $args{IO}, \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | 0 | croak("XML::LibXML->load: specify location, string, or IO"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 5 | return $dom; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | # parsing functions # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | # all parsing functions handle normal as SAX parsing at the same time. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | # note that SAX parsing is handled incomplete! use XML::LibXML::SAX for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | # complete parsing sequences | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 405 | ▶ | sub parse_string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_string: called CC=10 SCAR=23.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | 405 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | 405 | ▶ | croak("parse_string is not a class method! Create a parser object with XML::LibXML->new first!") unless ref $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | 405 | ▶ | croak("parse already in progress") if $self->{_State_}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | 405 | ▶ | unless ( defined $_[0] and length $_[0] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $_[0] and length $_[0]
MC/DC100%2/2
defined $_[0] and length $_[0]
defined $_[0]
length $_[0]
Truth table100%3/3
A and B
A= defined $_[0]B= length $_[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 8 | croak("Empty String"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | 397 | $self->{_State_} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 397 | my $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | 397 | $self->_init_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | 397 | ▶ | if ( defined $self->{SAX} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 37 | my $string = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | 37 | $self->{SAX_ELSTACK} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | 37 | eval { $result = $self->_parse_sax_string($string); }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | 37 | my $err = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 37 | $self->{_State_} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | 37 | ▶ | if ($err) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | 3 | ▶ | chomp $err unless ref $err; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 3 | $self->_cleanup_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | 3 | croak $err; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | 360 | eval { $result = $self->_parse_string( @_ ); }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | 360 | my $err = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | 360 | $self->{_State_} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | 360 | ▶ | if ($err) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 90 | ▶ | chomp $err unless ref $err; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 90 | $self->_cleanup_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | 90 | croak $err; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | 270 | $result = $self->_auto_expand( $result, $self->{XML_LIBXML_BASE_URI} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | 303 | $self->_cleanup_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | 303 | return $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | 9 | ▶ | sub parse_fh { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_fh: called CC=8 SCAR=24.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | 9 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | 9 | ▶ | croak("parse_fh is not a class method! Create a parser object with XML::LibXML->new first!") unless ref $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | 9 | ▶ | croak("parse already in progress") if $self->{_State_}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | 9 | $self->{_State_} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | 9 | my $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | 9 | $self->_init_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | 9 | ▶ | if ( defined $self->{SAX} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | 0 | $self->{SAX_ELSTACK} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | 0 | eval { $self->_parse_sax_fh( @_ ); }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | 0 | my $err = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | 0 | $self->{_State_} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 0 | ▶ | if ($err) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 0 | ▶ | chomp $err unless ref $err; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 0 | $self->_cleanup_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | 0 | croak $err; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 9 | eval { $result = $self->_parse_fh( @_ ); }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | 9 | my $err = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 9 | $self->{_State_} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | 9 | ▶ | if ($err) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | 3 | ▶ | chomp $err unless ref $err; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | 3 | $self->_cleanup_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 3 | croak $err; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 6 | $result = $self->_auto_expand( $result, $self->{XML_LIBXML_BASE_URI} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 6 | $self->_cleanup_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 6 | return $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 67 | ▶ | sub parse_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_file: called CC=8 SCAR=21.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | 67 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 67 | ▶ | croak("parse_file is not a class method! Create a parser object with XML::LibXML->new first!") unless ref $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | 67 | ▶ | croak("parse already in progress") if $self->{_State_}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | 67 | $self->{_State_} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 67 | my $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 67 | $self->_init_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | 67 | ▶ | if ( defined $self->{SAX} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | 1 | $self->{SAX_ELSTACK} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | 1 | eval { $self->_parse_sax_file( @_ ); }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | 1 | my $err = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | 1 | $self->{_State_} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | 1 | ▶ | if ($err) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | 0 | ▶ | chomp $err unless ref $err; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | 0 | $self->_cleanup_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | 0 | croak $err; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | 66 | eval { $result = $self->_parse_file(@_); }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | 66 | my $err = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | 66 | $self->{_State_} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | 66 | ▶ | if ($err) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | 6 | ▶ | chomp $err unless ref $err; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | 6 | $self->_cleanup_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | 6 | croak $err; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | 60 | $result = $self->_auto_expand( $result ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | 61 | $self->_cleanup_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | 61 | return $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | 75 | ▶ | sub parse_xml_chunk { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_xml_chunk: called CC=9 SCAR=22.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | 75 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | # max 2 parameter: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | # 1: the chunk | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | # 2: the encoding of the string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | 75 | ▶ | croak("parse_xml_chunk is not a class method! Create a parser object with XML::LibXML->new first!") unless ref $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | 75 | ▶ | croak("parse already in progress") if $self->{_State_}; my $result; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | 75 | ▶ | unless ( defined $_[0] and length $_[0] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $_[0] and length $_[0]
MC/DC100%2/2
defined $_[0] and length $_[0]
defined $_[0]
length $_[0]
Truth table100%3/3
A and B
A= defined $_[0]B= length $_[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | 3 | croak("Empty String"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 72 | $self->{_State_} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | 72 | $self->_init_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | 72 | ▶ | if ( defined $self->{SAX} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | 29 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | 29 | $self->_parse_sax_xml_chunk( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | # this is required for XML::GenericChunk. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | # in normal case is_filter is not defined, an thus the parsing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | # will be terminated. in case of a SAX filter the parsing is not | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | # finished at that state. therefore we must not reset the parsing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | 29 | ▶ | unless ( $self->{IS_FILTER} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | 27 | $result = $self->{HANDLER}->end_document(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | 43 | eval { $result = $self->_parse_xml_chunk( @_ ); }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | 72 | $self->_cleanup_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | 72 | my $err = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | 72 | $self->{_State_} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | 72 | ▶ | if ($err) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | 8 | ▶ | chomp $err unless ref $err; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | 8 | croak $err; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | 64 | return $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | 1 | ▶ | sub parse_balanced_chunk { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_balanced_chunk: called CC=3 SCAR=12.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | 1 | $self->_init_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | 1 | my $rv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | 1 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | 1 | $rv = $self->parse_xml_chunk( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | 1 | my $err = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | 1 | $self->_cleanup_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | 1 | ▶ | if ( $err ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | 0 | ▶ | chomp $err unless ref $err; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | 0 | croak $err; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 1 | return $rv | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | # java style | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | 22 | ▶ | sub processXIncludes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
processXIncludes: called CC=6 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | 22 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | 22 | my $doc = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | 22 | my $opts = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | 22 | my $options = $self->_parser_options($opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | 22 | ▶ | if ( $self->{_State_} != 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | 6 | $self->_init_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | 22 | my $rv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | 22 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | 22 | ▶ | $rv = $self->_processXIncludes($doc || " ", $options); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$doc || ' '
MC/DC100%1/1
$doc || ' '
$doc
Truth table100%2/2
A
A= $doc
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | 22 | my $err = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | 22 | ▶ | if ( $self->{_State_} != 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | 6 | $self->_cleanup_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | 22 | ▶ | if ( $err ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | 4 | ▶ | chomp $err unless ref $err; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | 4 | croak $err; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | 18 | return $rv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | # perl style | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | 0 | ▶ | sub process_xincludes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
process_xincludes: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | 0 | my $doc = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | 0 | my $opts = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | 0 | my $options = $self->_parser_options($opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | 0 | my $rv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | 0 | $self->_init_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | 0 | ▶ | $rv = $self->_processXIncludes($doc || " ", $options); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$doc || ' '
MC/DC0%0/1
$doc || ' '
$doc
Truth table0%0/2
A
A= $doc
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | 0 | my $err = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | 0 | $self->_cleanup_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | 0 | ▶ | if ( $err ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | 0 | ▶ | chomp $err unless ref $err; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | 0 | croak $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | 0 | return $rv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | # HTML parsing functions # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | 27 | ▶ | sub _html_options { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_html_options: called CC=20 SCAR=31.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | 27 | my ($self,$opts)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | 27 | ▶ | $opts = {} unless ref $opts; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | # return (undef,undef) unless ref $opts; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | 27 | my $flags = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | 27 | ▶ | my $recover = exists $opts->{recover} ? $opts->{recover} : $self->recover; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | 27 | ▶ | if ($recover) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | 19 | $flags |= HTML_PARSE_RECOVER; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | 19 | ▶ | if ($recover == 2) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | 4 | $flags |= HTML_PARSE_NOERROR; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | 27 | ▶ | $flags |= 4 if $opts->{no_defdtd}; # default is ON: injects DTD as needed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | 27 | ▶ | $flags |= 32 if exists $opts->{suppress_errors} ? $opts->{suppress_errors} : $self->get_option('suppress_errors'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | # This is to fix https://rt.cpan.org/Ticket/Display.html?id=58024 : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | # <quote> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | # In XML::LibXML, warnings are not suppressed when specifying the recover | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | # or recover_silently flags as per the following excerpt from the manpage: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | # </quote> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | 27 | ▶ | if ($self->recover_silently) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | 1 | $flags |= 32; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | 27 | ▶ | $flags |= 64 if $opts->{suppress_warnings}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | 27 | ▶ | $flags |= 128 if exists $opts->{pedantic_parser} ? $opts->{pedantic_parser} : $self->pedantic_parser; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | 27 | ▶ | $flags |= 256 if exists $opts->{no_blanks} ? $opts->{no_blanks} : !$self->keep_blanks; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | 27 | ▶ | $flags |= 2048 if exists $opts->{no_network} ? $opts->{no_network} : !$self->no_network; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | 27 | ▶ | $flags |= 16384 if $opts->{no_cdata}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | 27 | ▶ | $flags |= 65536 if $opts->{compact}; # compact small text nodes; no modification | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | # of the tree allowed afterwards | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | # (WILL possibly CRASH IF YOU try to MODIFY THE TREE) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | 27 | ▶ | $flags |= 524288 if $opts->{huge}; # relax any hardcoded limit from the parser | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | 27 | ▶ | $flags |= 1048576 if $opts->{oldsax}; # parse using SAX2 interface from before 2.7.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | 27 | return ($opts->{URI},$opts->{encoding},$flags); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | 17 | ▶ | sub parse_html_string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_html_string: called CC=7 SCAR=22.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | 17 | my ($self,$str,$opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | 17 | ▶ | croak("parse_html_string is not a class method! Create a parser object with XML::LibXML->new first!") unless ref $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | 17 | ▶ | croak("parse already in progress") if $self->{_State_}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | 17 | ▶ | unless ( defined $str and length $str ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $str and length $str
MC/DC0%0/2
defined $str and length $str
defined $str
length $str
Truth table33%1/3
A and B
A= defined $strB= length $str
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | 0 | croak("Empty String"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | 17 | $self->{_State_} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | 17 | my $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | 17 | $self->_init_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | 17 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | 17 | $result = $self->_parse_html_string( $str, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | $self->_html_options($opts) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | 17 | my $err = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | 17 | $self->{_State_} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | 17 | ▶ | if ($err) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | 0 | ▶ | chomp $err unless ref $err; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | 0 | $self->_cleanup_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | 0 | croak $err; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | 17 | $self->_cleanup_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | 17 | return $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | 6 | ▶ | sub parse_html_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_html_file: called CC=5 SCAR=17.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | 6 | my ($self,$file,$opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | 6 | ▶ | croak("parse_html_file is not a class method! Create a parser object with XML::LibXML->new first!") unless ref $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | 6 | ▶ | croak("parse already in progress") if $self->{_State_}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | 6 | $self->{_State_} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | 6 | my $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | 6 | $self->_init_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | 6 | eval { $result = $self->_parse_html_file($file, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | $self->_html_options($opts) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | ); }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | 6 | my $err = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | 6 | $self->{_State_} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | 6 | ▶ | if ($err) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | 0 | ▶ | chomp $err unless ref $err; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | 0 | $self->_cleanup_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | 0 | croak $err; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | 6 | $self->_cleanup_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | 6 | return $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | 4 | ▶ | sub parse_html_fh { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_html_fh: called CC=5 SCAR=17.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | 4 | my ($self,$fh,$opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | 4 | ▶ | croak("parse_html_fh is not a class method! Create a parser object with XML::LibXML->new first!") unless ref $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | 4 | ▶ | croak("parse already in progress") if $self->{_State_}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | 4 | $self->{_State_} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | 4 | my $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | 4 | $self->_init_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | 4 | eval { $result = $self->_parse_html_fh( $fh, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | $self->_html_options($opts) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | ); }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | 4 | my $err = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | 4 | $self->{_State_} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | 4 | ▶ | if ($err) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | 0 | ▶ | chomp $err unless ref $err; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | 0 | $self->_cleanup_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | 0 | croak $err; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | 4 | $self->_cleanup_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | 4 | return $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | # push parser interface # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | 77 | ▶ | sub init_push { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_push: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | 77 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | 77 | ▶ | if ( defined $self->{CONTEXT} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | 1 | delete $self->{CONTEXT}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | 77 | ▶ | if ( defined $self->{SAX} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | 36 | $self->{CONTEXT} = $self->_start_push(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | 41 | $self->{CONTEXT} = $self->_start_push(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | 140 | ▶ | sub push { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
push: called CC=5 SCAR=17.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | 140 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | 140 | $self->_init_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | 140 | ▶ | if ( not defined $self->{CONTEXT} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | 36 | $self->init_push(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | 140 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | 140 | foreach ( @_ ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | 140 | $self->_push( $self->{CONTEXT}, $_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | 140 | my $err = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | 140 | $self->_cleanup_callbacks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | 140 | ▶ | if ( $err ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | 0 | ▶ | chomp $err unless ref $err; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | 0 | croak $err; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | # this function should be promoted! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | # the reason is because libxml2 uses xmlParseChunk() for this purpose! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | 200 | ▶ | sub parse_chunk { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_chunk: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | 200 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | 200 | my $chunk = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | 200 | my $terminate = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | 200 | ▶ | if ( not defined $self->{CONTEXT} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | 40 | $self->init_push(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | 200 | ▶ | if ( defined $chunk and length $chunk ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $chunk and length $chunk
MC/DC50%1/2
defined $chunk and length $chunk
defined $chunk
length $chunk
Truth table66%2/3
A and B
A= defined $chunkB= length $chunk
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | 161 | $self->_push( $self->{CONTEXT}, $chunk ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | 192 | ▶ | if ( $terminate ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1235 | 39 | return $self->finish_push(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1240 | 76 | ▶ | sub finish_push { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
finish_push: called CC=6 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | 76 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | 76 | ▶ | my $restore = shift || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
shift() || 0
MC/DC100%1/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | 76 | ▶ | return undef unless defined $self->{CONTEXT}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1245 | 76 | my $retval; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | 76 | ▶ | if ( defined $self->{SAX} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | 36 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | 36 | $self->_end_sax_push( $self->{CONTEXT} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | 36 | $retval = $self->{HANDLER}->end_document( {} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1254 | 40 | eval { $retval = $self->_end_push( $self->{CONTEXT}, $restore ); }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | 76 | my $err = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | 76 | delete $self->{CONTEXT}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | 76 | ▶ | if ( $err ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1259 | 1 | ▶ | chomp $err unless ref $err; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1260 | 1 | croak( $err ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1261 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1262 | 75 | return $retval; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1263 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | 77 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | # XML::LibXML::Node Interface # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | package XML::LibXML::Node; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1271 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1272 | 77 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1274 | use overload | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1275 | 2 | ▶ | '""' => sub { $_[0]->toString() }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1276 | 521 | ▶ | 'bool' => sub { 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1277 | 19281 | ▶ | '0+' => sub { Scalar::Util::refaddr($_[0]) }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1278 | 77 | fallback => 1, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1279 | 77 | ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1281 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1282 | 0 | ▶ | sub CLONE_SKIP { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CLONE_SKIP: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1283 | 0 | ▶ | return $XML::LibXML::__threads_shared ? 0 : 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1284 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1285 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1286 | 0 | ▶ | sub isSupported { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
isSupported: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1287 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1288 | 0 | my $feature = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1289 | 0 | ▶ | return $self->can($feature) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1290 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1292 | 0 | ▶ | sub getChildNodes { my $self = shift; return $self->childNodes(); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getChildNodes: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1294 | 158 | ▶ | sub childNodes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
childNodes: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1295 | 158 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1296 | 158 | my @children = $self->_childNodes(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1297 | 158 | ▶ | return wantarray ? @children : XML::LibXML::NodeList->new_from_ref(\@children , 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1300 | 2 | ▶ | sub nonBlankChildNodes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nonBlankChildNodes: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1301 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1302 | 2 | my @children = $self->_childNodes(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1303 | 2 | ▶ | return wantarray ? @children : XML::LibXML::NodeList->new_from_ref(\@children , 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1304 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1306 | 51 | ▶ | sub attributes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
attributes: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1307 | 51 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1308 | 51 | my @attr = $self->_attributes(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1309 | 51 | ▶ | return wantarray ? @attr : XML::LibXML::NamedNodeMap->new( @attr ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1310 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1311 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1312 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1313 | 68 | ▶ | sub findnodes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
findnodes: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1314 | 68 | my ($node, $xpath) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1315 | 68 | my @nodes = $node->_findnodes($xpath); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1316 | 60 | ▶ | if (wantarray) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1317 | 44 | return @nodes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1318 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1319 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1320 | 16 | return XML::LibXML::NodeList->new_from_ref(\@nodes, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1321 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1322 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1324 | 8 | ▶ | sub exists { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exists: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1325 | 8 | my ($node, $xpath) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1326 | 8 | my (undef, $value) = $node->_find($xpath,1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1327 | 8 | return $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1328 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1330 | 29 | ▶ | sub findvalue { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
findvalue: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1331 | 29 | my ($node, $xpath) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1332 | 29 | my $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1333 | 29 | $res = $node->find($xpath); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1334 | 25 | return $res->to_literal->value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1335 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1337 | 0 | ▶ | sub findbool { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
findbool: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1338 | 0 | my ($node, $xpath) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1339 | 0 | my ($type, @params) = $node->_find($xpath,1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1340 | 0 | ▶ | if ($type) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1341 | 0 | return $type->new(@params); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1342 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1343 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1344 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1346 | 55 | ▶ | sub find { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find: called CC=2 SCAR=7.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1347 | 55 | my ($node, $xpath) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1348 | 55 | my ($type, @params) = $node->_find($xpath,0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1349 | 43 | ▶ | if ($type) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1350 | 43 | return $type->new(@params); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1351 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1352 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1353 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1354 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1355 | 1 | ▶ | sub setOwnerDocument { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setOwnerDocument: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1356 | 1 | my ( $self, $doc ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1357 | 1 | $doc->adoptNode( $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1358 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1360 | 14 | ▶ | sub toStringC14N { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
toStringC14N: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1361 | 14 | my ($self, $comments, $xpath, $xpc) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1362 | 14 | ▶ | return $self->_toStringC14N( $comments || 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%2/2
$comments || 0
MC/DC100%1/1
$comments || 0
$comments
Truth table100%2/2
A
A= $comments
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1363 | (defined $xpath ? $xpath : undef), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1364 | 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1365 | undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1366 | (defined $xpc ? $xpc : undef) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1367 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1368 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1369 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1370 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1371 | 77 | my $C14N_version_1_dot_1_val = 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1372 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1373 | 0 | ▶ | sub toStringC14N_v1_1 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
toStringC14N_v1_1: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1374 | 0 | my ($self, $comments, $xpath, $xpc) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1375 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1376 | 0 | ▶ | return $self->_toStringC14N( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/2
$comments || 0
MC/DC0%0/1
$comments || 0
$comments
Truth table0%0/2
A
A= $comments
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1377 | $comments || 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1378 | (defined $xpath ? $xpath : undef), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1379 | $C14N_version_1_dot_1_val, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1380 | undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1381 | (defined $xpc ? $xpc : undef) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1382 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1383 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1384 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1385 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1386 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1387 | 77 | ▶ | sub toStringEC14N { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
toStringEC14N: called CC=9 SCAR=22.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1388 | 10 | my ($self, $comments, $xpath, $xpc, $inc_prefix_list) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1389 | 10 | ▶ | unless (UNIVERSAL::isa($xpc,'XML::LibXML::XPathContext')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1390 | 8 | ▶ | if ($inc_prefix_list) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1391 | 0 | croak("toStringEC14N: 3rd argument is not an XML::LibXML::XPathContext"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1392 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1393 | 8 | $inc_prefix_list=$xpc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1394 | 8 | $xpc=undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1395 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1396 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1397 | 10 | ▶ | if (defined($inc_prefix_list) and !UNIVERSAL::isa($inc_prefix_list,'ARRAY')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $inc_prefix_list and not UNIVERSAL::isa($inc_prefix_list, "ARRAY")
MC/DC0%0/2
defined $inc_prefix_list and not UNIVERSAL::isa($inc_prefix_list, "ARRAY")
defined $inc_prefix_list
not UNIVERSAL::isa($inc_prefix_list, "ARRAY")
Truth table66%2/3
A and not(B)
A= defined $inc_prefix_listB= not UNIVERSAL::isa($inc_prefix_list, "ARRAY")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1398 | 0 | croak("toStringEC14N: inclusive_prefix_list must be undefined or ARRAY"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1399 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1400 | 10 | ▶ | return $self->_toStringC14N( $comments || 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition50%1/2
$comments || 0
MC/DC0%0/1
$comments || 0
$comments
Truth table50%1/2
A
A= $comments
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1401 | (defined $xpath ? $xpath : undef), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1402 | 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1403 | (defined $inc_prefix_list ? $inc_prefix_list : undef), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1404 | (defined $xpc ? $xpc : undef) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1405 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1406 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1407 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1408 | 77 | *serialize_c14n = \&toStringC14N; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1409 | 77 | *serialize_exc_c14n = \&toStringEC14N; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1410 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1411 | 77 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1412 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1413 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1414 | # XML::LibXML::Document Interface # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1415 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1416 | package XML::LibXML::Document; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1417 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1418 | 77 | our @ISA = ('XML::LibXML::Node'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1419 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1420 | 3 | ▶ | sub actualEncoding { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
actualEncoding: called CC=3 SCAR=12.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1421 | 3 | my $doc = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1422 | 3 | my $enc = $doc->encoding; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1423 | 3 | ▶ | return (defined $enc and length $enc) ? $enc : 'UTF-8'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $enc and length $enc
MC/DC0%0/2
defined $enc and length $enc
defined $enc
length $enc
Truth table33%1/3
A and B
A= defined $encB= length $enc
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1424 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1425 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1426 | 97 | ▶ | sub setDocumentElement { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setDocumentElement: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1427 | 97 | my $doc = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1428 | 97 | my $element = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1429 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1430 | 97 | my $oldelem = $doc->documentElement; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1431 | 97 | ▶ | if ( defined $oldelem ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1432 | 2 | $doc->removeChild($oldelem); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1433 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1434 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1435 | 97 | $doc->_setDocumentElement($element); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1436 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1437 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1438 | 39 | ▶ | sub toString { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
toString: called CC=8 SCAR=21.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1439 | 39 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1440 | 39 | my $flag = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1441 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1442 | 39 | my $retval = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1443 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1444 | 39 | ▶ | if ( defined $XML::LibXML::skipXMLDeclaration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $XML::LibXML::skipXMLDeclaration and $XML::LibXML::skipXMLDeclaration == 1
MC/DC50%1/2
defined $XML::LibXML::skipXMLDeclaration and $XML::LibXML::skipXMLDeclaration == 1
defined $XML::LibXML::skipXMLDeclaration
$XML::LibXML::skipXMLDeclaration == 1
Truth table66%2/3
A and B
A= defined $XML::LibXML::skipXMLDeclarationB= $XML::LibXML::skipXMLDeclaration == 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1445 | and $XML::LibXML::skipXMLDeclaration == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1446 | 4 | foreach ( $self->childNodes ){ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1447 | 4 | ▶ | next if $_->nodeType == XML::LibXML::XML_DTD_NODE() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$_->nodeType == 14 and $XML::LibXML::skipDTD
MC/DC0%0/2
$_->nodeType == 14 and $XML::LibXML::skipDTD
$_->nodeType == 14
$XML::LibXML::skipDTD
Truth table33%1/3
A and B
A= $_->nodeType == 14B= $XML::LibXML::skipDTD
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1448 | and $XML::LibXML::skipDTD; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1449 | 4 | $retval .= $_->toString; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1450 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1451 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1452 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1453 | 35 | ▶ | $flag ||= 0 unless defined $flag; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$flag ||= 0
MC/DC0%0/1
$flag ||= 0
$flag
Truth table50%1/2
A
A= $flag
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1454 | 35 | $retval = $self->_toString($flag); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1455 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1457 | 39 | return $retval; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1458 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1459 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1460 | 0 | ▶ | sub serialize { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
serialize: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1461 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1462 | 0 | return $self->toString( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1463 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1464 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1465 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1466 | # bad style xinclude processing # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1467 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1468 | 2 | ▶ | sub process_xinclude { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
process_xinclude: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1469 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1470 | 2 | my $opts = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1471 | 2 | XML::LibXML->new->processXIncludes( $self, $opts ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1472 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1473 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1474 | 0 | ▶ | sub insertProcessingInstruction { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
insertProcessingInstruction: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1475 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1476 | 0 | my $target = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1477 | 0 | my $data = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1478 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1479 | 0 | my $pi = $self->createPI( $target, $data ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1480 | 0 | my $root = $self->documentElement; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1481 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1482 | 0 | ▶ | if ( defined $root ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1483 | # this is actually not correct, but i guess it's what the user | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1484 | # intends | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1485 | 0 | $self->insertBefore( $pi, $root ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1486 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1487 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1488 | # if no documentElement was found we just append the PI | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1489 | 0 | $self->appendChild( $pi ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1490 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1491 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1492 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1493 | 0 | ▶ | sub insertPI { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
insertPI: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1494 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1495 | 0 | $self->insertProcessingInstruction( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1496 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1497 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1498 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1499 | # DOM L3 Document functions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1500 | # added after robins implicit feature request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1501 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1502 | 77 | *getElementsByTagName = \&XML::LibXML::Element::getElementsByTagName; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1503 | 77 | *getElementsByTagNameNS = \&XML::LibXML::Element::getElementsByTagNameNS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1504 | 77 | *getElementsByLocalName = \&XML::LibXML::Element::getElementsByLocalName; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1505 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1506 | 77 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1507 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1508 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1509 | # XML::LibXML::DocumentFragment Interface # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1510 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1511 | package XML::LibXML::DocumentFragment; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1512 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1513 | 77 | our @ISA = ('XML::LibXML::Node'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1514 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1515 | 58 | ▶ | sub toString { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
toString: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1516 | 58 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1517 | 58 | my $retval = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1518 | 58 | ▶ | if ( $self->hasChildNodes() ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1519 | 58 | foreach my $n ( $self->childNodes() ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1520 | 104 | $retval .= $n->toString(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1521 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1522 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1523 | 58 | return $retval; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1524 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1525 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1526 | 77 | *serialize = \&toString; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1527 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1528 | 77 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1529 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1530 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1531 | # XML::LibXML::Element Interface # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1532 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1533 | package XML::LibXML::Element; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1534 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1535 | 77 | our @ISA = ('XML::LibXML::Node'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1536 | 77 | ▶ | use XML::LibXML qw(:ns :libxml); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1537 | 77 | ▶ | use XML::LibXML::AttributeHash; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1538 | 77 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1539 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1540 | 77 | ▶ | use Scalar::Util qw(blessed); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1541 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1542 | use overload | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1543 | 77 | ▶ | '%{}' => 'getAttributeHash', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1544 | 'eq' => '_isSameNodeLax', '==' => '_isSameNodeLax', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1545 | 'ne' => '_isNotSameNodeLax', '!=' => '_isNotSameNodeLax', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1546 | fallback => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1547 | 77 | ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1548 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1549 | 4 | ▶ | sub _isNotSameNodeLax { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_isNotSameNodeLax: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1550 | 4 | my ($self, $other) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1551 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1552 | 4 | ▶ | return ((not $self->_isSameNodeLax($other)) ? 1 : ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1553 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1554 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1555 | 13 | ▶ | sub _isSameNodeLax { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_isSameNodeLax: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1556 | 13 | my ($self, $other) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1557 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1558 | 13 | ▶ | if (blessed($other) and $other->isa('XML::LibXML::Element')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($other) and $other->isa("XML::LibXML::Element")
MC/DC50%1/2
builtin::blessed($other) and $other->isa("XML::LibXML::Element")
builtin::blessed($other)
$other->isa("XML::LibXML::Element")
Truth table66%2/3
A and B
A= builtin::blessed($other)B= $other->isa("XML::LibXML::Element")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1559 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1560 | 8 | ▶ | return ($self->isSameNode($other) ? 1 : ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1561 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1562 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1563 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1564 | 5 | return ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1565 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1566 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1567 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1568 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1569 | 77 | my %tiecache; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1570 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1571 | sub __destroy_tiecache | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1572 | 19221 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__destroy_tiecache: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1573 | 19221 | delete $tiecache{ 0+$_[0] }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1574 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1575 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1576 | sub getAttributeHash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1577 | 24 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getAttributeHash: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1578 | 24 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1579 | 24 | ▶ | if (!exists $tiecache{ 0+$self }) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1580 | 5 | tie my %attr, 'XML::LibXML::AttributeHash', $self, weaken => 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1581 | 5 | $tiecache{ 0+$self } = \%attr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1582 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1583 | 24 | return $tiecache{ 0+$self }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1584 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1585 | sub DESTROY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1586 | 19221 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1587 | 19221 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1588 | 19221 | $self->__destroy_tiecache; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1589 | 19221 | $self->SUPER::DESTROY; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1590 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1591 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1592 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1593 | 77 | ▶ | sub setNamespace { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setNamespace: called CC=4 SCAR=14.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1594 | 33 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1595 | 33 | my $n = $self->localname; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1596 | 33 | ▶ | if ( $self->_setNamespace(@_) ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1597 | 33 | ▶ | if ( scalar @_ < 3 || $_[2] == 1 ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
scalar @_ < 3 or $_[2] == 1
MC/DC100%2/2
scalar @_ < 3 or $_[2] == 1
scalar @_ < 3
$_[2] == 1
Truth table100%3/3
A or B
A= scalar @_ < 3B= $_[2] == 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1598 | 5 | $self->setNodeName( $n ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1599 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1600 | 33 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1601 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1602 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1603 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1604 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1605 | 67 | ▶ | sub getAttribute { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getAttribute: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1606 | 67 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1607 | 67 | my $name = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1608 | 67 | ▶ | if ( $name =~ /^xmlns(?::|$)/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1609 | # user wants to get a namespace ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1610 | 21 | (my $prefix = $name )=~s/^xmlns:?//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1611 | 21 | $self->_getNamespaceDeclURI($prefix); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1612 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1613 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1614 | 46 | $self->_getAttribute(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1615 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1616 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1617 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1618 | 38 | ▶ | sub setAttribute { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setAttribute: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1619 | 38 | my ( $self, $name, $value ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1620 | 38 | ▶ | if ( $name =~ /^xmlns(?::|$)/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1621 | # user wants to set the special attribute for declaring XML namespace ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1622 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1623 | # this is fine but not exactly DOM conformant behavior, btw (according to DOM we should | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1624 | # probably declare an attribute which looks like XML namespace declaration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1625 | # but isn't) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1626 | 10 | (my $nsprefix = $name )=~s/^xmlns:?//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1627 | 10 | my $nn = $self->nodeName; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1628 | 10 | ▶ | if ( $nn =~ /^\Q${nsprefix}\E:/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1629 | # the element has the same prefix | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1630 | 1 | ▶ | $self->setNamespaceDeclURI($nsprefix,$value) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1631 | $self->setNamespace($value,$nsprefix,1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1632 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1633 | ## We set the namespace here. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1634 | ## This is helpful, as in: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1635 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1636 | ## | $e = XML::LibXML::Element->new('foo:bar'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1637 | ## | $e->setAttribute('xmlns:foo','http://yoyodine') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1638 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1639 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1640 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1641 | # just modify the namespace | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1642 | 9 | ▶ | $self->setNamespaceDeclURI($nsprefix, $value) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1643 | $self->setNamespace($value,$nsprefix,0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1644 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1645 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1646 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1647 | 28 | $self->_setAttribute($name, $value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1648 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1649 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1650 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1651 | 24 | ▶ | sub getAttributeNS { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getAttributeNS: called CC=6 SCAR=18.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1652 | 24 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1653 | 24 | my ($nsURI, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1654 | 24 | ▶ | croak("invalid attribute name") if !defined($name) or $name eq q{}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $name or $name eq ""
MC/DC0%0/2
not defined $name or $name eq ""
not defined $name
$name eq ""
Truth table33%1/3
not(A) or B
A= not defined $nameB= $name eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1655 | 24 | ▶ | if ( defined($nsURI) and $nsURI eq XML_XMLNS_NS ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $nsURI and $nsURI eq "http://www.w3.org/2000/xmlns/"
MC/DC100%2/2
defined $nsURI and $nsURI eq "http://www.w3.org/2000/xmlns/"
defined $nsURI
$nsURI eq "http://www.w3.org/2000/xmlns/"
Truth table100%3/3
A and B
A= defined $nsURIB= $nsURI eq "http://www.w3.org/2000/xmlns/"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1656 | 1 | ▶ | $self->_getNamespaceDeclURI($name eq 'xmlns' ? undef : $name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1657 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1658 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1659 | 23 | $self->_getAttributeNS(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1660 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1661 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1662 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1663 | 50 | ▶ | sub setAttributeNS { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setAttributeNS: called CC=14 SCAR=29.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1664 | 50 | my ($self, $nsURI, $qname, $value)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1665 | 50 | ▶ | unless (defined $qname and length $qname) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $qname and length $qname
MC/DC0%0/2
defined $qname and length $qname
defined $qname
length $qname
Truth table33%1/3
A and B
A= defined $qnameB= length $qname
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1666 | 0 | croak("bad name"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1667 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1668 | 50 | ▶ | if (defined($nsURI) and $nsURI eq XML_XMLNS_NS) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $nsURI and $nsURI eq "http://www.w3.org/2000/xmlns/"
MC/DC100%2/2
defined $nsURI and $nsURI eq "http://www.w3.org/2000/xmlns/"
defined $nsURI
$nsURI eq "http://www.w3.org/2000/xmlns/"
Truth table100%3/3
A and B
A= defined $nsURIB= $nsURI eq "http://www.w3.org/2000/xmlns/"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1669 | 1 | ▶ | if ($qname !~ /^xmlns(?::|$)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1670 | 0 | croak("NAMESPACE ERROR: Namespace declarations must have the prefix 'xmlns'"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1671 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1672 | 1 | $self->setAttribute($qname,$value); # see implementation above | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1673 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1674 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1675 | 49 | ▶ | if ($qname=~/:/ and not (defined($nsURI) and length($nsURI))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$qname =~ /:/ and not defined $nsURI && length $nsURI
defined $nsURI && length $nsURI
MC/DC66%2/3
$qname =~ /:/ and not defined $nsURI && length $nsURI
$qname =~ /:/
defined $nsURI
length $nsURI
Truth table75%3/4
A and not(B && C)
A= $qname =~ /:/B= defined $nsURIC= length $nsURI
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1676 | 1 | croak("NAMESPACE ERROR: Attribute without a prefix cannot be in a namespace"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1677 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1678 | 48 | ▶ | if ($qname=~/^xmlns(?:$|:)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1679 | 0 | croak("NAMESPACE ERROR: 'xmlns' prefix and qualified-name are reserved for the namespace ".XML_XMLNS_NS); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1680 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1681 | 48 | ▶ | if ($qname=~/^xml:/ and not (defined $nsURI and $nsURI eq XML_XML_NS)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$qname =~ /^xml:/ and not defined $nsURI && $nsURI eq "http://www.w3.org/XML/1998/namespace"
defined $nsURI && $nsURI eq 'http://www.w3.org/XML/1998/namespace'
MC/DC0%0/3
$qname =~ /^xml:/ and not defined $nsURI && $nsURI eq "http://www.w3.org/XML/1998/namespace"
$qname =~ /^xml:/
defined $nsURI
$nsURI eq 'http://www.w3.org/XML/1998/namespace'
Truth table50%2/4
A and not(B && C)
A= $qname =~ /^xml:/B= defined $nsURIC= $nsURI eq 'http://www.w3.org/XML/1998/namespace'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1682 | 0 | croak("NAMESPACE ERROR: 'xml' prefix is reserved for the namespace ".XML_XML_NS); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1683 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1684 | 48 | ▶ | $self->_setAttributeNS( defined $nsURI ? $nsURI : undef, $qname, $value ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1685 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1686 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1687 | 10 | ▶ | sub getElementsByTagName { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getElementsByTagName: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1688 | 10 | my ( $node , $name ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1689 | 10 | ▶ | my $xpath = $name eq '*' ? "descendant::*" : "descendant::*[name()='$name']"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1690 | 10 | my @nodes = $node->_findnodes($xpath); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1691 | 10 | ▶ | return wantarray ? @nodes : XML::LibXML::NodeList->new_from_ref(\@nodes, 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1692 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1693 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1694 | 13 | ▶ | sub getElementsByTagNameNS { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getElementsByTagNameNS: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1695 | 13 | my ( $node, $nsURI, $name ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1696 | 13 | my $xpath; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1697 | 13 | ▶ | if ( $name eq '*' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1698 | 6 | ▶ | if ( $nsURI eq '*' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1699 | 3 | $xpath = "descendant::*"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1700 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1701 | 3 | $xpath = "descendant::*[namespace-uri()='$nsURI']"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1702 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1703 | } elsif ( $nsURI eq '*' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1704 | 5 | $xpath = "descendant::*[local-name()='$name']"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1705 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1706 | 2 | $xpath = "descendant::*[local-name()='$name' and namespace-uri()='$nsURI']"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1707 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1708 | 13 | my @nodes = $node->_findnodes($xpath); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1709 | 13 | ▶ | return wantarray ? @nodes : XML::LibXML::NodeList->new_from_ref(\@nodes, 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1710 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1711 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1712 | 4 | ▶ | sub getElementsByLocalName { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getElementsByLocalName: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1713 | 4 | my ( $node,$name ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1714 | 4 | my $xpath; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1715 | 4 | ▶ | if ($name eq '*') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1716 | 1 | $xpath = "descendant::*"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1717 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1718 | 3 | $xpath = "descendant::*[local-name()='$name']"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1719 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1720 | 4 | my @nodes = $node->_findnodes($xpath); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1721 | 4 | ▶ | return wantarray ? @nodes : XML::LibXML::NodeList->new_from_ref(\@nodes, 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1722 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1723 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1724 | 12 | ▶ | sub getChildrenByTagName { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getChildrenByTagName: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1725 | 12 | my ( $node, $name ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1726 | 12 | my @nodes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1727 | 12 | ▶ | if ($name eq '*') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1728 | 3 | @nodes = grep { $_->nodeType == XML_ELEMENT_NODE() } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1729 | $node->childNodes(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1730 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1731 | 9 | @nodes = grep { $_->nodeName eq $name } $node->childNodes(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1732 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1733 | 12 | ▶ | return wantarray ? @nodes : XML::LibXML::NodeList->new_from_ref(\@nodes, 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1734 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1735 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1736 | 3 | ▶ | sub getChildrenByLocalName { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getChildrenByLocalName: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1737 | 3 | my ( $node, $name ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1738 | # my @nodes; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1739 | # if ($name eq '*') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1740 | # @nodes = grep { $_->nodeType == XML_ELEMENT_NODE() } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1741 | # $node->childNodes(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1742 | # } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1743 | # @nodes = grep { $_->nodeType == XML_ELEMENT_NODE() and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1744 | # $_->localName eq $name } $node->childNodes(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1745 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1746 | # return wantarray ? @nodes : XML::LibXML::NodeList->new_from_ref(\@nodes, 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1747 | 3 | my @nodes = $node->_getChildrenByTagNameNS('*',$name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1748 | 3 | ▶ | return wantarray ? @nodes : XML::LibXML::NodeList->new_from_ref(\@nodes, 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1749 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1750 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1751 | 9 | ▶ | sub getChildrenByTagNameNS { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getChildrenByTagNameNS: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1752 | 9 | my ( $node, $nsURI, $name ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1753 | 9 | my @nodes = $node->_getChildrenByTagNameNS($nsURI,$name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1754 | 9 | ▶ | return wantarray ? @nodes : XML::LibXML::NodeList->new_from_ref(\@nodes, 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1755 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1756 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1757 | 1 | ▶ | sub appendWellBalancedChunk { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
appendWellBalancedChunk: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1758 | 1 | my ( $self, $chunk ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1759 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1760 | 1 | my $local_parser = XML::LibXML->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1761 | 1 | my $frag = $local_parser->parse_xml_chunk( $chunk ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1762 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1763 | 1 | $self->appendChild( $frag ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1764 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1765 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1766 | 77 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1767 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1768 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1769 | # XML::LibXML::Text Interface # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1770 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1771 | package XML::LibXML::Text; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1772 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1773 | 77 | our @ISA = ('XML::LibXML::Node'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1774 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1775 | 1 | ▶ | sub attributes { return; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
attributes: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1776 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1777 | 5 | ▶ | sub deleteDataString { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
deleteDataString: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1778 | 5 | my ($node, $string, $all) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1779 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1780 | 5 | return $node->replaceDataString($string, '', $all); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1781 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1782 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1783 | 9 | ▶ | sub replaceDataString { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
replaceDataString: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1784 | 9 | my ( $node, $left_proto, $right,$all ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1785 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1786 | # Assure we exchange the strings and not expressions! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1787 | 9 | my $left = quotemeta($left_proto); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1788 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1789 | 9 | my $datastr = $node->nodeValue(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1790 | 9 | ▶ | if ( $all ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1791 | 3 | $datastr =~ s/$left/$right/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1792 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1793 | else{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1794 | 6 | $datastr =~ s/$left/$right/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1795 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1796 | 9 | $node->setData( $datastr ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1797 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1798 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1799 | 6 | ▶ | sub replaceDataRegEx { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
replaceDataRegEx: called CC=4 SCAR=14.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1800 | 6 | my ( $node, $leftre, $rightre, $flags ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1801 | 6 | ▶ | return unless defined $leftre; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1802 | 6 | ▶ | $rightre ||= ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$rightre ||= ""
MC/DC0%0/1
$rightre ||= ""
$rightre
Truth table50%1/2
A
A= $rightre
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1803 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1804 | 6 | my $datastr = $node->nodeValue(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1805 | 6 | my $restr = "s/" . $leftre . "/" . $rightre . "/"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1806 | 6 | ▶ | $restr .= $flags if defined $flags; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1807 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1808 | 6 | eval '$datastr =~ '. $restr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1809 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1810 | 6 | $node->setData( $datastr ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1811 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1812 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1813 | 77 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1814 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1815 | package XML::LibXML::Comment; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1816 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1817 | 77 | our @ISA = ('XML::LibXML::Text'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1818 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1819 | 77 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1820 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1821 | package XML::LibXML::CDATASection; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1822 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1823 | 77 | our @ISA = ('XML::LibXML::Text'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1824 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1825 | 77 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1826 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1827 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1828 | # XML::LibXML::Attribute Interface # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1829 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1830 | package XML::LibXML::Attr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1831 | 77 | our @ISA = ('XML::LibXML::Node') ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1832 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1833 | 2 | ▶ | sub setNamespace { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setNamespace: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1834 | 2 | my ($self,$href,$prefix) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1835 | 2 | my $n = $self->localname; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1836 | 2 | ▶ | if ( $self->_setNamespace($href,$prefix) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1837 | 2 | $self->setNodeName($n); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1838 | 2 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1839 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1840 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1841 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1842 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1843 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1844 | 77 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1845 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1846 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1847 | # XML::LibXML::Dtd Interface # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1848 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1849 | # this is still under construction | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1850 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1851 | package XML::LibXML::Dtd; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1852 | 77 | our @ISA = ('XML::LibXML::Node'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1853 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1854 | # at least DESTROY and CLONE_SKIP must be inherited | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1855 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1856 | 77 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1857 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1858 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1859 | # XML::LibXML::PI Interface # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1860 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1861 | package XML::LibXML::PI; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1862 | 77 | our @ISA = ('XML::LibXML::Node'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1863 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1864 | 3 | ▶ | sub setData { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setData: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1865 | 3 | my $pi = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1866 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1867 | 3 | my $string = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1868 | 3 | ▶ | if ( scalar @_ == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1869 | 2 | $string = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1870 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1871 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1872 | 1 | my %h = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1873 | 1 | $string = join " ", map {$_.'="'.$h{$_}.'"'} keys %h; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1874 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1875 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1876 | # the spec says any char but "?>" [17] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1877 | 3 | ▶ | $pi->_setData( $string ) unless $string =~ /\?>/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1878 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1879 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1880 | 77 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1881 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1882 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1883 | # XML::LibXML::Namespace Interface # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1884 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1885 | package XML::LibXML::Namespace; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1886 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1887 | 0 | ▶ | sub CLONE_SKIP { 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CLONE_SKIP: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1888 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1889 | # In fact, this is not a node! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1890 | 0 | ▶ | sub prefix { return "xmlns"; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prefix: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1891 | 0 | ▶ | sub getPrefix { return "xmlns"; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getPrefix: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1892 | 0 | ▶ | sub getNamespaceURI { return "http://www.w3.org/2000/xmlns/" }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getNamespaceURI: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1893 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1894 | 0 | ▶ | sub getNamespaces { return (); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getNamespaces: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1895 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1896 | 4 | ▶ | sub nodeName { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nodeName: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1897 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1898 | 4 | my $nsP = $self->localname; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1899 | 4 | ▶ | return ( defined($nsP) && length($nsP) ) ? "xmlns:$nsP" : "xmlns"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $nsP and length $nsP
MC/DC50%1/2
defined $nsP and length $nsP
defined $nsP
length $nsP
Truth table66%2/3
A and B
A= defined $nsPB= length $nsP
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1900 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1901 | 4 | ▶ | sub name { goto &nodeName } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
name: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1902 | 0 | ▶ | sub getName { goto &nodeName } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getName: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1903 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1904 | 0 | ▶ | sub isEqualNode { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
isEqualNode: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1905 | 0 | my ( $self, $ref ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1906 | 0 | ▶ | if ( ref($ref) eq "XML::LibXML::Namespace" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1907 | 0 | return $self->_isEqual($ref); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1908 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1909 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1910 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1911 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1912 | 0 | ▶ | sub isSameNode { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
isSameNode: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1913 | 0 | my ( $self, $ref ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1914 | 0 | ▶ | if ( $$self == $$ref ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1915 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1916 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1917 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1918 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1919 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1920 | 77 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1921 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1922 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1923 | # XML::LibXML::NamedNodeMap Interface # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1924 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1925 | package XML::LibXML::NamedNodeMap; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1926 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1927 | 77 | ▶ | use XML::LibXML qw(:libxml); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1928 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1929 | 0 | ▶ | sub CLONE_SKIP { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CLONE_SKIP: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1930 | 0 | ▶ | return $XML::LibXML::__threads_shared ? 0 : 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1931 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1932 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1933 | 2 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1934 | 2 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1935 | 2 | my $self = bless { Nodes => [@_] }, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1936 | 2 | $self->{NodeMap} = { map { $_->nodeName => $_ } @_ }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1937 | 2 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1938 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1939 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1940 | 2 | ▶ | sub length { return scalar( @{$_[0]->{Nodes}} ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
length: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1941 | 0 | ▶ | sub nodes { return $_[0]->{Nodes}; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nodes: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1942 | 0 | ▶ | sub item { $_[0]->{Nodes}->[$_[1]]; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
item: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1943 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1944 | 1 | ▶ | sub getNamedItem { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getNamedItem: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1945 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1946 | 1 | my $name = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1947 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1948 | 1 | return $self->{NodeMap}->{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1949 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1950 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1951 | 3 | ▶ | sub setNamedItem { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setNamedItem: called CC=6 SCAR=18.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1952 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1953 | 3 | my $node = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1954 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1955 | 3 | my $retval; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1956 | 3 | ▶ | if ( defined $node ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1957 | 3 | ▶ | if ( scalar @{$self->{Nodes}} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1958 | 3 | my $name = $node->nodeName(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1959 | 3 | ▶ | if ( $node->nodeType() == XML_NAMESPACE_DECL ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1960 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1961 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1962 | 3 | ▶ | if ( defined $self->{NodeMap}->{$name} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1963 | 1 | ▶ | if ( $node->isSameNode( $self->{NodeMap}->{$name} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1964 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1965 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1966 | 1 | $retval = $self->{NodeMap}->{$name}->replaceNode( $node ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1967 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1968 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1969 | 2 | $self->{Nodes}->[0]->addSibling($node); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1970 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1971 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1972 | 3 | $self->{NodeMap}->{$name} = $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1973 | 3 | push @{$self->{Nodes}}, $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1974 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1975 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1976 | # not done yet | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1977 | # can this be properly be done??? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1978 | 0 | warn "not done yet\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1979 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1980 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1981 | 3 | return $retval; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1982 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1983 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1984 | 1 | ▶ | sub removeNamedItem { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
removeNamedItem: called CC=3 SCAR=11.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1985 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1986 | 1 | my $name = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1987 | 1 | my $retval; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1988 | 1 | ▶ | if ( $name =~ /^xmlns/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1989 | 0 | warn "not done yet\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1990 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1991 | elsif ( exists $self->{NodeMap}->{$name} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1992 | 1 | $retval = $self->{NodeMap}->{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1993 | 1 | $retval->unbindNode; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1994 | 1 | delete $self->{NodeMap}->{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1995 | 1 | $self->{Nodes} = [grep {not($retval->isSameNode($_))} @{$self->{Nodes}}]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1996 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1997 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1998 | 1 | return $retval; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1999 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2000 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2001 | 0 | ▶ | sub getNamedItemNS { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getNamedItemNS: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2002 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2003 | 0 | my $nsURI = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2004 | 0 | my $name = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2005 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2006 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2007 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2008 | 0 | ▶ | sub setNamedItemNS { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setNamedItemNS: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2009 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2010 | 0 | my $nsURI = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2011 | 0 | my $node = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2012 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2013 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2014 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2015 | 0 | ▶ | sub removeNamedItemNS { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
removeNamedItemNS: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2016 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2017 | 0 | my $nsURI = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2018 | 0 | my $name = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2019 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2020 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2021 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2022 | 77 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2023 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2024 | package XML::LibXML::_SAXParser; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2025 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2026 | # this is pseudo class!!! and it will be removed as soon all functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2027 | # moved to XS level | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2028 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2029 | 77 | ▶ | use XML::SAX::Exception; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2030 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2031 | 0 | ▶ | sub CLONE_SKIP { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CLONE_SKIP: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2032 | 0 | ▶ | return $XML::LibXML::__threads_shared ? 0 : 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2033 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2034 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2035 | # these functions will use SAX exceptions as soon i know how things really work | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2036 | 0 | ▶ | sub warning { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
warning: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2037 | 0 | my ( $parser, $message, $line, $col ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2038 | 0 | my $error = XML::SAX::Exception::Parse->new( LineNumber => $line, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2039 | ColumnNumber => $col, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2040 | Message => $message, ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2041 | 0 | $parser->{HANDLER}->warning( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2042 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2043 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2044 | 0 | ▶ | sub error { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
error: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2045 | 0 | my ( $parser, $message, $line, $col ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2046 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2047 | 0 | my $error = XML::SAX::Exception::Parse->new( LineNumber => $line, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2048 | ColumnNumber => $col, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2049 | Message => $message, ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2050 | 0 | $parser->{HANDLER}->error( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2051 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2052 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2053 | 1 | ▶ | sub fatal_error { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fatal_error: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2054 | 1 | my ( $parser, $message, $line, $col ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2055 | 1 | my $error = XML::SAX::Exception::Parse->new( LineNumber => $line, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2056 | ColumnNumber => $col, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2057 | Message => $message, ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2058 | 1 | $parser->{HANDLER}->fatal_error( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2059 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2060 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2061 | 77 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2062 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2063 | package XML::LibXML::RelaxNG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2064 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2065 | 0 | ▶ | sub CLONE_SKIP { 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CLONE_SKIP: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2066 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2067 | 15 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2068 | 15 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2069 | 15 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2070 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2071 | 15 | my $self = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2072 | 15 | ▶ | if ( defined $args{location} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2073 | 6 | $self = $class->parse_location( $args{location}, XML::LibXML->_parser_options(\%args), $args{recover} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2074 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2075 | elsif ( defined $args{string} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2076 | 7 | $self = $class->parse_buffer( $args{string}, XML::LibXML->_parser_options(\%args), $args{recover} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2077 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2078 | elsif ( defined $args{DOM} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2079 | 2 | $self = $class->parse_document( $args{DOM}, XML::LibXML->_parser_options(\%args), $args{recover} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2080 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2081 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2082 | 8 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2083 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2084 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2085 | 77 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2086 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2087 | package XML::LibXML::Schema; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2088 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2089 | 0 | ▶ | sub CLONE_SKIP { 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CLONE_SKIP: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2090 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2091 | 13 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2092 | 13 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2093 | 13 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2094 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2095 | 13 | my $self = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2096 | 13 | ▶ | if ( defined $args{location} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2097 | 5 | $self = $class->parse_location( $args{location}, XML::LibXML->_parser_options(\%args), $args{recover} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2098 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2099 | elsif ( defined $args{string} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2100 | 8 | $self = $class->parse_buffer( $args{string}, XML::LibXML->_parser_options(\%args), $args{recover} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2103 | 7 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2106 | 77 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2108 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2109 | # XML::LibXML::Pattern Interface # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2110 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2112 | package XML::LibXML::Pattern; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2114 | 0 | ▶ | sub CLONE_SKIP { 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CLONE_SKIP: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2116 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2117 | 1 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2118 | 1 | my ($pattern,$ns_map)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2119 | 1 | my $self = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2121 | 1 | ▶ | unless (UNIVERSAL::can($class,'_compilePattern')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2122 | 0 | croak("Cannot create XML::LibXML::Pattern - ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2123 | "your libxml2 is compiled without pattern support!"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2124 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2126 | 1 | ▶ | if (ref($ns_map) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2127 | # translate prefix=>URL hash to a (URL,prefix) list | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2128 | 1 | $self = $class->_compilePattern($pattern,0,[reverse %$ns_map]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2129 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2130 | 0 | $self = $class->_compilePattern($pattern,0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2132 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2135 | 77 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2137 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2138 | # XML::LibXML::RegExp Interface # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2139 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2141 | package XML::LibXML::RegExp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2143 | 0 | ▶ | sub CLONE_SKIP { 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CLONE_SKIP: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2145 | 3 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2146 | 3 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2147 | 3 | my ($regexp)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2148 | 3 | ▶ | unless (UNIVERSAL::can($class,'_compile')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2149 | 0 | croak("Cannot create XML::LibXML::RegExp - ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2150 | "your libxml2 is compiled without regexp support!"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2151 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2152 | 3 | return $class->_compile($regexp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2155 | 77 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2157 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2158 | # XML::LibXML::XPathExpression Interface # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2159 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2161 | package XML::LibXML::XPathExpression; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2163 | 0 | ▶ | sub CLONE_SKIP { 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CLONE_SKIP: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2165 | 77 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2168 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2169 | # XML::LibXML::InputCallback Interface # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2170 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2171 | package XML::LibXML::InputCallback; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2173 | 77 | our ($_CUR_CB, @_GLOBAL_CALLBACKS, @_CB_STACK, $_CB_NESTED_DEPTH, @_CB_NESTED_STACK); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2175 | 77 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2176 | 77 | $_CUR_CB = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2177 | 77 | @_GLOBAL_CALLBACKS = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2178 | 77 | @_CB_STACK = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2179 | 77 | $_CB_NESTED_DEPTH = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2180 | 77 | @_CB_NESTED_STACK = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2181 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2183 | 0 | ▶ | sub CLONE_SKIP { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CLONE_SKIP: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2184 | 0 | ▶ | return $XML::LibXML::__threads_shared ? 0 : 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2185 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2187 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2188 | # global callbacks # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2189 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2190 | 120 | ▶ | sub _callback_match { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_callback_match: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2191 | 120 | my $uri = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2192 | 120 | my $retval = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2194 | # loop through the callbacks, and find the first matching one. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2195 | # The callbacks are stored in execution order (reverse stack order). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2196 | # Any new global callbacks are shifted to the callback stack. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2197 | 120 | foreach my $cb ( @_GLOBAL_CALLBACKS ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2199 | # callbacks have to return 1, 0 or undef, while 0 and undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2200 | # are handled the same way. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2201 | # in fact, if callbacks return other values, the global match | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2202 | # assumes silently that the callback failed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2204 | 37 | $retval = $cb->[0]->($uri); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2206 | 37 | ▶ | if ( defined $retval and $retval == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $retval and $retval == 1
MC/DC100%2/2
defined $retval and $retval == 1
defined $retval
$retval == 1
Truth table100%3/3
A and B
A= defined $retvalB= $retval == 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2207 | # make the other callbacks use this callback | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2208 | 25 | $_CUR_CB = $cb; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2209 | 25 | unshift @_CB_STACK, $cb; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2210 | 25 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2211 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2212 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2214 | 120 | return $retval; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2215 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2217 | 25 | ▶ | sub _callback_open { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_callback_open: called CC=4 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2218 | 25 | my $uri = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2219 | 25 | my $retval = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2221 | # the open callback has to return a defined value. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2222 | # if one works on files this can be a file handle. But | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2223 | # depending on the needs of the callback it also can be a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2224 | # database handle or a integer labeling a certain dataset. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2226 | 25 | ▶ | if ( defined $_CUR_CB ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2227 | 25 | $retval = $_CUR_CB->[1]->( $uri ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2229 | # reset the callbacks, if one callback cannot open an uri | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2230 | 25 | ▶ | if ( not defined $retval or $retval == 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $retval or $retval == 0
MC/DC0%0/2
not defined $retval or $retval == 0
not defined $retval
$retval == 0
Truth table33%1/3
not(A) or B
A= not defined $retvalB= $retval == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2231 | 0 | shift @_CB_STACK; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2232 | 0 | $_CUR_CB = $_CB_STACK[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2233 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2234 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2236 | 25 | return $retval; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2238 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2239 | 74 | ▶ | sub _callback_read { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_callback_read: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2240 | 74 | my $fh = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2241 | 74 | my $buflen = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2243 | 74 | my $retval = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2244 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2245 | 74 | ▶ | if ( defined $_CUR_CB ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2246 | 74 | $retval = $_CUR_CB->[2]->( $fh, $buflen ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2247 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2249 | 74 | return $retval; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2250 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2252 | 25 | ▶ | sub _callback_close { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_callback_close: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2253 | 25 | my $fh = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2254 | 25 | my $retval = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2256 | 25 | ▶ | if ( defined $_CUR_CB ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2257 | 25 | $retval = $_CUR_CB->[3]->( $fh ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2258 | 25 | shift @_CB_STACK; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2259 | 25 | $_CUR_CB = $_CB_STACK[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2260 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2262 | 25 | return $retval; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2263 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2265 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2266 | # member functions and methods # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2267 | #-------------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2269 | 204 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2270 | 204 | my $CLASS = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2271 | 204 | return bless {'_CALLBACKS' => []}, $CLASS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2272 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2274 | # add a callback set to the callback stack | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2275 | # synopsis: $icb->register_callbacks( [$match_cb, $open_cb, $read_cb, $close_cb] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2276 | 11 | ▶ | sub register_callbacks { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
register_callbacks: called CC=3 SCAR=11.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2277 | 11 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2278 | 11 | my $cbset = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2280 | # test if callback set is complete | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2281 | 11 | ▶ | if ( ref $cbset eq "ARRAY" and scalar( @$cbset ) == 4 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $cbset eq "ARRAY" and scalar @$cbset == 4
MC/DC0%0/2
ref $cbset eq "ARRAY" and scalar @$cbset == 4
ref $cbset eq "ARRAY"
scalar @$cbset == 4
Truth table33%1/3
A and B
A= ref $cbset eq "ARRAY"B= scalar @$cbset == 4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2282 | 11 | unshift @{$self->{_CALLBACKS}}, $cbset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2283 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2284 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2285 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2286 | # remove a callback set to the callback stack | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2287 | # if a callback set is passed, this function will check for the match function | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2288 | 1 | ▶ | sub unregister_callbacks { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unregister_callbacks: called CC=3 SCAR=12.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2289 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2290 | 1 | my $cbset = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2291 | 1 | ▶ | if ( ref $cbset eq "ARRAY" and scalar( @$cbset ) == 4 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $cbset eq "ARRAY" and scalar @$cbset == 4
MC/DC0%0/2
ref $cbset eq "ARRAY" and scalar @$cbset == 4
ref $cbset eq "ARRAY"
scalar @$cbset == 4
Truth table33%1/3
A and B
A= ref $cbset eq "ARRAY"B= scalar @$cbset == 4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2292 | 1 | $self->{_CALLBACKS} = [grep { $_->[0] != $cbset->[0] } @{$self->{_CALLBACKS}}]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2293 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2294 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2295 | 0 | shift @{$self->{_CALLBACKS}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2296 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2297 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2298 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2299 | # make libxml2 use the callbacks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2300 | 719 | ▶ | sub init_callbacks { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_callbacks: called CC=11 SCAR=24.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2301 | 719 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2302 | 719 | my $parser = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2303 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2304 | #initialize the libxml2 callbacks unless this is a nested callback | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2305 | 719 | ▶ | $self->lib_init_callbacks() unless($_CB_NESTED_DEPTH); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2307 | #store the callbacks for any outer executing parser instance | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2308 | 719 | $_CB_NESTED_DEPTH++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2309 | 719 | push @_CB_NESTED_STACK, [ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2310 | $_CUR_CB, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2311 | [@_CB_STACK], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2312 | [@_GLOBAL_CALLBACKS], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2313 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2314 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2315 | #initialize the callback variables for the current parser | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2316 | 719 | $_CUR_CB = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2317 | 719 | @_CB_STACK = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2318 | 719 | @_GLOBAL_CALLBACKS = @{ $self->{_CALLBACKS} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2319 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2320 | #attach parser specific callbacks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2321 | 719 | ▶ | if($parser) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2322 | 719 | my $mcb = $parser->match_callback(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2323 | 719 | my $ocb = $parser->open_callback(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2324 | 719 | my $rcb = $parser->read_callback(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2325 | 719 | my $ccb = $parser->close_callback(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2326 | 719 | ▶ | if ( defined $mcb and defined $ocb and defined $rcb and defined $ccb ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%6/9
defined $mcb and defined $ocb and defined $rcb and defined $ccb
defined $mcb and defined $ocb and defined $rcb
defined $mcb and defined $ocb
MC/DC25%1/4
defined $mcb and defined $ocb and defined $rcb and defined $ccb
defined $mcb
defined $ocb
defined $rcb
defined $ccb
Truth table40%2/5
A and B and C and D
A= defined $mcbB= defined $ocbC= defined $rcbD= defined $ccb
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2327 | 4 | unshift @_GLOBAL_CALLBACKS, [$mcb, $ocb, $rcb, $ccb]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2328 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2329 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2331 | #attach global callbacks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2332 | 719 | ▶ | if ( defined $XML::LibXML::match_cb and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%6/9
defined $XML::LibXML::match_cb and defined $XML::LibXML::open_cb and defined $XML::LibXML::read_cb and defined $XML::LibXML::close_cb
defined $XML::LibXML::match_cb and defined $XML::LibXML::open_cb and defined $XML::LibXML::read_cb
defined $XML::LibXML::match_cb and defined $XML::LibXML::open_cb
MC/DC25%1/4
defined $XML::LibXML::match_cb and defined $XML::LibXML::open_cb and defined $XML::LibXML::read_cb and defined $XML::LibXML::close_cb
defined $XML::LibXML::match_cb
defined $XML::LibXML::open_cb
defined $XML::LibXML::read_cb
defined $XML::LibXML::close_cb
Truth table40%2/5
A and B and C and D
A= defined $XML::LibXML::match_cbB= defined $XML::LibXML::open_cbC= defined $XML::LibXML::read_cbD= defined $XML::LibXML::close_cb
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2333 | defined $XML::LibXML::open_cb and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2334 | defined $XML::LibXML::read_cb and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2335 | defined $XML::LibXML::close_cb ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2336 | 1 | push @_GLOBAL_CALLBACKS, [$XML::LibXML::match_cb, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2337 | $XML::LibXML::open_cb, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2338 | $XML::LibXML::read_cb, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2339 | $XML::LibXML::close_cb]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2340 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2341 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2342 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2343 | # reset libxml2's callbacks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2344 | 719 | ▶ | sub cleanup_callbacks { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cleanup_callbacks: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2345 | 719 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2346 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2347 | #restore the callbacks for the outer parser instance | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2348 | 719 | $_CB_NESTED_DEPTH--; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2349 | 719 | my $saved = pop @_CB_NESTED_STACK; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2350 | 719 | $_CUR_CB = $saved->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2351 | 719 | @_CB_STACK = (@{$saved->[1]}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2352 | 719 | @_GLOBAL_CALLBACKS = (@{$saved->[2]}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2354 | #clean up the libxml2 callbacks unless there are still outer parsing instances | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2355 | 719 | ▶ | $self->lib_cleanup_callbacks() unless($_CB_NESTED_DEPTH); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2356 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2357 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2358 | 77 | $__loaded=1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2360 | 77 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2361 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2362 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||