Hello Monks!

I need some help with something that has been driving me nuts for the last week, so here I come with my hat in hand, hoping some one can give me some help.
First off, here is a sample of the XML file I have to work with:

<?xml version="1.0" standalone="no"?> <foo> <ruleset> <description>bunch o' text here</description> <item name="A"> <description>fake a</description> <text/> </item> <item name="B"> <description>fake b</description> <radio> <option label="1" selected="t" value="1"/> <option label="2" value="2" /> </radio> </item> <item name="C"> <description>fake C</description> <replicant min="0" max="300"> <item name="C1"> <description>fake C1</description> <browser initial-dir="/htdocs/images/" /> </item> </replicant> </item> <container name="D"> <item name="A"> <description>Fake D-A</description> <browser/> </item> <item name="B" rowcontinue="f"> <description>fake d-b</description> <replicant min="1" max="15"> <item name="B-1"> <text/> </item> </replicant> </item> </container> </ruleset> </foo>

What I need to do is parse over the XML file looking for anything that is not in a <replicant></replicant> block and return an in order array or hash of references that will point to those items.
Something like: foo->{item}->{A} or foo->{container}->{D}->{A}.
I don't care about any of the other attributes or what the value is ( that will be found later by something else ).
I've tried using XML::Parser but got no where and got very confused in the process and XML::Twig doesn't seem to be what I need. Any help from anyone would be greatly appreciated!!! Thanks.

In reply to XML Parsing help.... by dwhitney

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.