lius Posted November 7, 2006 Share Posted November 7, 2006 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 comment Share on other sites More sharing options...
hb_teddy Posted November 22, 2006 Share Posted November 22, 2006 <xsd:complexType><xsd:sequence> <xsd:element name="info" type="xsd:string" minOccurs="0" maxOccurs="1" /> <xsd:choice> <xsd:element name="error" type="xsd:string" /> <xsd:element name="fileNumber" type="xsd:string" /> </xsd:choice></xsd:sequence></xsd:complexType>hope it is not ugly Link to comment Share on other sites More sharing options...
lius Posted November 23, 2006 Author Share Posted November 23, 2006 hey, you just made my day! Thank you so much!It really works with a 'sequence'. But I don't quite understand why this is not allowed for 'all' groups.Anyway, thanks for your kind help, which was not ugly at all Link to comment Share on other sites More sharing options...
hb_teddy Posted November 23, 2006 Share Posted November 23, 2006 "all" has only one type of child element, that is "element". So if you put "choice" in "all", there will be an error. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now