Pergunta

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 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....

Foi útil?

Solução 2

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

Sorting an XML in Java

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top