Page 1 of 1

Generate multiple sample XML files

Posted: Thu Dec 20, 2018 8:00 pm
by MikeTheSpike
Hi,

I'm working on an XML schema (XSD) distributed over various files, where some schema files define one or more global elements. I'm now in the process of generating sample XML files and I want to generate at least one file per root element. I have found no way but to manually pick a single root element, generate the sample XML file, and then continue with the next element.

I wonder if this can be facilitated by using an approach that would allow to select multiple root elements, for instance one similar to selecting files when importing into an Eclipse project from the file system, with a left column listing the schema files (preferably only those containing global elements) and a right column listing the global elements of the respective schema file. Check boxes would allow to select/deselect a file (and its global elements) and individual elements, and of course there would be "clear selection"/"select all" buttons or the like. The respective element name would be used as the name of the output XML file, with optional variables to insert a timestamp etc., and there would probably have to be an "overwrite existing files"/"add file count to name" choice.

I see the are still questions as regards the selction of eligible schema files, for instance considering master XML schema, open XML schema files, the current and possibly included/imported schemata etc. which I honestly haven't given much thought and which you are far more qualified to answer.

Best regards, and season's greetings,

Michael

Re: Generate multiple sample XML files

Posted: Thu Dec 20, 2018 8:09 pm
by MikeTheSpike
Sorry I forgot to mention I'm using oXgen Enterprise 20.0!

Re: Generate multiple sample XML files

Posted: Thu Dec 27, 2018 12:45 pm
by adrian
Hi,

Currently (v20.1), it's only possible to pick a single root element in the UI. Batch Generation of Sample XML Files can be done from the command line:
Running the Generate Sample XML Files Tool from the Command Line
For your use case, you would have to export (duplicate) multiple configuration files (Export settings), one for each element name. Make sure you also change either the output folder or filename prefix (or both). Otherwise samples from one batch will get overwritten by another batch.
To run them all in one step, create a script file that invokes the xmlGenerator.bat/.sh script for each of your configuration files (each root element).

I've logged your feature request on our issue tracking tool. We will analyze this use case and try to provide a solution in a future version.

Regards,
Adrian