Skip to Content.
Sympa Menu

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

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Manfred Lotz <manfred.lotz AT arcor.de>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: [XOM-interest] How to sort elements...?
  • Date: Mon, 05 May 2008 09:18:00 +0200

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





Archive powered by MHonArc 2.6.24.

Top of Page