• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sorting large xml nodes

 
Geo Bar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to sort nodes in an xml file, each node contains a little over 300 fields, and so my question is, is there a way to sort these nodes other than the examples I've seen for nodes with only a few fields? like in the following example: sort xml

In my case this would be impractical, but if there is no way around it I would have to do it this way. If at all possible please provide some code example, I am just starting to learn java and not very familiar with all the different packages and tools.


I would like to sort it by ORDER_LINE




Thanks for any help
 
Paul Clapham
Sheriff
Posts: 21002
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's the best they could do over at SO? By far the easiest thing to do is to do an XSLT identity transformation and apply <xsl:sort> to the <CARTONDETAIL> elements.
 
Paul Clapham
Sheriff
Posts: 21002
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch, Geo!
 
Geo Bar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul,
Thanks, it is good to be in this great community and get some help from smarter people than me

I was looking into xslt and looks like it is exactly what I need, however, I'm having a little hard time how would I automate the process? do I need to use something like saxon or can java do it out of the box, if so, what classes or packages would I need to use in order to accomplish this?

Thanks for any help!
 
Paul Clapham
Sheriff
Posts: 21002
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
XSLT is built into Java, at least XSLT 1.0 is. And that's all you'd need for your requirements. Here's a link to the relevant Oracle tutorial: http://docs.oracle.com/javase/tutorial/jaxp/xslt/intro.html (Google keywords "java xslt tutorial").
 
Geo Bar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you! greatly appreciated..
 
Paul Clapham
Sheriff
Posts: 21002
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Keep us posted with your progress!

(I used to try to answer questions over at SO but I was way too slow. By the time I found a question I could answer it would have already been closed because it didn't meet SO's high standards.)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic