0

Are there any tools that can automatically generate java class hierarchy from xml (plist)?

Say we have:

<blah>
    <item />
    <item />
</blah>

And we need to get something like:

class Blah {

Collection<Item> items;

}

...and so on and so forth

1 Answers1

0

If I get it right, then the elements shall be transformed into class and field names.

This can be done with a few lines of code:

  1. parse the xml document into a DOM
  2. walk through the DOM tree and create a java source file in memory (StringBuilder)
  3. write the source file to your file system

Or use XSLT to create a transformation from your xml document to a java source file.

Andreas Dolk
  • 113,398
  • 19
  • 180
  • 268