W3C home > Mailing lists > Public > public-forms@w3.org > June 2007

Nillable complex type with simple content

From: Erik Bruchez <ebruchez@orbeon.com>
Date: Mon, 04 Jun 2007 18:23:36 -0700
Message-ID: <4664BB18.5070004@orbeon.com>
To: public-forms@w3.org
CC: www-forms-editor@w3.org


I am sending this following an interesting comment about schema types
from a user.

XForms 1.1 specifies that:

   "The type model item property associates a datatype (as defined in
    [XML Schema part 2]) with the string-value (as defined in [XPath
    1.0]) of an instance node. The datatype being associated can be
    obtained from a simpleType definition or a simpleContent definition
    from a complexType. If the datatype cannot be obtained as just
    described, then the Default Value of xsd:string is used."

Now, I assume that this means I can write something like this:

     <xs:element name="state-element">
                 <xs:extension base="test:state-type">
                    <xs:attribute name="code" type="xs:integer"/>

use it as follows:

     <xforms:bind nodeset="state" type="test:state-element"/>

and I should expect the validator to validate the content of my
<state> instance element using the datatype part of my xs:element

First, is this correct?

Second, what if my type is as follows instead:

     <xs:element name="state-element" nillable="true">
                 <xs:extension base="test:state-type">
                    <xs:attribute name="code" type="xs:integer"/>

and my instance element:

   <state xsi:nil="true">CA</state>

Is XForms supposed to honor xsi:nil in this case, and accept an empty
content for <state>?

My guess is that it is not in fact part of the dataype. XML Schema says:

   "If {nillable} is true, then an element may also be ·valid· if it
    carries the namespace qualified attribute with [local name] nil
    from namespace http://www.w3.org/2001/XMLSchema-instance and value
    true (see xsi:nil (§2.6.2)) even if it has no text or element
    content despite a {content type} which would otherwise require

So the nil thing seems to apply to the validity of the element, not of
its datatype part.

However, after all the form author is binding a nillable element type
to an XForms instance element, and it is not very intuitive that
xsi:nil won't work in this case.

Whatever the answer, I think that it would be very valuable to clarify
this in the spec.


Orbeon Forms - Web Forms for the Enterprise Done the Right Way
Received on Tuesday, 5 June 2007 01:23:41 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:13:52 UTC