Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Sorting XML elements

by IOrdy (Friar)
on Feb 20, 2002 at 01:42 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-23 18:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found