| Store | Cart

Question on XML::XPath class

From: Adam Pfeiffer <acpi...@gmail.com>
Thu, 12 Oct 2017 14:11:12 -0600
Hi,

I am using the Perl XML::XPath module and have encountered something which
might be a bug.  I am starting with an empty object by calling this:



my $xp = XML::XPath->new()



I am then trying to add new data to this object using the createNode method
with xpaths that look like this:



/root/extension-tunnel[name="0/1"]/tape-write



When I attempt this, I get the following error:

DB<7> x $xpath

0  '/root/extension-tunnel[name="0/1"]/ficon-tape-read-acceleration'



DB<8> x $xp->createNode($xpath)

no element found at line 1, column 0, byte -1:

15^

5443328

 at /usr/local/lib/perl/5.14.2/XML/Parser.pm line 187.



Is this something that should work, or am I just using the class
incorrectly?  I have the full output of the object below in case that helps.



Thanks



DB<9> x $xp

0  XML::XPath=HASH(0x6bc2630)

   '_context' => undef

   '_filename' => undef

   '_ioref' => undef

   '_parser' => undef

   '_xml' => undef

   'path_parser' => XML::XPath::Parser=HASH(0x8c2f638)

      '_curr_match' => ''

      '_tokpos' => 11

      'cache' => HASH(0x8c25018)

         '/root/extension-tunnel[name="0/1"]/ficon-tape-read-acceleration'
=> XML::XPath::Expr=HASH(0x959eaf8)

            'lhs' => XML::XPath::LocationPath=ARRAY(0x959eca8)

               0  XML::XPath::Root=SCALAR(0x6b23598)

                  -> undef

               1  XML::XPath::Step=HASH(0x9569678)

                  'axis' => 'child'

                  'axis_method' => 'axis_child'

                  'literal' => 'root'

                  'pp' => XML::XPath::Parser=HASH(0x8c2f638)

                     -> REUSED_ADDRESS

                  'predicates' => ARRAY(0x9569630)

                       empty array

                  'test' => 0

               2  XML::XPath::Step=HASH(0x9569528)

                  'axis' => 'child'

                  'axis_method' => 'axis_child'

                  'literal' => 'extension-tunnel'

                  'pp' => XML::XPath::Parser=HASH(0x8c2f638)

                     -> REUSED_ADDRESS

                  'predicates' => ARRAY(0x9569570)

                     0  XML::XPath::Expr=HASH(0x95a1da0)

                        'lhs' => XML::XPath::Expr=HASH(0x9578750)

                           'lhs' =>
XML::XPath::LocationPath=ARRAY(0x9565d00)

                              0  XML::XPath::Step=HASH(0x95a8960)

                                 'axis' => 'child'

                                 'axis_method' => 'axis_child'

                                 'literal' => 'name'

                                 'pp' => XML::XPath::Parser=HASH(0x8c2f638)

                                    -> REUSED_ADDRESS

                                 'predicates' => ARRAY(0x95a89c0)

                                      empty array

                                 'test' => 0

                           'pp' => XML::XPath::Parser=HASH(0x8c2f638)

                              -> REUSED_ADDRESS

                           'predicates' => ARRAY(0x9578708)

                                empty array

                        'op' => '='

                        'pp' => XML::XPath::Parser=HASH(0x8c2f638)

                           -> REUSED_ADDRESS

                        'predicates' => ARRAY(0x9569de0)

                             empty array

                        'rhs' => XML::XPath::Expr=HASH(0x95a8dc8)

                           'lhs' => XML::XPath::Literal=SCALAR(0x6a747f8)

                              -> '0/1'

                           'pp' => XML::XPath::Parser=HASH(0x8c2f638)

                              -> REUSED_ADDRESS

                           'predicates' => ARRAY(0x95a8d80)

                                empty array

                  'test' => 0

               3  XML::XPath::Step=HASH(0x95692a0)

                  'axis' => 'child'

                  'axis_method' => 'axis_child'

                  'literal' => 'ficon-tape-read-acceleration'

                  'pp' => XML::XPath::Parser=HASH(0x8c2f638)

                     -> REUSED_ADDRESS

                  'predicates' => ARRAY(0x9569ac8)

                       empty array

                  'test' => 0

            'pp' => XML::XPath::Parser=HASH(0x8c2f638)

               -> REUSED_ADDRESS

            'predicates' => ARRAY(0x959ec00)

                 empty array

      'context_pos' => undef

      'context_set' => XML::XPath::NodeSet=ARRAY(0x8c25630)

           empty array

      'context_size' => 0

      'direction' => 'forward'

      'namespaces' => HASH(0x8c375d0)

           empty hash

      'vars' => HASH(0x8c25378)

           empty hash

_______________________________________________
Perl-XML mailing list
Perl...@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Recent Messages in this Thread
Adam Pfeiffer Oct 12, 2017 08:11 pm
Shlomi Fish Oct 12, 2017 09:15 pm
Adam Pfeiffer Oct 13, 2017 08:47 pm
Liam R. E. Quin Oct 13, 2017 02:06 am
Adam Pfeiffer Oct 13, 2017 08:46 pm
Messages in this thread