lib/LaTeXML/Common/XML/Parser.pm

filter: Statementstmt 45.4% 10 / 22 Branchbran n/a Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 42.8% 3 / 7 Podpod 0.0% 0 / 4 totaltotal 34.2% 13 / 38 CC 2 SCAR 9.7
CC
2
Cov
40%
parseChunk
6.0
new
2.0
parseFile
2.0
CRAP 2.6
« lib/LaTeXML/Core/Definition/CharDef.pm ↑ Summary lib/LaTeXML/Common/Color/Derived.pm »
1 # /=====================================================================\ #
2 # | LaTeXML::Common::XML::Parser | #
3 # | XML Parser (wrapper for XML::LibXML | #
4 # |=====================================================================| #
5 # | Part of LaTeXML: | #
6 # | Public domain software, produced as part of work done by the | #
7 # | United States Government & not subject to copyright in the US. | #
8 # |---------------------------------------------------------------------| #
9 # | Bruce Miller <bruce.miller@nist.gov> #_# | #
10 # | http://dlmf.nist.gov/LaTeXML/ (o o) | #
11 # \=========================================================ooo==U==ooo=/ #
12 package LaTeXML::Common::XML::Parser;
13 32 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 32 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 32 ▶use XML::LibXML;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 sub new {
18 0 ▶ my ($class) = @_;
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
19 0 my $parser = XML::LibXML->new();
20 0 $parser->validation(0);
21 0 return bless { parser => $parser }, $class; }
22  
23 sub parseFile {
24 0 ▶ my ($self, $file) = @_;
Subroutine parseFile: not called CC=1 SCAR=6.9
Pod undocumented
25 0 LaTeXML::Common::XML::initialize_catalogs();
26 # LaTeXML::Common::XML::initialize_input_callbacks($$self{parser});
27 0 return $$self{parser}->parse_file($file); }
28  
29 sub parseString {
30 0 ▶ my ($self, $string) = @_;
Subroutine parseString: not called CC=1 SCAR=6.9
Pod undocumented
31 0 return $$self{parser}->parse_string($string); }
32  
33 # Note: This expects only a single node, not a document fragment.
34 sub parseChunk {
35 0 ▶ my ($self, $string) = @_;
Subroutine parseChunk: not called CC=2 SCAR=17.9
Pod undocumented
36 0 my $xml = $$self{parser}->parse_string($string);
37 0 ▶ return $xml && $xml->documentElement; }
Condition0%0/3
$xml && $xml->documentElement
!ll&&!rl&&r
000
MC/DC0%0/2
$xml && $xml->documentElement
$xml $xml->documentElement
Truth table0%0/3
A && B
A= $xmlB= $xml->documentElement
ABresult
0X0
100
111
38  
39 #======================================================================
40 32 1;
« lib/LaTeXML/Core/Definition/CharDef.pm ↑ Summary lib/LaTeXML/Common/Color/Derived.pm »