Okay, What I am really interested is that the data should get stored in a hash table irrespective of the position of the attributes of the xml file. (As shown above, STYLE 1 and STYLE 2)
Is there any construct/module for this?
For STYLE 1, there are lots of modules (search CPAN for XML). For STYLE 2, there is none, because this is not the standard way to represent structured data in XML.