| 1 | # /=====================================================================\ # | ||
| 2 | # | LaTeXML::Common::XML::XPath | # | ||
| 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::XPath; | ||
| 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::XPathContext; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | |||
| 17 | 0 | ▶ | sub new { |
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
undocumented
| |||
| 18 | 0 | my ($class, %mappings) = @_; | |
| 19 | 0 | my $context = XML::LibXML::XPathContext->new(); | |
| 20 | 0 | foreach my $prefix (keys %mappings) { | |
| 21 | 0 | $context->registerNs($prefix => $mappings{$prefix}); } | |
| 22 | 0 | return bless { context => $context }, $class; } | |
| 23 | |||
| 24 | 0 | ▶ | sub registerNS { |
|
Subroutine
registerNS: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 25 | 0 | my ($self, $prefix, $url) = @_; | |
| 26 | 0 | $$self{context}->registerNs($prefix => $url); | |
| 27 | 0 | return; } | |
| 28 | |||
| 29 | 0 | ▶ | sub registerFunction { |
|
Subroutine
registerFunction: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 30 | 0 | my ($self, $name, $function) = @_; | |
| 31 | 0 | $$self{context}->registerFunction($name => $function); | |
| 32 | 0 | return; } | |
| 33 | |||
| 34 | 0 | ▶ | sub findnodes { |
|
Subroutine
findnodes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 35 | 0 | my ($self, $xpath, $node) = @_; | |
| 36 | 0 | return $$self{context}->findnodes($xpath, $node); } | |
| 37 | |||
| 38 | 0 | ▶ | sub findvalue { |
|
Subroutine
findvalue: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 39 | 0 | my ($self, $xpath, $node) = @_; | |
| 40 | 0 | return $$self{context}->findvalue($xpath, $node); } | |
| 41 | |||
| 42 | #====================================================================== | ||
| 43 | 33 | 1; | |