RE: binding a simple derived type

Hi Andy,

Yes, you will be able to attach your derived datatypes through the xf:bind
element. I have attached an example which does just that and will work in
the Novell IE plug-in
(http://ftp.novell.com/pub/forge/xforms-explorer/docs/home.html).

Another way than attaching it thought the bind element is to use the
xsi:type attribute in the instance. The example also demonstrates that.

I hope this answers you question and I'm sorry you didn't get a response
right away.

Best regards,
David Landwehr

-----Original Message-----
From: www-forms-request@w3.org [mailto:www-forms-request@w3.org] On Behalf
Of Andy Harrison
Sent: 2. marts 2005 15:19
To: www-forms@w3.org
Subject: binding a simple derived type


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 Monday, 7 March 2005 16:42:22 UTC