W3C home > Mailing lists > Public > xmlschema-dev@w3.org > October 2004

Re: Allowing only a fixed length or empty for an element

From: Anli Shundi <ashundi@tibco.com>
Date: Thu, 07 Oct 2004 09:26:15 -0400
To: Wilde Rebecca L SSgt HQ SSG/STS <Rebecca.Wilde@Gunter.AF.mil>
Cc: xmlschema-dev@w3.org
Message-id: <416543F7.1050409@tibco.com>

This looks like a bug in XMLSpy -- other processors validate it correctly.

The spec clearly allows 0 as a quantifier -- "non negative number"


The suggestion to use '?' instead is elegant and more and effective.


On 10/6/2004 4:04 PM, Wilde Rebecca L SSgt HQ SSG/STS wrote:
> Hello,
> I am trying to create a type that allows either a four position numeric
> or else must be an empty tag.
> I.E. I want <Tag/> or <Tag>0045</Tag> to be valid, but I don't want
> <Tag>45</Tag> to be validated.
> I've come up with the following to try and do this:
> <xs:element name="Tag" type="TagType"/>
> <xs:simpleType name="TagType">
>   <xs:restriction base="xs:string">
>     <xs:pattern value="([0-9]{4})|[ ]{0}"/>
>   </xs:restriction>
> </xs:simpleType>
> I'm using XMLSpy to help me as an editor for creating most of my work
> and validating it.  The above will allow me to validate/not validate as
> I desired, but when others try to use XMLSpy to validate against it as
> an empty tag, it comes back invalid.  
> Is this a problem with XMLSpy, or is there a different way I should be
> trying to accomplish my goal?
> Thank you!
> Becky

Anli Shundi					ashundi@tibco.com
TIBCO Software Inc.				office: (919) 969-6518

Get Firefox! http://www.mozilla.org/products/firefox/
Received on Thursday, 7 October 2004 13:27:19 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:06 UTC