Page 1 of 1

Programmatic generation of XML instances from Schema

Posted: Thu Jan 17, 2008 7:41 pm
by heavydawson
I know Oxygen allows GUI based XML instance generation from a schema file, but is there any way to do this programmatically? In other words, could I use this functionality from within a java program?
Does Oxygen use a 3rd party tool to carry out the instance generation behind the scenes, or is it propietary code?

Posted: Fri Jan 18, 2008 11:14 am
by sorin_ristache

You cannot generate an XML instance from an XML Schema programatically using oXygen code. It is proprietary code and there is no public API for calling that code. It was created only for calling from the oXygen GUI, not from other application.


Re: Programmatic generation of XML instances from Schema

Posted: Tue Oct 28, 2008 11:13 am
by stefan
Starting with version 10 you can call the XML instance generator tool from command line.

Details: ... rator.html
Video demonstration: ... Files.html

You can call the XML instance generator from an ANT task using the following example:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<target name="generate">
<java classname="ro.sync.xml.generator.XMLInstanceGenerator">
<pathelement path="lib/log4j.jar"/>
<pathelement path="lib/xercesImpl.jar"/>
<pathelement path="lib/oxygen.jar"/>
<pathelement path="lib/resolver.jar"/>
<arg value="path_to_your_configuration_file.xml"/>
<arg value="-verbose"/>
Note: The configuration file is generated from the XML instance generator interface using the "Export Settings" option.