简体   繁体   中英

Generate java class hierarchy from xml (plist)

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM