Variable order of elements in xsd
This should cover W3C XML Schema, Relax NG and DTD related problems.
Variable order of elements in xsd
Hallo,
this is my code:
<xs:element name="layer">
<xs:complexType>
<xs:choice>
<xs:element name="paragraph" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="position" type="xs:string"/>
<xs:attribute name="alignment" type="xs:string"/>
<xs:attribute name="character_size" type="xs:decimal"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="image" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="position" type="xs:string"/>
<xs:attribute name="scale" type="xs:decimal"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="model" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="position" type="xs:string"/>
<xs:attribute name="rotate" type="xs:string"/>
<xs:attribute name="scale" type="xs:decimal"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
The problem is that I don't know and I don't wanna specify when the elements "image", "paragraph and "model" accure. I'm looking for a way to have a variable order. The Problem is, that the number of times the element accure is variable, too. It could be like this for example:
image
paragraph
image
image
Without "model" at all.
Thanx for the solution in advance.
-ODY
this is my code:
<xs:element name="layer">
<xs:complexType>
<xs:choice>
<xs:element name="paragraph" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="position" type="xs:string"/>
<xs:attribute name="alignment" type="xs:string"/>
<xs:attribute name="character_size" type="xs:decimal"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="image" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="position" type="xs:string"/>
<xs:attribute name="scale" type="xs:decimal"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="model" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="position" type="xs:string"/>
<xs:attribute name="rotate" type="xs:string"/>
<xs:attribute name="scale" type="xs:decimal"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
The problem is that I don't know and I don't wanna specify when the elements "image", "paragraph and "model" accure. I'm looking for a way to have a variable order. The Problem is, that the number of times the element accure is variable, too. It could be like this for example:
image
paragraph
image
image
Without "model" at all.
Thanx for the solution in advance.
-ODY
Hi,
You have specified a model like
( (paragraph)* | (image)* | (model)* )
that is either zero or more pharagraph or zero or more image or zero or more mode.
From your message it seems that you want
(paragraph | image | model)*
That is XML Schema notation will look like
Best Regards,
George
You have specified a model like
( (paragraph)* | (image)* | (model)* )
that is either zero or more pharagraph or zero or more image or zero or more mode.
From your message it seems that you want
(paragraph | image | model)*
That is XML Schema notation will look like
Code: Select all
<xs:element name="layer">
<xs:complexType>
<xs:choice maxOccurs="unbounded" minOccurs="0">
<xs:element name="paragraph">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="position" type="xs:string"/>
<xs:attribute name="alignment" type="xs:string"/>
<xs:attribute name="character_size" type="xs:decimal"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="image">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="position" type="xs:string"/>
<xs:attribute name="scale" type="xs:decimal"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="model">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="position" type="xs:string"/>
<xs:attribute name="rotate" type="xs:string"/>
<xs:attribute name="scale" type="xs:decimal"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
George
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