Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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


In reply to Re: xpath problem using XML::LibXML by kcott
in thread xpath problem using XML::LibXML by anadem

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-04-23 06:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found