You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Peter Menzel <pe...@imise.uni-leipzig.de> on 2004/07/22 18:15:54 UTC

xml schema question

Hi all,

i am working on a xml schema and have the following problem, maybe 
somebody can help me.

i would like to have the follwoing elment with content:

<element>
    <aa/>
    <cc/>
    <bb/>
</element>

The elements aa and bb are required to be there and they may occur just 
one time. Other sub elements of element can occur many times. Especially 
the order of the elements is random, so i may not use xsd:sequence.

My xml schema snippet for this element:

<xsd:element name='element'>
   <xsd:complexType>
       <xsd:choice>
            <xsd:element ref='dd' minOccurs='0' maxOccurs='unbounded'/>
            <xsd:element ref='cc' minOccurs='0' maxOccurs='unbounded'/>
            <xsd:element ref='aa' minOccurs='1' maxOccurs="1"/>
            <xsd:element ref='bb' minOccurs='1' maxOccurs="1"/>
        </xsd:choice>
    </xsd:complexType>
</xsd:element>

Unfortunately this wont work.
xmllint says that the above xml document is not valid.

Has anybody any idea concerning this problem? Is it generally possible 
to mix elements in a complexType  with different minOccurs/maxOccurs ?

Greetings, Peter 


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: xml schema question

Posted by Chris Bowditch <bo...@hotmail.com>.
Peter Menzel wrote:

<snip/>

> My xml schema snippet for this element:
> 
> <xsd:element name='element'>
>   <xsd:complexType>
>       <xsd:choice>
>            <xsd:element ref='dd' minOccurs='0' maxOccurs='unbounded'/>
>            <xsd:element ref='cc' minOccurs='0' maxOccurs='unbounded'/>
>            <xsd:element ref='aa' minOccurs='1' maxOccurs="1"/>
>            <xsd:element ref='bb' minOccurs='1' maxOccurs="1"/>
>        </xsd:choice>
>    </xsd:complexType>
> </xsd:element>
> 
> Unfortunately this wont work.
> xmllint says that the above xml document is not valid.

You are unlikely to receive help for this question on this list. This list is 
about XSL-FO. Perhaps your question would be better suited to a XML Parser or 
Schema specific list.

> 
> Has anybody any idea concerning this problem? Is it generally possible 
> to mix elements in a complexType  with different minOccurs/maxOccurs ?

Yes this is possible, but not under xs:choice, I believe <xs:any> is the 
compositor you are looking for.

Chris


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org