Shugal
Shugal

Reputation: 1

rename a childnode in a xml document

i got a problem with a parser.

i want to parse an xml structured like this:

<item>
...
   <notes>
        <item>
        </item>
        <item>
        </item>
   </notes>
</item>

notes is a child of the first item und the other items are childs of notes. if i want to parse this i get the notes as normal items.

i thought it would be simple if i just rename the childs of notes to "noteitem"

is there a simple way to do this in Java?

thank you and sorry for my bad english!

Upvotes: 0

Views: 76

Answers (3)

cmbaxter
cmbaxter

Reputation: 35453

As stated in my comment, if you really want to do what you stated, an XSLT us an option. Just define a style sheet transformation, apply it to the original input document and then parse the results of the transform as XML.

Here is a good starting point: http://docs.oracle.com/javase/tutorial/jaxp/xslt/transformingXML.html

Upvotes: 1

gran33
gran33

Reputation: 12981

Why parse when you can use XSteam? you can find nice and quick tutorial here.

Upvotes: 2

Jasper Ketelaar
Jasper Ketelaar

Reputation: 84

Take a look at: Parsing XML files in Java

Upvotes: 0

Related Questions