[Bug 5472] [XQuery 1.1] Requirement: validation by type

http://www.w3.org/Bugs/Public/show_bug.cgi?id=5472

           Summary: [XQuery 1.1] Requirement: validation by type
           Product: XPath / XQuery / XSLT
           Version: Working drafts
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery 1.1
        AssignedTo: jonathan.robie@redhat.com
        ReportedBy: mike@saxonica.com
         QAContact: public-qt-comments@w3.org


I am raising this requirement on behalf of a Saxonica customer. Saxon
implements a pragma that allows type-based validation. This user is making
extensive use of the facility, which they find invaluable for processing FpML
documents in particular, and they have asked me to propose adding it to the
language.

Syntax for the facility might be something like

"validate" "as" type-name { Expr }

The effect is to validate Expr as an instance of the specified simple or
complex type (which must be a type defined in the static context). Detailed
semantics should be the same as validation-by-type in XSLT 2.0, see
http://www.w3.org/TR/xslt20/#validation-xsl-type

(The XSLT 2.0 capability allows validation of attributes, as well as elements.
This is useful, but not essential).

There are two main use-cases for this facility:

(a) where the vocabulary design places heavy reliance on xsi:type to
distinguish different document types using the same element names (as is the
case with FpML)

(b) where the schema makes extensive use of local element declarations with
global types: in this situation validation based on the element name alone is
not possible.

Note that as far as XML Schema is concerned, specifying a type name rather than
an element name as the parameter driving validation is very much a recognized
part of the specification.

Some use cases can be achieved by specifying "validate lax" and putting an
xsi:type attribute on the element to be validated. However, this doesn't have
equivalent semantics in all cases; in some cases the xsi:type attribute might
be unwanted or disallowed by a DTD; and it doesn't lend itself readily to
static type-checking.

Received on Monday, 11 February 2008 11:33:01 UTC