- From: Michael Kay <mike@saxonica.com>
- Date: Fri, 24 Aug 2012 09:07:50 +0100
- To: xmlschema-dev@w3.org
- Message-ID: <50373656.8000506@saxonica.com>
I've tried to explain it twice and I'm having difficulty finding a third way to express it. The relevant rules are Validation Rule: Element Locally Valid (Element) clause 5 which says 5 The appropriate case among the following is true: 5.1 If D has a {value constraint}, and E has neither element nor character [children], and E is not ·nilled· with respect to D , then all of the following are true: 5.1.1 If E's ·governing type definition· is an ·instance-specified type definition·, then D.{value constraint} is a valid default for the ·governing type definition· as defined in Element Default Valid (Immediate) (§3.3.6.2). 5.1.2 The element information item with D.{value constraint}.{lexical form} used as its ·normalized value· is locally ·valid· with respect to the ·governing type definition· as defined by Element Locally Valid (Type) (§3.3.4.4). and Schema Information Set Contribution: Element Validated by Type, [schema normalized value] and [schema actual value], in particular: 1.1 If clause 5.1 of Element Locally Valid (Element) (§3.3.4.3) above has applied, then (the [schema normalized value] is) the {lexical form} of the {value constraint} The net effect of these rules is that the [schema actual value] of the element is taken from the default value given in the schema if and only if the element is empty (has no children). You seem to have convinced yourself that a different rule applies, something like "the [schema actual value] of the element is taken from the default value given in the schema if and only if the supplied value is invalid" but there is no basis for that in the specification. Michael Kay Saxonica On 24/08/2012 00:51, Costello, Roger L. wrote: > > Hello Michael, > > I am confused. The Title element is declared to be of type string, so > a valid value of Title is a string of length zero, right? According to > SAXON, that is the case. > > /Roger > > Answer: the value of Title is the empty string, not the default value. > > The reason is that the empty string is a valid value of the string data > > type. If you want Title to have the default value then you must > > explicitly enter the default value: <Title>Hello World</Title> > > WRONG. The default applies when the element is empty, not when it is > > invalid. > > Michael Kay > > Saxonica >
Received on Friday, 24 August 2012 08:08:10 UTC