Re: [xmlschema-dev] <none>

Hi,

Eamon.Galavan@risk.sungard.com wrote:

> 1.  How do I specify an unordered sequence (i.e. the equivalent of <all>
> with maxOccurs ="unbounded") in a schema
>
> e.g. so the following xml would be valid
>
> <chars>
>      <a/>
>      <a/>
>      <c/>
>      <b/>
>      <a/>
>      <b/>
>      <c/>
>      <b/>
> </chars>

Since you don't need internal grouping (all child elements grouped together)
you can achieve this but specifying a choice group with minOccurs="0" and
maxOccurs="unbounded":

<xs:choice minOccurs="0" maxOccurs="unbounded">
   <xs:element name="a" type="..."/>
   <xs:element name="b" type="..."/>
   <xs:element name="c" type="..."/>
</xs:choice>

> 2. How do I specify a schema that only validates a section of an xml file
> e.g. a schema that will validate <a> and <b> below only
>
> <chars>
>      <a/>
>      <I don't care what data is here/>
>      <b/>
>      <don't care about this either/>
> </chars>
>
> I have tried <any>, but any data I seemed to try to add to the xml file
> seem invalid, and if I didn't enter any data, I got an error saying the
> data is incomplete.

<any> is the way to go but make sure that the processContents attribute is
set to skip if you don't want the contents processed.

<xs:any processContents="skip">

BUT, remember that even the values you put as any need to be well-formed XML.
In your example above
<I don't care what data is here/> is not a valid XML element name.

Cheers,
/Eddie

Received on Tuesday, 12 February 2002 18:37:56 UTC