Hi all, I have a question in how to handle parsing out node values that have the same title. Right now when I use Lib XML it finds the nodes, but dumps them altogether as one string. I need to be able to separate them out uniquely. Any good/easy way to do that? Here's an example:
<parent_node> <node1><child_node>stuff_I_can_get</child_node></node1> <node2><child_node_a>stuff_I_want_1</child_node_a></node2> <node2><child_node_a>stuff_I_want_2</child_node_a></node2> </parent_node>
So I can grab node1's value of "stuff I can get" without issue, but when I grab node2's value under "child node a", since both are called node2 and child node a, both ""stuff_I_want_1" and "stuff_I_want_2" come back together as one string and would return as "stuff_I_want_1stuff_I_want2" ....my code is:
foreach $test($dom->findnodes('/parent_node')) { $mystring = $test->findnodes('./node2/child_node_a'); }
So I need a way to identify both nodes uniquely somehow even though they are called the exact same thing but have two different values

In reply to Duplicate XML Node Question by omegaweaponZ

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.