W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2001

Re: The <Value>_<Unit> problem

From: Eddie Robertsson <eddie@allette.com.au>
Date: Thu, 02 Aug 2001 18:26:31 +1000
Message-ID: <3B690EB7.F0DF88EE@allette.com.au>
To: Martin Duerst <duerst@w3.org>
CC: XSD <xmlschema-dev@w3.org>
> >  <xsd:simpleType name="productCostType">
> >   <xsd:restriction>
> >    <xsd:simpleType>
> >     <xsd:list itemType="myUnion"/>
> >    </xsd:simpleType>
> >    <xsd:length value="2"/>
> >    <xs:pattern value="/d+ .+"/>
> >   </xsd:restriction>
> >  </xsd:simpleType>
> >
> >The only validator that seems to support this is MSXML4 July release but
> >according to my reading of the spec this should be allowed.
>
> Probably it is. But at least you have to change
>     <xs:pattern value="/d+ .+"/>
> to something more specific to avoid allowing values such as
>     <productCost>20 50</productCost>

Your correct. Something like:

    <xs:pattern value="/d+ [A-Z]+"/>

would be better.

> Anyway, using a complex type and a bit more of markup seems
> to be the better solution.

Again, I completely agree. Someone asked for this functionality a couple of
weeks ago where I suggested a solution lacking the pattern declaration. I was
just providing a better solution to the problem. However I do think it's
better to use a solution as suggested by Simon:

<productCost currency="AUD">20</productCost>

Cheers,
/Eddie
Received on Thursday, 2 August 2001 04:27:55 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:23 GMT