W3C home > Mailing lists > Public > public-qt-comments@w3.org > February 2004

Validation in 3.7.3.3 Document Node Constructors

From: Jonathan Robie <jonathan.robie@datadirect.com>
Date: Tue, 10 Feb 2004 16:54:32 -0500
Message-ID: <40295318.7020601@datadirect.com>
To: XML Query Comments <public-qt-comments@w3.org>

Section 3.7.3.3 of the XQuery specification says that for
document constructors, "No schema validation is performed on the
constructed document." This seems inconsistent with implicit  
validation of elements. Consider the following element
constructor.

<person>
   {
      $that/name,
      $that/address,
      $that/shoesize
   }
</person>

If the person element is in the ISSD, this is validated. Now observe
what happens if this element is placed in a document node.

document
{
  <person>
    {
      $that/name,
      $that/address,
      $that/shoesize
    }
  </person>
}

Under the current language definition, the &lt;person>
element would be validated by its own constructor, and an error
would be raised if validation fails. Then the validated
<person> element would be copied under a new document node and
its type annotation would be changed to xdt:untyped. If element
constructors are implicitly validated, users will expect elements
in document nodes to be valid. Two possibilities seem
reasonable:

1. Copy the content directly to the document node
    constructor, preserving the types of child elements. This is
    simpler, but does not enforce identity
    constraints.

2. Copy the content directly to the document node
    constructor, preserving the types of child elements, then apply
    identity constraints to the document. This adds complexity, but
    ensures that the resulting document is schema valid.

The status quo does not seem reasonable.

Jonathan
Received on Tuesday, 10 February 2004 16:57:21 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:17 UTC