Validating unordered elements with additional requirements
This should cover W3C XML Schema, Relax NG and DTD related problems.
-
- Posts: 2
- Joined: Wed Jan 19, 2005 1:28 am
- Location: NJ
Validating unordered elements with additional requirements
Post by SwimsZoots »
Hi,
I have to validate an XML document where there is a parent element <Output>, which, if present must have one or both of the following child elements: <errors>, <mappings>. (max. 1 instance each, unordered).
Any ideas on what as possible schema would look like, if it is possible at all?
tia,
bob
I have to validate an XML document where there is a parent element <Output>, which, if present must have one or both of the following child elements: <errors>, <mappings>. (max. 1 instance each, unordered).
Any ideas on what as possible schema would look like, if it is possible at all?
tia,
bob
Try this
Hello
Maybe try would work:
Maybe try would work:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="output">
<xs:complexType>
<xs:choice>
<xs:sequence>
<xs:element ref="errors" minOccurs="1" maxOccurs="1"/>
<xs:element ref="mappings" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
<xs:sequence>
<xs:element ref="mappings" minOccurs="1" maxOccurs="1"/>
<xs:element ref="errors" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="errors"/>
<xs:element name="mappings"/>
</xs:schema>
-
- Posts: 2
- Joined: Wed Jan 19, 2005 1:28 am
- Location: NJ
Post by SwimsZoots »
Thanks a bunch. This helps a lot. Plus it gives me some ideas for other things I need to do.
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