Meaningless Drivel is fun!
The moose likes XML and Related Technologies and the fly likes Xml Conversion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Xml Conversion" Watch "Xml Conversion" New topic

Xml Conversion

gianni ipez
Ranch Hand

Joined: Jan 02, 2007
Posts: 65
I need to convert an xml file in input, to an xml with a different dtd in output.
I've no idea about how to achieve this task, I don't want you to write the solution for me,
but I 'd be pleased if someone could head me in the right direction.

I think it's intuitive, we have in input a list of books with their chapters. Every chapter in the input file is joined to its book through the idBook.
The input structure is "flat", the output desired structure has a level more of complexity and is less redundant.

Input file:

And here you are what I would expect the program to obtain:

Thank you in advance,
Paul Clapham

Joined: Oct 14, 2005
Posts: 19739

If you want a direction to head in, consider XSLT for converting one XML format to another.
gianni ipez
Ranch Hand

Joined: Jan 02, 2007
Posts: 65
Thank you for the hint.
Here the peculiarity is that in the xml input BOOK is the text node, child of tag KIND,
in the output , BOOK must become an element tag itself.
Does xslt let you make this transformation? How ?
Thank you,
I agree. Here's the link:
subject: Xml Conversion
It's not a secret anymore!