Hi,
I need to sort an XML by tag names and attribute. Is it possible using DOM?
I need the result in a sorted XML file not HTML.
for example:
<books>
<book id='1'>
<name value='N1'/>
<author value='A1'/>
</book>
<book id='3'>
<name value='N3'/>
<author value='A3'/>
</book>
<book id='2'>
<author value='A2'/>
<name value='N2'/>
</book>
</books>
I expect to get after sortXML ('id')
<books>
<book id='1'>
<author value='A1'/>
<name value='N1'/>
</book>
<book id='2'>
<author value='A2'/>
<name value='N2'/>
</book>
<book id='3'>
<author value='A3'/>
<name value='N3'/>
</book>
</books>
XML is sorted by tag names then by id