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 2632 - Default value and [schema normalized value]
Summary: Default value and [schema normalized value]
Status: CLOSED FIXED
Alias: None
Product: XML Schema
Classification: Unclassified
Component: Structures: XSD Part 1 (show other bugs)
Version: 1.1 only
Hardware: All All
: P4 normal
Target Milestone: ---
Assignee: C. M. Sperberg-McQueen
QA Contact: XML Schema comments list
URL:
Whiteboard: important, easy
Keywords: resolved
Depends on:
Blocks:
 
Reported: 2006-01-03 15:09 UTC by Sandy Gao
Modified: 2009-04-20 21:49 UTC (History)
2 users (show)

See Also:


Attachments

Description Sandy Gao 2006-01-03 15:09:26 UTC
Section 3.3.1 of Part 1 says:

If default is specified, and if the element being ·validated· is empty, then
the canonical form of the supplied constraint value becomes the [schema
normalized value] of the ·validated· element in the ·post-schema-validation
infoset·.

But the definition of [schema normalized value] says:

1 If clause 3.2 of Element Locally Valid (Element) (§3.3.4) and Element
Default Value (§3.3.5) above have not applied and either the ·type
definition· is a simple type definition or its {content type} is a simple
type definition, then the ·normalized value· of the item as ·validated·.
2 otherwise ·absent·.

which implies that if the type definition is a complex type with complex
content, then the schema normalized value is always absent.

There seems to be a contradiction here: can an element with mixed content
have a [schema normalized value], or not?

Furthermore, the definition of [schema normalized value] appears to say that
the [schema normalized value] will always be ·absent· if Element Default
Value (§3.3.5) applies, whereas Element Default Value (§3.3.5) says that in
this situation the [schema normalized value] will be the canonical lexical
representation of the {value constraint} value. They can't both be right...

see: http://lists.w3.org/Archives/Public/xmlschema-dev/2006Jan/0000.html
Comment 1 Sandy Gao 2006-01-03 15:24:15 UTC
> Section 3.3.1 of Part 1 says: ...
> But the definition of [schema normalized value] says: ...
> There seems to be a contradiction here: can an element with mixed content
> have a [schema normalized value], or not?

Agree, there is a contradiction. I think 3.3.1 is too loosely specified. The
intention is that [schema normalized value] is only available for simple
type/contnet values. When a default value of a mixed content is applied, it
should not be reflected in [schema normalized value].

Propose to change in 3.3.1 from

"the canonical form of the supplied constraint value becomes the [schema
normalized value] of the ·validated· element in the ·post-schema-validation
infoset·"

to

"the element is treated as if the canonical form of the supplied constraint
value was used as the content of the element."

> Furthermore, the definition of [schema normalized value] ...
> They can't both be right...

Agree again. The intention is that [schema normalized value] does get the
default value in this case.

Propose to change the description of [schema normalized value] to

"The appropriate case among the following:
1 If clause 3.2 of Element Locally Valid (Element) (§3.3.4) above is satisfied,
then absent.
2 Otherwise if clause 5.1 of Element Locally Valid (Element) (§3.3.4) above is
satisfied, then the canonical lexical representation of the {value constraint}
value.
3 Otherwise if either the ·type definition· is a simple type definition or its
{content type} is a simple type definition, then the ·normalized value· of the
item as ·validated·.
4 Otherwise absent."

And change clause 1 of the description of [schema specified] to

"If the item is ·valid· with respect to an element declaration as per Element
Locally Valid (Element) (§3.3.4) and clause 5.1 of Element Locally Valid
(Element) (§3.3.4) above is satisfied, then schema."
Comment 2 Michael Kay 2006-01-03 16:11:31 UTC
>"the element is treated as if the canonical form of the supplied constraint
value was used as the content of the element"

-- does this mean that character information items are added to the PSVI -
something that doesn't seem to happen at the moment?

-- if so, where are they added relative to any existing comment or PI children?

The answers affect QT, which builds a data model from the PSVI.

Michael Kay
Comment 3 Dave Peterson 2006-01-03 19:14:45 UTC
(In reply to comment #1)

> Propose to change the description of [schema normalized value] to
> 
> "The appropriate case among the following:

> 2 Otherwise if clause 5.1 of Element Locally Valid (Element) (§3.3.4) above is
> satisfied, then the canonical lexical representation of the {value constraint}
> value.

This can't fly as is if we are to completely eliminate canonical representations from
schema processing, which IIRC is our stated intent.
Comment 4 Michael Kay 2006-01-20 18:14:41 UTC
Please see also the related XDM bugzilla entry

http://www.w3.org/Bugs/Public/show_bug.cgi?id=2630
Comment 5 C. M. Sperberg-McQueen 2009-03-13 15:53:42 UTC
The WG agreed on its call today to reopen this issue, pending agreement on
(1) an erratum for XSD 1.0 and (2) a clarification for XSD 1.1.

The draft erratum is at 

  http://www.w3.org/XML/Group/2004/06/xmlschema-1/structures-1.0-e1-56.html

The email cover letter is at 

  http://lists.w3.org/Archives/Member/w3c-xml-schema-ig/2009Feb/0015.html

We considered the erratum today and concluded that in section 3.3.1 we need to
add a clarification (perhaps in the form of a note) that the element is treated
as if it had content *for purposes of calculating PSVI infoset contributions* like
[schema normalized value], not for other purposes.  That is, the element doesn't
have character information items in the input, and it won't in the PSVI, either.

Editors to draft this amendment to the erratum, and also a parallel editorial
proposal for 1.1.
Comment 6 C. M. Sperberg-McQueen 2009-04-16 21:14:16 UTC
Here is a proposal for the desired clarification.  

(1) In 3.3.1 of Structures, in the paragraph beginning "{value
constraint}", change the sentence which now reads

    If a {value constraint} with {variety} = default is present,
    and if the element being ·validated· is empty, then the
    element is treated as if {value constraint}.{lexical form}
    was used as the content of the element.

to read

    If a {value constraint} with {variety} = default is present,
    and if the element being ·validated· is empty, then for
    purposes of calculating the [schema normalized value] and
    other contributions to the post-schema-validation information
    set, the element is treated as if {value constraint}.{lexical
    form} was used as the content of the element.

(2) Before the existing Note following that parargraph insert a
second Note:

    Note: when a default value is supplied and used, as described
    in the second sentence of the preceding paragraph, the
    default value is used to calculate the [schema normalized
    value], etc., but the actual content of the element is not
    changed: the element was empty in the input information set,
    and it remains empty in the PSVI.

Comment 7 Sandy Gao 2009-04-20 21:49:38 UTC
During its 2009-04-17 telecon, the schema WG adopted the proposal in comment #6 to address this issue, with one amendment. The amendment is to change the new note to read:

    Note: When a default value is supplied and used, as described
    in the second sentence of the preceding paragraph, the default
    value is used to calculate the [schema normalized value], etc.,
    but the actual content of the element is not changed: the element
    contained no character information items in the input information
    set, and it contains none in the PSVI.

With these changes, the WG believes that the issue raised in this bug report is addressed. I'm marking this RESOLVED accordingly.

I'm also CLOSING the bug, given that this bug was reopened by the WG.

I'm also marking this bug as "1.1 only". Bug 6836 was opened to track the erratum for 1.0.