Page 1 of 1

Generating sample xml from xsd

Posted: Mon Dec 19, 2016 1:47 pm
by imran
-1
down vote
favorite
I've generated a sample XML from an XSD schema file here is a snippet of the output:

Code: Select all

      <data name="name1">
<data name="name1">0</data>
<data name="name2">65535</data>
<data name="name3">1</data>
</data>
But ideally I need the sample file to contain attributes and data from the original XML file. So the output should be:

Code: Select all


      <data name="attribute1" type="primary">
<data name="attribute2">
<data name="attribute3">_366170470</data>
<data name="attribute2">
<data name="attribute4">_120494376</data>
</data>
</data>
</data>
The attribute1,2,3 etc are actuall attribute names for the data element from the original XML.

Is this possible?

Re: Generating sample xml from xsd

Posted: Mon Dec 19, 2016 4:35 pm
by adrian
Hi,

The "Generate Sample XML Files" tool is designed to generate XML starting from an XML schema (XSD). There is no way to feed it content from an XML file. What you can do is configure some predefined values for some elements and attributes (the elements need to be declared globally in the schema).

Go to the Options tab, in the upper section press New and pick the Namespace and element name. Select the new element item from the upper list and switch to the "Attribute values" tab. Press New in that section and pick the namespace and name of the attribute. Select the new attribute item from the middle list and add the desired values in the bottom, "Values" section.

Regards,
Adrian

Re: Generating sample xml from xsd

Posted: Fri May 15, 2020 7:41 pm
by vtai
Hi Adrian,
I've read your advice with interest.
But please how could I add the curent date to the value for the date time element instead of the default generated date (2006-05-04).
Regards
Tai

Re: Generating sample xml from xsd

Posted: Mon May 18, 2020 5:33 pm
by adrian
Hi,

You can't configure it to provide the current date, but you can manually enter a predefined specific date (which can be the current date).

Regards,
Adrian