- From: <bugzilla@wiggum.w3.org>
- Date: Mon, 03 Aug 2009 17:30:16 +0000
- To: www-xml-schema-comments@w3.org
http://www.w3.org/Bugs/Public/show_bug.cgi?id=7198 --- Comment #1 from C. M. Sperberg-McQueen <cmsmcq@blackmesatech.com> 2009-08-03 17:30:16 --- [Speaking for myself] It may depend on what you mean by the question "Then, can X have this attribute present (an inheritable attribute) in the instance document, and will this instance be considered valid?" For concreteness, consider your example, with an inheritable version of xml:lang, and let's assume that X is in some target namespace tns. (1) If you mean "Will the element instance <tns:X xml:lang="fr">Bonne chance!</tns:X> be valid against the declaration?", then I think the answer is no. If we validate the instance element against the declaration, then a partial list of the constraints checked will include: Schema Validity Assessment (Element), with the declaration given as the stipulated element declaration. Clause 1.1.2 leads to: Element Locally Valid (Element), again with the stipulated element declaration. Here, clause 5.2.1 leads us to: Element Locally Valid (Type), with xsd:string as the governing type definition. Here clause 3.1.1 says that the element must have no attributes other than xsi:type, xsi:nil, xsi:schemaLocation, or xsi:noNamespaceSchemaLocation, so the element instance is not valid against its governing type definition. (2) If you mean "Will the element instance <tns:X>Try again later</tns:X> be valid, even though it has an 'inherited' value for xml:lang?", then I think the answer is yes. The validation log goes along just as before, but when we hit Element Locally Valid (Type), with xsd:string as the governing type definition. Here clause 3.1.1 says that the element must have no attributes other than xsi:type, xsi:nil, xsi:schemaLocation, or xsi:noNamespaceSchemaLocation, and the element instance satisfies this clause. It also satisfies the other requirements, so the isntance is valid against type xs:string. And since the element also satisfies the remaining clauses of Element Locally Valid (Element) and Schema Validity Assessment (Element), the element instance is valid. ........ Note that the element declaration for X can refer to inherited attributes in the tests of its type alternatives, even if the assigned type is simple. So the element declaration <xsd:element name="X" type="xsd:string"> <xsd:alternative test="@xml:space='default'" type="xsd:anyType"/> </xsd:element> which assigns X either the type xsd:string or the type xsd:anyType, depending on the inherited value of xml:space. If users find it confusing that the type of X can depend on xml:space, but instances of X cannot carry the xml:space attribute, then it may be better practice to define a complex type with simple content, extending xsd:string by allowing the appropriate attributes. -- Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug.
Received on Monday, 3 August 2009 17:30:25 UTC