RE: help with xsd

> 
> I am a new-user of xsd, and at the moment I got confusing 
> with some stuff Could someone please correct me if we can 
> declare something like:
> 
> <xsd:sequence>
>    <xsd:element name="var_name" type="xsd:string"/>
> 
> <!-- this means optional. which is similar to <xsd:element 
> name="var_name" type="xsd:string" use="optional"/> 
> --> 
> 
>    <xsd:element name="var_value" type="xsd:integer" 
> use="required"/> </xsd:sequence>
> 
> In some stuff, it is mentioned that  'use="optional/required" 
> ' can be added to attribute only. but elements are instances 
> of attributes . Is this correct?
> 

There are many differences in the way attributes and elements are described
in XML Schema (probably more differences than are strictly necessary).

With attributes, you use use="optional|required" to indicate optionality.

With elements, you use minOccurs="0|1|....". The difference of course is
that elements can appear more than once, so it's possible to say things such
as minOccurs="4", though this rarely arises in practice.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 

Received on Friday, 15 January 2010 09:30:01 UTC