Skip to content Skip to sidebar Skip to footer

Xml Instance Generation From Xml Schema (xsd)

I was wondering if there's a way I can automate the generation of XML files from XSD schemas given that I have the data and the labels. I'd like to do this in python/java. It seems

Solution 1:

Look at pyXSD for Python tools that are similar to JAXB.

XSD's are used to create Python classes. Python objects are used to emit XML.

Solution 2:

Microsoft has published a "document generator" tool as a sample. This is an article that describes the architecture and operation of the sample app in some detail.

If you just want to use the document generation tool, click here and install the MSI. It requires no programming.

It's free. The source is available. Requires the .NET Framework to run. Works only with XSDs. (not Relax NG or DTD).

Solution 3:

I recommend two approaches:

  1. Xstream - it let's you generate XML files by defining a Java file and either putting Java annotations on the items or just defining aliases. It is very easy, but it is not fully automatic;

  2. XMLBeans - these tools let's you generate Java files from XML schema definitions (xsd) so that you can import, manipulate, create and export XML files using JavaBeans-like method calls.

Regards, Luis

Solution 4:

JAXB works fantastic for generating classes from xsd.

Ibatis works fantastic for getting data into classes.

You can use Ibatis to feed data and automatically create classes, then use JAXB to marshal the classes into an XML file! Mind you, that's a lot of effort if you're not going to be doing it over and over again.

Solution 5:

I use Exchanger XML Editor for this purpose. You can download it for free for multiple operating systems at: http://www.exchangerxml.com/

The option is in menu "Schema" -> "Schema instance generation".

Post a Comment for "Xml Instance Generation From Xml Schema (xsd)"