This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 2630 - [DM] Default values of elements
Summary: [DM] Default values of elements
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Data Model 1.0 (show other bugs)
Version: Candidate Recommendation
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Norman Walsh
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-02 12:35 UTC by Michael Kay
Modified: 2007-12-17 19:51 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2006-01-02 12:35:57 UTC
In the rules for constructing a Data Model from a PSVI, it appears that some
surprising things happen when an element has a default value defined in the schema:

(a) if the element has a simple type, or a complex type with simple content,
then in the PSVI the default value will become the [schema normalized value] of
the node, which will therefore determine its string value and its typed value.
However, the PSVI does not appear to contain any character information items
representing the default value, so there will be no text node children in the
XDM representation. This means that it is no longer true that the string value
of an element is always the same as the concatenation of its descendant text
nodes. The consequences of breaking this invariant are unclear.

(b) if the element has a complex type (default values are allowed for mixed
content models) then it seems we ignore the default value entirely. 

In fact, the schema spec seems unclear here. In section 3.3.1 it says that the
supplied default value becomes the [schema normalized value], but in the
definition of [schema normalized value] it says that for an element with mixed
content the [schema normalized value] is always absent. But whether the default
value is represented by the [schema normalized value] or not, our mapping from
the PSVI ignores it in the case of mixed content.  

Michael Kay
Comment 1 Michael Kay 2006-01-20 18:13:18 UTC
Please see also the related XML Schema bugzilla entry

http://www.w3.org/Bugs/Public/show_bug.cgi?id=2632
Comment 2 Michael Kay 2006-02-17 19:12:58 UTC
Action A-288-04 asks me and Norm to propose wording to fix this issue.

In fact, I think section 6.2.4 of the Data Model spec is almost there. Under the
"children" property, I propose that we add, before the last paragraph:

<new>
The effect of the above rules is that where a fixed or default value for an
element is defined in the schema, and the element takes this default value, a
text node will be created to contain the value, even though there are no
character information items representing the value in the PSVI. The position of
this text node relative to any comment or processing instruction children is
implementation-dependent.

[XML Schema] also permits an element with mixed content to take a default or
fixed value (which will always be a simple value), but at the time of writing it
is unclear how such a defaulted value is represented in the PSVI.
Implementations therefore [may] represent such a default value by creating a
text node, but are not required to do so.
</new>
Comment 3 Norman Walsh 2006-03-14 16:04:30 UTC
Fixed.
Comment 4 Michael Kay 2007-12-17 19:51:24 UTC
Please note that bug #5319 is effectively a continuation of this issue.