about the compositor in schema

N

news

Hi everyone
I am now trying to create a schema for the XML document which have the
following structure:
In the XML document, there should be a element called book. And the
sub-elements of book should be author or editor, title, publisher, year, and
so on, which means, in the XML document, either author or editor must
appear, but they can not both appear.And the sub-elements can be in any
order.I try to use <xsd:all> and <xsd:choice> to solve the problem, but
<xs:all> cannot be embedded within another compositor.So the following
schema is invalid:

<xsd:complexType name="book_type">
<xsd:all>
<xsd:choice>
<xsd:element name="author"type="xsd:string"/>
<xsd:element name="editor"type="xsd:string"/>
</xsd:choice>
<xsd:element name="title" type="xsd:string"/>
<xsd:element name="publisher" type="xsd:string"/>
<xsd:element name="year" type="year_type"/>
</xsd:all>
</xsd:complexType>

Does anybody know how to describe a XML document with the above structure
using schema?
Any suggestion will be appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,835
Latest member
lila30

Latest Threads

Top