Problem with XForms 1.0 Basic Profile document when used with XFo rms Full processor

In "3 Conformance", the XForms 1.0 Basic Profile CR [1] says 
  XForms Basic Profile processors may implement a subset of an XML Schema
processor 
  [XML Schema part 1], [XML Schema part 2], requiring only what is necessary
to process 
  the attribute xsi:type on instance data for simpleTypes only and the type
model 
  item property for simpleTypes only.

In "3.3.1 The model Element", the XForms 1.0 REC [2] says
  Optional list of xsd:anyURI links to XML Schema documents outside this
model element. 
  The XForms Processor must process all Schemas listed in this attribute.

My understanding is that the Basic Profile changes this "must" to either a
"must not" or perhaps a "should not" for XForms Basic.
In any case, I assume that the schema attribute (and similarly, the embedded
xsd:schema element) are allowed in documents processed by an XForms Basic
processor, but are to be ignored.

Now, consider the following case where an instance contains an element with
a simple value (such as a decimal or a time) and a boolean attribute:

  <time precise="true">06:00:00</time>

The goal of adding an attribute to an element of simple type content is
common, and in fact the first qustion in a popular XML Schema FAQ [3] shows
that it is in fact, a frequently-asked question.  The cited FAQ then gives a
complexType definition extending a simple type and adding an attribute.

Here is a complete XForms Full example, using XML Schema, a sample instance
document, and an XHTML 1 document with XForms controls, using the XML
Schema.  It relies on the XML Schema referred to from the model to define
the type of the attribute as boolean, so that the XForms Processor may
display it as a checkbox.

XForms Basic does not interpret the schema attribute, but it does "process
... type model item property for simpleTypes only" so we can add
  <xf:bind ref="my:length/@my:precise" type="xsd:boolean" />
to the model, and both Full and Basic XForms Processors will display the
attribute as a boolean (for example, as a checkbox in a graphical user
interface).

Note that the base type of the element, xsd:time, is also one that XForms
processors may choose to use for display purposes, perhaps by showing a time
chooser (see "8.1.2 The Input Element" [4]).  So, the natural next step
would be to bind that type to the node, as follows:
  <xf:bind ref="my:length" type="xsd:time" />
This will indeed work in XForms Basic, because it will process the type
model item property, and xsd:time is an XML Schema simpleType and is in the
list of types to be processed by XForms Basic.

Unfortunately, XForms Full processors have already interpreted the XML
Schema specified by the model schema attribute, and have a conflicting type.

Therefore, I believe that it is difficult to create XForms Full profile
documents that also work in XForms Basic, unless some subtyping allowances
are introduced into the consistency checking performed by the type model
item property.

Leigh.

-------------------precision.xml---------------------
  <?xml version="1.0" ?>
  <data xmlns="http://www.example.com">
    <time precise="true">06:00:00</time>
  </data>
---------------------precision.xsd-----------------------
  <?xml version="1.0" ?>
  <xsd:schema xmlns:my="http://www.example.com"
	      targetNamespace="http://www.example.com"
	      xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
	      elementFormDefault="qualified">
    <xsd:element name="data">
      <xsd:complexType>
	<xsd:sequence>
	  <xsd:element ref="my:time" />
	</xsd:sequence>
      </xsd:complexType>
    </xsd:element>
    <xsd:element name="time" type="my:preciseTime"/>
    <xsd:complexType name="preciseTime">
      <xsd:simpleContent>
	<xsd:extension base="xsd:time">
	  <xsd:attribute name="precise" type="xsd:boolean" use="required"/>
	</xsd:extension>
      </xsd:simpleContent>
    </xsd:complexType>
  </xsd:schema>

---------------------precision.xhtml---------------------
  <?xml version="1.0" encoding="iso-8859-1" ?>
  <html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:xf="http://www.w3.org/2002/xforms"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
	xmlns:my="http://www.example.com">
    <head>
      <title>XForms Samples</title>
      <xf:model schema="precision.xsd">
	<xf:instance src="precision.xml" />
	<xf:bind nodeset="my:time" type="xsd:time" />
	<xf:bind nodeset="my:time/@my:precise" type="xsd:boolean" />
      </xf:model>
    </head>
    <body>
      <h1>Precision</h1>
      <xf:group>
	<xf:input ref="my:time"><xf:label>Time</xf:label></xf:input>
	<xf:input
ref="my:time/@my:precise"><xf:label>Precise?</xf:label></xf:input>
      </xf:group>
    </body>
  </html>
-------------------------------------------------------------

[1] http://www.w3.org/TR/2003/CR-xforms-basic-20031014/#id2606183
[2]
http://www.w3.org/TR/2003/REC-xforms-20031014/index-all.html#structure-model
[3] http://www.mathling.com/xsd/
[4] http://www.w3.org/TR/2003/REC-xforms-20031014/index-all.html#ui-input

Received on Tuesday, 31 August 2004 21:24:08 UTC