W3C home > Mailing lists > Public > www-forms@w3.org > March 2005

binding a simple derived type

From: Andy Harrison <andyh@agaricus.co.uk>
Date: Wed, 02 Mar 2005 14:19:22 +0000
Message-ID: <4225CB6A.3080209@agaricus.co.uk>
To: www-forms@w3.org


I'm trying to get my head around datatypes in XForms (and XForms in 
general). I'd like to be able to specify simple types in a WYSIWG type 
form creation tool. If my little tool allows someone to restict the 
"maxlength" of a text field (or max value of a numeric or something) I 
read that one way to do this is via XML Schema simple type base (e.g 
string) and applying xsd:restriction (facets).

There are a few examples out there where an xsd file is referenced from 
the xforms:model with this kind of arrangement. The examples I have seen 
always have an "xsd:element" that binds the new type to an element in 
the instance data.

My question is... can I discard the xsd:element definition in favour of 
an XForms model binding? Sorry if some of my terminology isn't a concise 
as it might be. I've tried to create a little snippet to covey what I 


<!-- model snippet -->
<model xmlns="http://www.w3.org/2002/xforms" schema="myschema.xsd">
<instance id="blah">
   <!-- some random piece of instance data -->
   <stuff xmlns="">
     <tag>Hello World</tag>
     <othertag />
<bind ref="tag" id="tagbind" type="xsd:string" />
<bind ref="othertag" id="othertagbind" type="xsd:mysimpletype" />

<!-- myschema.xsd -->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
targetNamespace="" elementFormDefault="qualified">
   <xsd:simpleType name="mysimpletype">
     <xsd:restriction base="xsd:string">
       <xsd:enumeration value="bar" />
       <xsd:enumeration value="foo" />
Received on Wednesday, 2 March 2005 17:10:10 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:36:14 UTC