Hi Magnolians

I've a script which reads some NodeDatas of childPages into a fatherPage. Now I try to sort these by a specified NodeData.

Here's the code:

//
//Array for the sorted children
ArrayList childrenArrayList = new ArrayList();

//
//Iterate through children an get the nodeData
for (Iterator myChildrenIterator = myChildren.iterator(); myChildrenIterator.hasNext();) {
                
  //
  //go throug the paragraph
  Content para = (Content)myChildrenIterator.next();
  //
  //Get the nodeData
  Iterator paraNodes = para.getChildren().iterator();
  Content nodes = (Content)paraNodes.next();

  String node4sort = nodes.getNodeData("region").getString();

  //Fill the ArrayList
  childrenArrayList.add(node4sort);
}

childrenArrayList.add("cc"); -->Just for testing
childrenArrayList.add("aa"); -->Just for testing
childrenArrayList.add("bb"); -->Just for testing
//
//now sort the array
int size = childrenArrayList.size();
Collections.sort(childrenArrayList);
for (int i=0; i<size; i++) {
  out.println(childrenArrayList.get(i) + "<br />");
}

Now I get an unsorted list of "node4sort", but the strings "cc", "aa", "bb", which I add for testing, are sorted.

Sorry. This is a bit OT, but can anybody give me a hint. String is string? or not

Thanks
Christoph

----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/magnolia/developer.html
----------------------------------------------------------------

Reply via email to