- From: Andy Harrison <andyh@agaricus.co.uk>
- Date: Wed, 02 Mar 2005 14:19:22 +0000
- To: www-forms@w3.org
Hi,
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
mean...
thanks
andy
<!-- 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 />
</stuff>
</instance>
<bind ref="tag" id="tagbind" type="xsd:string" />
<bind ref="othertag" id="othertagbind" type="xsd:mysimpletype" />
</model>
<!-- 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" />
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
Received on Wednesday, 2 March 2005 17:10:10 UTC