Using XPath in libXMLby ramrod (Hermit)
|on Feb 09, 2009 at 15:25 UTC||Need Help??|
ramrod has asked for the
wisdom of the Perl Monks concerning the following question:
I am rather new to the world of Perl, and I was wondering if anyone had some advice/experience using XPath and libXML.
I am trying to comb through an XML style document and replace some of the data. So far I have only been partially successful, and I have also generated some questions that I have not been able to answer:
How can I access an attribute of the root node?
"Regular" XPath uses . and @ characters which have different uses in Perl, is there some workaround for using these in libXML?
I found a script using "/text()", which is a valid means to access the value of an element. Are there other similar/related calls I can use?
Pretty much, it looks like I am missing the basic syntax for XPath in libXML. Any help with this is appreciated.