Generating sample xml from xsd

This should cover W3C XML Schema, Relax NG and DTD related problems.
imran
Posts: 1

Generating sample xml from xsd

Mon Dec 19, 2016 1:47 pm

-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?
adrian
Posts: 2326

Re: Generating sample xml from xsd

Mon Dec 19, 2016 4:35 pm

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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Return to “XML Schemas”

Who is online

Users browsing this forum: No registered users and 1 guest