W3C home > Mailing lists > Public > www-forms@w3.org > May 2006

Some test cases for the type MIP

From: John Boyer <boyerj@ca.ibm.com>
Date: Thu, 11 May 2006 13:48:08 -0700
To: www-forms@w3.org
Message-ID: <OF483B23C7.B062F4D8-ON8825716B.006EB8B4-8825716B.00724611@ca.ibm.com>
Since the topic of implementations has come up, I think it makes a little 
sense to talk
about what mine is doing and try to see whether other implementations are 
similar things.  I'm guessing there are some differences...

As is no doubt painfully clear by now, my interpretation of the type MIP 
is validation
of the datatype against the *content* of the node with which the datatype 
has been 
associated.  This means both of the following validate in my 

      <price currency="USD">100.00</price>

<bind nodeset="price" type="xsd:double"/>

Does anyone agree or disagree that the second price element should be 
valid according to the type assignment made?  I ask because the schema 
for the price element would be a complex type that adds the currency 
attribute to a 
*base* of xsd:double.

If your implementation considers the second price to be valid, then your 
is validating the content of the price element.  If your implementation 
doesn't validate
the second price element, then you are validating the whole element, 
attributes and all,
and we have a new disconnect to contend with.

Recently, some suggestions were made at the last XForms face-to-face that 
the type
MIP could consume complex types.  I interpreted these comments in the 
context of
datatype validation, so we have experimented with adding some code that 
to accommodate this desire.  I make no guarantees that the code will stay 
there :-), but
additional of complex types with simple content necessitates *two* type 
checks, one
with attributes and one without attributes.  Here is an example:

<xsd:complexType name="internationalPrice">
      <xsd:extension base="xsd:double">
        <xsd:attribute name="currency" type="xsd:string"/>

      <price currency="USD">100.00</price>
      <price currency="EUR">100.00</price>

<bind nodeset="price[1]" type="xsd:double"/>
<bind nodeset="price[2]" type="internationalPrice"/>

With the experimental code, both price elements above are valid.  The 
first because
the simple type validates the *content only* of the (first) price node, 
and the second 
because the complex type validates the actual (second) price element.

How do these results compare with other implementations?

John M. Boyer, Ph.D.
Senior Product Architect/Research Scientist
Co-Chair, W3C XForms Working Group
Workplace, Portal and Collaboration Software
IBM Victoria Software Lab
E-Mail: boyerj@ca.ibm.com  http://www.ibm.com/software/

Blog: http://www.ibm.com/developerworks/blogs/page/JohnBoyer
Received on Thursday, 11 May 2006 20:48:22 UTC

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