Jump to content

xsd:all containing xsd:choice

Recommended Posts

Hi,I thought I knew Schema but obviously I'm not as smart as I thought I was :) What I want to describe in my Schema is the following structure:

<info>this is an information</info><error>this is an error</error><fileNumber>12345</fileNumber>

The info-tag is to be optional. error and fileNumber must not appear at the same time (choice).I tried this, which is not valid, because "all" must only contain elements:

<xsd:all>	<xsd:element name="info" type="xsd:string" minOccurs="0" maxOccurs="1" />	<xsd:complexType>		<xsd:choice>			<xsd:element name="error" type="xsd:string" />			<xsd:element name="fileNumber" type="xsd:string" />		</xsd:choice>	</xsd:complexType></xsd:all>

Right now my only solution looks like this:

<xsd:all>	<xsd:element name="info" type="xsd:string" minOccurs="0" maxOccurs="1" />	<xsd:element name="container">		<xsd:complexType>			<xsd:choice>				<xsd:element name="error" type="xsd:string" />				<xsd:element name="fileNumber" type="xsd:string" />			</xsd:choice>		</xsd:complexType>	</xsd:element></xsd:all>

But I don't want this ugly container-element.Does anyone have an idea how to solve this? Thanks in advance!Lius

Link to post
Share on other sites
  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...