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

RE: WXS types in XForms

From: Rhydian Morris <RMorris@focus-solutions.co.uk>
Date: Fri, 8 Apr 2005 11:10:46 +0100
Message-ID: <30A02A46CB77D511851900508BAEADBC016832B7@exchange.focus-internal.co.uk>
To: "'ava@vaz.ru'" <ava@vaz.ru>, www-forms@w3.org

Hi All,

Another way of solving this is to create a schema which creates a element of
your type. Set the attribute nillable="true" as in the example below.

<xsd:element name="myroot">
				<xsd:element name="myelement"
type="my:mytype" nillable="true"/>
	<xsd:simpleType name="mytype">
		<xsd:restriction base="xsd:decimal">
			<xsd:minInclusive value="0"/>
			<xsd:fractionDigits value="5"/>

then within your instance set the xsi:nil attribute to true and it shouldn't
raise an error when there is an empty value.

<my:myroot xmlns:my="http://www.fbs.com/myschema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
	<my:myelement xsi:nil="true"/>


Rhydian Morris


-----Original Message-----
From: Alexander Anokhin [mailto:ava@vaz.ru]
Sent: 08 April 2005 08:06
To: www-forms@w3.org
Subject: WXS types in XForms

Hello, all.

I'm trying to assign some validation job to XForms.
For example: I want to bind <xform:input> with such WXS-type when it's 
value is decimal with maximum 5 digits OR user may leave this field 
empty (kind of optional search parameter).
My guess, is that i'll be like this:
             <xsd:simpleType name="myType">
                 <xsd:restriction base="xsd:decimal">
                     <xsd:minInclusive value="0"/>
                     <xsd:fractionDigits value="5"/>
but when such field is empty (right after Xform is loaded or user 
desided that way) it fires xforms-invalid event and so on..

I did some workaround by using <xsd:pattern>:

             <xsd:simpleType name="myType">
                 <xsd:restriction base="xsd:string">
                     <xsd:pattern value="[0-9]{1,5}|"/>

Works fine but, imho, not such pretty.

I'm not an WXS expert so is there better way?

Alexander Anokhin
email: ava@vaz.ru
icq: 123275798
Received on Friday, 8 April 2005 10:10:53 UTC

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