我在保存xml文档对象,并将其保存在xml文件中,如下所示。保存xml对象,以便元素在保存的xml文件中按排序顺序排列
<author name="tom" book="Fun-II"/>
<author name="jack" book="Live-I"/>
<author name="pete" book="Code-I"/>
<author name="jack" book="Live-II"/>
<author name="pete" book="Code-II"/>
<author name="tom" book="Fun-I"/>
,而不是我想这样,当我坚持它是由如下分组然后提交书的名称保存对象在文档对象的内容进行排序:
<author name="jack" book="Live-I"/>
<author name="jack" book="Live-II"/>
<author name="pete" book="Code-I"/>
<author name="pete" book="Code-II"/>
<author name="tom" book="Fun-I"/>
<author name="tom" book="Fun-II"/>
我使用Apache XML豆..关于如何实现这一目标的任何想法?
谢谢。