dwhitney has asked for the wisdom of the Perl Monks concerning the following question:

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.

Replies are listed 'Best First'.
Re: XML Parsing help....
by OverlordQ (Hermit) on Feb 14, 2004 at 01:24 UTC