Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


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

From: "Michael Kay" <mike@--------.--->
To: "'Wilde Rebecca L SSgt HQ SSG/STS'" <Rebecca.Wilde@------.--.--->, <xmlschema-dev@--.--->
Date: 10/6/2004 10:59:00 PM
I don't know off-hand whether a quantifier of {0} is allowed, but it's
certainly unconventional. What's wrong with
 
pattern value="([0-9]{4})?"
 
Michael Kay
http://www.saxonica.com/


  _____  

From: xmlschema-dev-request@w... [mailto:xmlschema-dev-request@w...] On
Behalf Of Wilde Rebecca L SSgt HQ SSG/STS
Sent: 06 October 2004 21:04
To: xmlschema-dev@w...
Subject: Allowing only a fixed length or empty for an element



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 



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent