Page 1 of 1

Generating sample xml from xsd

Posted: Mon Dec 19, 2016 1:47 pm
by imran
down vote
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>

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>

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

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.