Running the Generate Sample XML Files Tool from the Command Line
The Generate Sample XML Files tool can be also used from command line
by running the script called xmlGenerator.bat
(on Windows) /
xmlGenerator.sh
(on Mac OS X / Unix / Linux) located in the Oxygen XML Developer plugin installation folder. The parameters can be set in the dialog box,
exported to an XML file on disk with the Export settings button, and
then reused from command line. With the exported settings file, you can generate the
same XML
instances from the command line as from the dialog box. For
example:
xmlGenerator.bat path_of_CFG_fileThe script can be integrated in an external batch process launched from the command line. The command line parameter of the script is the relative path to the exported XML settings file. The files specified with relative paths in the exported XML settings will be made absolute relative to the folder where the script is run.
The following example shows such an XML configuration file:
XML Configuration File
<settings> <schemaSystemId>http://www.w3.org/2001/XMLSchema.xsd</schemaSystemId> <documentRoot>schema</documentRoot> <outputFolder>D:\projects\output</outputFolder> <filenamePrefix>instance</filenamePrefix> <filenameExtension>xml</filenameExtension> <noOfInstances>1</noOfInstances> <openFirstInstance>true</openFirstInstance> <defaultNamespace><NO_NAMESPACE></defaultNamespace> <element namespace="<ANY>" name="<ANY>"> <generateOptionalElements>false</generateOptionalElements> <generateOptionalAttributes>false</generateOptionalAttributes> <valuesForContentType>DEFAULT</valuesForContentType> <preferredNumberOfRepetitions>2</preferredNumberOfRepetitions> <maximumRecursivityLevel>1</maximumRecursivityLevel> <choicesAndSubstitutions strategy="RANDOM" generateOthersAsComments="false"/> <attribute namespace="<ANY>" name="<ANY>"> <attributeValue>attrValue1</attributeValue> <attributeValue>attrValue2</attributeValue> </attribute> </element> <element namespace="<NO_NAMESPACE>" name="<ANY>"> <generateOptionalElements>true</generateOptionalElements> <generateOptionalAttributes>true</generateOptionalAttributes> <valuesForContentType>DEFAULT</valuesForContentType> <preferredNumberOfRepetitions>2</preferredNumberOfRepetitions> <maximumRecursivityLevel>1</maximumRecursivityLevel> <choicesAndSubstitutions strategy="RANDOM" generateOthersAsComments="true"/> <elementValue>value1</elementValue> <elementValue>value2</elementValue> <attribute namespace="<ANY>" name="<ANY>"> <attributeValue>attrValue1</attributeValue> <attributeValue>attrValue2</attributeValue> </attribute> </element> </settings>