G'day bangor,
While I'm not a huge fan of XML::Simple for general XML work, it may suit your needs with minimal coding such as this:
use Data::Dump; use XML::Simple; dd XMLin('document.xml');
Here's an example of the output using the sample XML you provided.
{ latin_name => "Fraxinus Excelsior", name => "Ash", uses => { use => [ { description => "Furniture making" }, { description => "Firewood" }, ], }, }
That seems fairly close to the "simple text representation' you're after. See the XML::Simple documentation for how to tweak that output.
Just for completeness, I generated that output using a here-doc with the XML you posted. The code's in the spoiler for those interested.
-- Ken
In reply to Re: Determine the structure of an XML document
by kcott
in thread Determine the structure of an XML document
by bangor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |