Using a regex pattern in an XForm

John Boyer <[email protected]> Wed, 22 Sep 2010 08:49:11 -0700
Newsgroups gmane.comp.web.xforms
Message-ID <OF7154236E.493E47AF-ON882577A6.0053559F-882577A6.0056E830@ca.ibm.com>
This is an FYI:  You can use the "type" model item property to validate a 
data node with a regex pattern expression, like this:

<xforms:model> 
   <schema targetNamespace="http://test.org" xmlns="
http://www.w3.org/2001/XMLSchema">
      <simpleType name="alnum">
         <restriction base="xsd:string">
            <pattern value="[A-Za-z0-9]*"></pattern>
         </restriction>
      </simpleType>
   </schema>
   <xforms:instance xmlns="http://test.org">
      <data>
         <node></node>
      </data>
   </xforms:instance>
   <xforms:bind nodeset="test:node" type="test:alnum"/>
</xforms:model> 

Cheers,
John Boyer