Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Sorting XML elements

by IOrdy (Friar)
on Feb 20, 2002 at 01:42 UTC ( #146470=note: print w/replies, xml ) Need Help??


in reply to Sorting XML elements

If you are sorting for display you dont need to sort and rebuild the XML tree at all. Just iterate over the node parent according to the X then Y attributes of the <location> child. If you really want to sort your file and save, then I think the simplest way would be to build a new tree and add in nodes as they are sorted. Then save your new xml tree over the top of the old.

I find Xpath easier to bend my mind around so I have been using XML::LibXML which gives you the option of mixing and matching between XPath and DOM according to the task.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://146470]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2023-01-29 19:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?