开发者

Sorting XML generated by Castor

I am using Castor for XML Binding.. We need to sort the XML based on two different fields. Is there way we can specify the sort order in castor while marshalling?

Which will be a better approach to do this sorting, if castor don't have this feature.

Here is the actual problem with Sorting...

I have two collections of two differnt objects, which is ordered by date sepaterly. I set these two collections to another object and we have the开发者_如何学Go correspoing mapping file which will have the XML generated in the order of the collections defined in the mapping file.. this is okay.

But now I want to order these two different set of collections ordered by the dates on both in the XML....


It's not entirely clear to me what exactly you mean. Do you mean that you have a collection of objects that you want to convert to XML, and you want to see them in a particular order in the XML output?

Do you have those objects in a collection (a List, for example)? If the above is your question, then make sure that the objects are in the List in the right order before passing the list to Castor.


Couldn't find anything in Castor. Sorted the XML using XSLT. Used XALAN.

Sorting an XML in Java

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜