lib/LaTeXML/Common/XML/Parser.pm

filter: Statementstmt 41.6% 10 / 24 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 42.8% 3 / 7 Podpod 0.0% 0 / 4 totaltotal 28.8% 13 / 45 CC 4 SCAR 17.0
CC
4
Cov
32%
parseFile
12.0
parseChunk
6.0
new
2.0
CRAP 5.5
« lib/LaTeXML/Post/XMath.pm ↑ Summary lib/LaTeXML/Common/Float.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 33 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 33 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 33 ▶use XML::LibXML;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
18 0 my ($class) = @_;
19 0 my $parser = XML::LibXML->new();
20 0 $parser->validation(0);
21 0 return bless { parser => $parser }, $class; }
22  
23 0 ▶sub parseFile {
Subroutine parseFile: not called CC=3 SCAR=24.8
Pod undocumented
24 0 my ($self, $file) = @_;
25 0 LaTeXML::Common::XML::initialize_catalogs();
26 # LaTeXML::Common::XML::initialize_input_callbacks($$self{parser});
27 0 ▶ if (((-s $file) || 0) > 20_000_000) {
Branch: 1 branch
BranchTrueFalseTotal
if ((-s $file || 0) > 20000000) 0 0 0
Condition0%0/2
-s $file || 0
l!l
00
MC/DC0%0/1
-s $file || 0
-s $file
Truth table0%0/2
A
A= -s $file
Aresult
11
00
28 0 $$self{parser}->set_option('huge', 1); }
29 0 return $$self{parser}->parse_file($file); }
30  
31 0 ▶sub parseString {
Subroutine parseString: not called CC=1 SCAR=6.9
Pod undocumented
32 0 my ($self, $string) = @_;
33 0 return $$self{parser}->parse_string($string); }
34  
35 # Note: This expects only a single node, not a document fragment.
36 0 ▶sub parseChunk {
Subroutine parseChunk: not called CC=2 SCAR=17.9
Pod undocumented
37 0 my ($self, $string) = @_;
38 0 my $xml = $$self{parser}->parse_string($string);
39 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
40  
41 #======================================================================
42 33 1;
« lib/LaTeXML/Post/XMath.pm ↑ Summary lib/LaTeXML/Common/Float.pm »