Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: newbie xml xsd modelling problem

From: Martin Honnen <mahotrash@-----.-->
To: 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/


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent