![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: newbie xml xsd modelling problem >Thread Next - Re: newbie xml xsd modelling problem Re: newbie xml xsd modelling problemTo: NULL Date: 4/4/2005 12:11:00 PM Tis Veugen wrote: >>><xsd:complexType name="ct1"> >>> <xsd:choice> >>> <xsd:sequence> >>> <xsd:attribute name="type" type="st1" fixed="v1"/> >>> <xsd:element name="str" type="string"/> >> >>Have you actually tried to use that schema with a validating XML parser or >>a schema parser? It would tell you that the xsd:attribute is not allowed >>inside of the xsd:sequence. > > > The XRay XML Editor does not complain about it. > According to my book , XML Developer's Guide, it's allowed. That is odd, here is the official documentation of the sequence element: <http://www.w3.org/TR/xmlschema-1/#element-sequence> it says the allowed content of sequence is: Content: (annotation?, (element | group | choice | sequence | any)*) so an attribute declaration does not belong there, you can start with an optional annotation and then element or group or choice or nested sequence or any (element). > Otherwise, how could such a choice of 3 possibilities regarding attributes > be modelled? The choice element is not for attributes but for a choice model for complex element content. As for attributes you can declare an attribute to be optional, you can declare a default value or even a fixed value but you cannot model constraints between a possible attribute value and the element content model as you seem to try to do. Not with the W3C schema language in its current version at least. -- Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/ | ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
