| 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
Condition0%0/2
-s $file || 0
MC/DC0%0/1
-s $file || 0
-s $file
Truth table0%0/2
A
A= -s $file
| |||||||||||||||||||||
| 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
MC/DC0%0/2
$xml && $xml->documentElement
$xml
$xml->documentElement
Truth table0%0/3
A && B
A= $xmlB= $xml->documentElement
| |||||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | #====================================================================== | ||||||||||||||||||||
| 42 | 33 | 1; | |||||||||||||||||||