in reply to Re^4: XML::Simple--dealing with a variable element
in thread XML::Simple--dealing with a variable element

I think I'd need to see more of your data to answer that conclusively. I wrote up a little test script (if only to keep my own sanity, hehe), and that showed me I did get the attribute names according to how I understand your data. Let me know where your real stuff differs.
use XML::Simple; $data = XMLin( \*DATA, KeepRoot => 1 ); @attrs = map { keys %{ $_->{attributes}{attribute} } } values %{ $data->{dataschemas}{dataschema} }; print "@attrs"; __DATA__ <dataschemas> <dataschema name="varyingName1"> <attributes> <attribute> <one>1</one> <two>2</two> </attribute> </attributes> </dataschema> <dataschema name="varyingName2"> <attributes> <attribute> <three>3</three> <four>4</four> </attribute> </attributes> </dataschema> </dataschemas>

Prints: one two three four

Replies are listed 'Best First'.
Re^6: XML::Simple--dealing with a variable element
by bw (Novice) on Jul 26, 2006 at 23:33 UTC
    Here's a snippet of one of the <attributes> stanzas:

    <attributes>
    <attribute category="" parser="CSVParser" />
    <attribute category="APS" internalCategory="aps" />
    <attribute category="ASC" internalCategory="asc" />
    <attribute category="ASMT" internalCategory="asmt" />
    <attribute category="LE" internalCategory="l&e" />
    <attribute category="NCO" internalCategory="nco" />
    <attribute category="NEED TITLE" internalCategory="need title" />
    <attribute category="New Need ID" internalCategory="need id" />
    <attribute category="SUMMARY OF DELIVERABLES" parser="TextParser" extract="true" segmentation="hard" />
    </attributes>