XML generation with java, trying to copy the whole node

Posted by Pawel Mysior on Stack Overflow See other posts from Stack Overflow or by Pawel Mysior
Published on 2010-05-23T10:20:27Z Indexed on 2010/05/23 10:30 UTC
Read the original article Hit count: 424

Filed under:
|
|

I've got an xml document that filled with people (parent node is "students", and there are 25+ "student" nodes).

Each student looks like this:

<student>
  <name></name>
  <surname></surname>
  <grades>
    <subject name="">
      <small_grades></small_grades>
      <final_grade></final_grade>
    </subject>
    <subject name="">
      <small_grades></small_grades>
      <final_grade></final_grade>
    </subject>
  </grades>
  <average></average>
</student>

Basically, what I want to do ('ve been asked to do) is to make a program that would get 3 students with the best average. While parsing the document and getting three best students isn't too difficult, the XML generation is a pain in the ass.

Right now, what I'm doing is getting every single node from student and recreating it to a new file. Is there a way to copy the whole student node with everything that's in it?

Regards, Paul

© Stack Overflow or respective owner

Related posts about java

Related posts about Xml