XML Instance Generation
-
- Posts: 58
- Joined: Fri Nov 11, 2005 6:35 am
XML Instance Generation
Post by kingargyle »
Also, it would be nice if an element has an enumerated type that a random value from the enumeration could be populated into the instance. XML Spy has this feature, and I find it highly useful. At this point, I need to go back to XML Spy just to generate the XML instances, and it's the only reason I go back into XML Spy at all.
It would be nice to have the wizard appear more like the wizard that shows up in the Standalone version to allow the options to be changed on a per instance basis.
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
The XML Instance Generator preference options apply only to the XML Instance Generator tool available from XML Tools -> Generate Sample XML Files. When creating new XML documents the options are presented in the New XML Document wizard: Add optional content and Add first choice particle.
When the range of values of an element/attribute is specified with an enumeration in the XML Schema the XML Instance Generator tool uses one of the values of the enumeration as the value of the element/attribute in the generated instances. So you will not have to use XML Spy for that

Regards,
Sorin
-
- Posts: 58
- Joined: Fri Nov 11, 2005 6:35 am
Post by kingargyle »
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
There is no way to do a batch generation of XML instances. I will add a request for that. Please send us a schema for which the generated instance does not contain a value of the enumeration in the element of type enumeration.
Regards,
Sorin
Post by stefan »
See more info here:
http://www.oxygenxml.com/doc/ug-oxygenE ... rator.html (for Eclipse)
http://www.oxygenxml.com/doc/ug-oxygen/ ... rator.html (for standalone).
In order to get random values for elements/attributes please make sure you specify Random for "Values of elements and attributes" field from the "Options" tab.
-
- Posts: 58
- Joined: Fri Nov 11, 2005 6:35 am
Post by kingargyle »
I work for STAR (Standards for Technology in Automotive Retail), and need to make sure that samples are in synch with the schemas that are being developed for members.
http://www.starstandard.org/
-
- Posts: 58
- Joined: Fri Nov 11, 2005 6:35 am
Post by kingargyle »
Also, slight bug with the XML Tools -> XML Instance Generator. If you delete the prefix for the namespace, oxygen tries to generate a default namespace that lookslike xmlns:="http...." basically it still tries to generate the prefix format. It works correctly under the XML Wizard when specifying a schema.
If you need sample schemas to duplicate this issue, you can download them from
http://www.starstandard.org
The XML Tools -> XML Instance Generator does populate the code lists correctly.
Plus it would still be nice to be able to run the instance generator from an ant task.
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
The XML instance generator is a tool for generating full XML documents which are valid against the specified schema while the XML wizard only generates a partial document which you intend to fill in manually. You should use the wizard only for creating a new document, that is a document which contains only the root element generated automatically and also possibly some optional elements controlled by the two checkboxes and which you want to edit manually in an editor panel in oXygen.kingargyle wrote:I have narrowed the problem with Instance generation down to just using the Oxygen XML wizard to create a new file. If you use this wizard in Eclipse with Oxygen 8, and specify a schema to be used to generate the XML, it will not populate any code lists.
...
The XML Tools -> XML Instance Generator does populate the code lists correctly.
Thank you for reporting it. We will fix it in the next version.kingargyle wrote:Also, slight bug with the XML Tools -> XML Instance Generator. If you delete the prefix for the namespace, oxygen tries to generate a default namespace that lookslike xmlns:="http...." basically it still tries to generate the prefix format.
I added an enhancement request with that.kingargyle wrote:Plus it would still be nice to be able to run the instance generator from an ant task.
Regards,
Sorin
-
- Posts: 58
- Joined: Fri Nov 11, 2005 6:35 am
Post by kingargyle »
Again this is in eclipse 3.2.1 and Oxygen 8.
Thanks for looking into the other two items.
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
Regards,
Sorin
-
- Posts: 58
- Joined: Fri Nov 11, 2005 6:35 am
Post by kingargyle »
If you are going to keep the behavior different between the two ways to generate the XML Instance within Oxygen, then I would suggest clearly stating that enumerations won't be included in the File -> New -> XML File wizard generates. As it is now, it's not clear.
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
Regards,
Sorin
Re: XML Instance Generation
Post by stefan »
Details: http://www.oxygenxml.com/doc/ug-oxygen/ ... rator.html
Video demonstration: http://www.oxygenxml.com/demo/GenerateS ... Files.html
You can call the XML instance generator from an ANT task using the following example:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<project>
<target name="generate">
<java classname="ro.sync.xml.generator.XMLInstanceGenerator">
<classpath>
<pathelement path="lib/log4j.jar"/>
<pathelement path="lib/xercesImpl.jar"/>
<pathelement path="lib/oxygen.jar"/>
<pathelement path="lib/resolver.jar"/>
</classpath>
<arg value="path_to_your_configuration_file.xml"/>
<arg value="-verbose"/>
</java>
</target>
</project>
-
- Posts: 6
- Joined: Wed Nov 29, 2006 8:43 am
Re: XML Instance Generation
Post by chrisprobert »
When generating an instance, we are checking the boxes for optional elements and attributes, but seemingly still get only mandatory elements in the output. Doing the exact same thing with 9.3 gives all of the optional elements.
Any suggestions as to what may be causing, or a workaround in version 10 (those that have upgraded can't go back due to the alteration of the license structure, so we are relient on those still on 9.3 at the moment)
Thanks
Chris
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: XML Instance Generation
Post by sorin_ristache »
I am sorry, I cannot reproduce the problem. When I select the option for optional elements/attributes the generated XML instances contain the optional elements/attributes. When I unselect the option the optional elements/attributes are not generated. Please post a sample XML Schema for reproducing the problem.
Regards,
Sorin
-
- Posts: 6
- Joined: Wed Nov 29, 2006 8:43 am
Re: XML Instance Generation
Post by chrisprobert »
Yes, it seems it is a strange corner case. Here is an example schema that shows the behaviour. I only seem to see the behaviour in nested structures such as the one in the schema below. The schema we were having problems with was large and complex so this is a cut down example to show the problem. You should notice that even with the check box for optional elements selected, you still only get the mandatory.
We don't see the same problem with 9.3.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.example.com/chrisprobert"
targetNamespace="http://www.example.com/chrisprobert"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:element name="TestElement" type="TestType"/>
<xs:complexType name="TestType">
<xs:sequence>
<xs:element name="CustomerList" type="CustomerListType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="CustomerListType">
<xs:sequence>
<xs:element name="Customer" type="CustomerType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="CustomerType">
<xs:sequence>
<xs:element name="LocationList" type="LocationListType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LocationListType">
<xs:sequence>
<xs:element name="Location" type="NameAddressType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="NameAddressType">
<xs:sequence>
<xs:element name="Name" type="xs:string"/>
<xs:element name="AddressLine" type="xs:string"/>
<xs:element name="TelephoneNum" type="xs:string" minOccurs="0"/>
<xs:element name="MobileNum" type="xs:string" minOccurs="0"/>
<xs:element name="FaxNum" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<TestElement xmlns="http://www.example.com/chrisprobert"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.example.com/chrisprobert file:/C:/cprobert/oxygen/testing/Test.xsd">
<CustomerList>
<Customer>
<LocationList>
<Location>
<Name>Name0</Name>
<AddressLine>AddressLine0</AddressLine>
</Location>
<Location>
<Name>Name1</Name>
<AddressLine>AddressLine1</AddressLine>
</Location>
</LocationList>
</Customer>
<Customer>
<LocationList>
<Location>
<Name>Name2</Name>
<AddressLine>AddressLine2</AddressLine>
</Location>
<Location>
<Name>Name3</Name>
<AddressLine>AddressLine3</AddressLine>
</Location>
</LocationList>
</Customer>
</CustomerList>
</TestElement>
Chris
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: XML Instance Generation
Post by sorin_ristache »
Thank you for the sample XML Schema. Now I can reproduce the problem and we will fix it probably in the next version of Oxygen. Unfortunately there is no workaround that forces generating optional elements from your schema.
Regards,
Sorin
-
- Posts: 6
- Joined: Wed Nov 29, 2006 8:43 am
Re: XML Instance Generation
Post by chrisprobert »
Do you have a timescale for this next release? The problem we have is that we have two developers with version 10 licenses, who need this functionality. They tried installing 9.3 but their licenses aren't backwards compatible and won't work with version 9.
Any suggestions as to what we should do in the meantime? I guess we could install 9.3 and use trial licenses until the update to 10 is available?
Thanks,
Chris
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: XML Instance Generation
Post by sorin_ristache »
Regards,
Sorin
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: XML Instance Generation
Post by sorin_ristache »
I just sent you by email a download link for a preview of Oxygen 10.1 that includes a fix for the reported problem and also other small improvements in the tool for generating XML instances of XML Schema.chrisprobert wrote:Do you have a timescale for this next release? The problem we have is that we have two developers with version 10 licenses, who need this functionality.
Regards,
Sorin
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re:
Post by sorin_ristache »
You can call the XML instance generator tool in an Ant script as described above or you can run the tool from a command line using the script schemaDocumentation.bat (schemaDocumentation.sh on Linux and Mac OS X). The script accepts as parameter an XML config file created with the Export Settings button of the dialog box used in the Oxygen GUI for generating XML instances. This button exports all the option values set in the dialog as an external file.kingargyle wrote:Also, is there a way to do a batch generation or call the generation from an ANT task? I have about 120 sample instances I need to generate, and doing them by hand is tedious.
Regards,
Sorin
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service