- From: Jeni Tennison <jeni@jenitennison.com>
- Date: Wed, 12 Dec 2001 20:02:58 +0000
- To: Schema XML <xmlschema-dev@w3.org>
Hi Stanley, > As I know, the value of "default" attribute has a type "string", not > "QName". > > So, I don't think any Schema processor will try to resolve any > QName's contained in the default attribute value before adding it to > the associated element instance! Note that both "ref" and "type" > attributes are of type QName. It's a muddy area, but there's a difference between the type of the 'default' attribute on xs:attribute and the type of the value that's reported as the default of an attribute instance. According to the XML Schema Recommendation Part 1 at http://www.w3.org/TR/xmlschema-1/#sic-attrDefault, when a value for an attribute isn't given, the [schema normalized value] of the attribute information item is the canonical lexical representation of the {value constraint} value. To work out what the canonical lexical representation of the {value constraint} value is, the schema validator has to interpret the value according to the type of the attribute, normalizing spaces and so on. Once it's worked out what the value is, as whatever the type the attribute declared it as, then it can work out how it should be translated into its canonical lexical representation. For xs:boolean, for example, it's clear that given: <xs:attribute name="booleanAttr" type="xs:boolean" default="1" /> the [schema normalized value] of the booleanAttr attribute, if it's not specified in the schema, will be 'true'. The default of '1' is a possible lexical value for the value of boolean true; the canonical lexical representation of the value boolean true is 'true'. On the other hand, if you specified the attribute with: <xs:attribute name="stringAttr" type="xs:string" default="1" /> the default value would be '1'. That's why I mentioned the fact that there's no 'canonical lexical representation' specified for QNames in the Data types Recommendation. I think that the spirit of the XML Schema Data types Recommendation indicates that given: <xs:attribute xmlns:foo="http://www.example.com/foo" name="QNameAttr" type="xs:QName" default="foo:bar" /> the following elements should be treated in the same way. <foo xmlns:f="http://www.example.com/foo"> <bar QNameAttr="f:bar" /> <bar /> </foo> But it is not very well defined. It makes me wish that we could use the extended representation for QNames of {namespace-uri}local-name as the canonical lexical representation. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
Received on Wednesday, 12 December 2001 15:30:23 UTC