Generate xml from xsd
Oxygen general issues.
-
- Posts: 9
- Joined: Wed Jan 23, 2008 2:57 pm
Generate xml from xsd
Hello,
if I generate a sample xml file from the this xsd:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="eTEIheader">
<xs:complexType>
<xs:sequence>
<xs:element ref="fileDesc"/>
</xs:sequence>
<xs:attributeGroup ref="attlist.eTEIheader"/>
</xs:complexType>
</xs:element>
<xs:attributeGroup name="attlist.eTEIheader">
<xs:attribute name="type" default="text"/>
<xs:attribute name="creator"/>
</xs:attributeGroup>
<xs:element name="fileDesc">
</xs:element>
</xs:schema>
I get the following result:
<?xml version="1.0" encoding="UTF-8"?>
<Incl xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:/F:/Studium/SFB441_C2/metadatenschema/eTEI_dtd_2-3/eTEI0.2.3.xsd"></Incl>
Shouldn't there be at least the elements eTEIheader, fileDesc, attlist.eTEIheader? Does Oxygen have problems with following the references?
if I generate a sample xml file from the this xsd:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="eTEIheader">
<xs:complexType>
<xs:sequence>
<xs:element ref="fileDesc"/>
</xs:sequence>
<xs:attributeGroup ref="attlist.eTEIheader"/>
</xs:complexType>
</xs:element>
<xs:attributeGroup name="attlist.eTEIheader">
<xs:attribute name="type" default="text"/>
<xs:attribute name="creator"/>
</xs:attributeGroup>
<xs:element name="fileDesc">
</xs:element>
</xs:schema>
I get the following result:
<?xml version="1.0" encoding="UTF-8"?>
<Incl xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:/F:/Studium/SFB441_C2/metadatenschema/eTEI_dtd_2-3/eTEI0.2.3.xsd"></Incl>
Shouldn't there be at least the elements eTEIheader, fileDesc, attlist.eTEIheader? Does Oxygen have problems with following the references?
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Generate xml from xsd
Post by sorin_ristache »
Hello,
I generated the following XML instance from the XML Schema that you posted:
As you can see the references to fileDesc and attlist.eTEIheader are followed correctly. I think you did not generate the XML instance that you posted from that XML Schema because the schema does not define an Incl element as in your XML instance.
Regards,
Sorin
I generated the following XML instance from the XML Schema that you posted:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<eTEIheader xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ftopic2752.xsd" type="text" creator="creator0">
<fileDesc>
</fileDesc>
</eTEIheader>
Regards,
Sorin
-
- Posts: 9
- Joined: Wed Jan 23, 2008 2:57 pm
Re: Generate xml from xsd
It works now. Somehow there was by default the wrong root-element selected (<Incl>).
If I use the option "Generate other options as comments" in the section Option>Choice-Groups, oxygen creates nested comments, which is not valid. Is there a bug?
If I use the option "Generate other options as comments" in the section Option>Choice-Groups, oxygen creates nested comments, which is not valid. Is there a bug?
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Generate xml from xsd
Post by sorin_ristache »
In the generated XML instance a choice is generated as comment when one of the other choices from the same group generates an element of the XML instance. If there is other choice nested in the commented choice that is also generated as comment then you have nested comments. That XML instance is not valid but detecting such cases in the generated XML instance is not very easy. We will think about how we can avoid this validation error in the XML instance.
Regards,
Sorin
Regards,
Sorin
-
- Posts: 1
- Joined: Mon Dec 01, 2008 7:22 am
Re: Generate xml from xsd
To generate whole sets of realistic test examples and cases can be done using some XSLT and refactoring of your information model from the XSD schema.
The tutorial on ingesting the XSD schema, generating a new content model template and then outputting sets of XML test cases can be found here:
http://wiki.oasis-open.org/cam/Generati ... s_from_XSD
Enjoy, DW
The tutorial on ingesting the XSD schema, generating a new content model template and then outputting sets of XML test cases can be found here:
http://wiki.oasis-open.org/cam/Generati ... s_from_XSD
Enjoy, DW
Jump to
- 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