in reply to xpath problem using XML::LibXML
G'day anadem,
You appear to have gotten close. You give the impression that you were just trying all the variations you could think of: one more and you probably would have been there. However, that's not a very efficient way to code: it's better to understand what you're doing than continually throwing pieces of code at a problem until one of them turns out to be right.
Here's the latest "W3C XPath" documentation. The "Path Expressions" section has full details but I usually find that just the "Abbreviated Syntax" subsection suffices in most cases.
In your first code fragment you needed this path for findnodes():
'//matrix/vm[@type="br"]'
Had you done that, I believe you would have got what you wanted.
All of your attempts had either the findnodes() or the findvalue() path right but the other one wrong.
The XML::LibXML documentation should help you with your outstanding tasks.
-- Ken
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: xpath problem using XML::LibXML
by anadem (Scribe) on Apr 12, 2014 at 17:40 UTC | |
by kcott (Archbishop) on Apr 12, 2014 at 23:04 UTC | |
by anadem (Scribe) on Apr 14, 2014 at 16:06 UTC |