XML instance generation from XML schema (xsd) [closed]

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 very possible, yet I can't find any library that allows me to do this. I'm looking for a fairly quick solution.. Any ideas?

See also: how-to-generate-sample-xml-documents-from-their-dtd-or-xsd


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.


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).


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