[XOM-interest] How to sort elements...?

Manfred Lotz manfred.lotz at arcor.de
Mon May 5 03:18:00 EDT 2008


Hi all,
I want to modify an xml document by sorting the children of a specific 
element.

Assuming I have something like this:

<a>
  <b key="xyz"> .... </b>
  <b key="sssssyz"> .... </b>
  <b key="eyz"> .... </b>
  <b key="qyz"> .... </b>
  <b key="abc"> .... </b>
</a>

I want to sort the <b> elements according to the key value and write the 
modified xml document to a file.


I can put the <b> elements in Elements
	Elements bElements = doc.getRootElement().getChildElements();

but this gives me iteration only.


How can I do it?


-- 
Manfred



More information about the XOM-interest mailing list