[opencms-dev] Sorting of XML-Content-Nodes (not of different files)

Mario Jäger m.jaeger at alkacon.com
Mon Aug 2 11:18:21 CEST 2010


Hi Marc,

I think I understand what you mean now. You have a Xml content with two elements of type "OpenCmsString" or with two 
elements "OpenCmsDateTime". In the jsp to display the two elements, you want to iterate over the sorted element list 
then.

One possibility to sort the node values is, that you put the node values in a list, for example of type "ArrayList". 
Then you sort the list in naturally order with "Collections.sort()". Then, you use this list to give out the node 
values. 

Because your elements are separated elements (with different names) and you have to access them with their name, I 
think you should do that in the jsp or in a bean.

--
Kind Regards,
Mario.
 
-------------------
Mario Jäger
 
Alkacon Software GmbH  - The OpenCms Experts                    
http://www.alkacon.com - http://www.opencms.org


Mario Jäger schrieb:
> Hi Marc,
>
> I still don't understand your problem. In which procedure do you want to sort the nodes of a XML content - when you open 
> the XML content editor or when you give out the content of a single Xml file? But, in both cases I don't know what you 
> want to sort, when you have two elements of type "OpenCmsString" and "OpenCmsDateTime". And in both cases you are able 
> to decide yourself the order in which the Xml content elements are displayed. Because, the subject of your mail is 
> "Sorting of XML-Content-Nodes (not of different files)" I exclude, that you want to sort the entries in a Xml content list.
>
>   



More information about the opencms-dev mailing list