Re: Problem with pattern and empty element

kfricovsky wrote:

> Hello,
> 
> I have this element in my XML SCHEMA:
> 
> <xsd:element name="XXX">
> 	<xsd:simpleType>
> 		<xsd:restriction base="xsd:string">
> 			<xsd:pattern value="([0-9]+|[A-Z]+)+" />
> 		</xsd:restriction>
> 	</xsd:simpleType>
> </xsd:element>
> 
> I am using XML SPY to validate my XML using the SCHEMA I created. The
> problem I am having is leaving this element as an empty element,  like
> <XXX/>. XML SPY says that the XML doc isn't well formed unless I insert
> a value conforming to my pattern.


Your problem there, is that your pattern requires at least a character!

If you want to accept a null string, why do you specify minimum number 
of occurrences equal to one?

<xsd:pattern value="[0-9A-Z]*" />

seems a better bet if you want to accept any number of characters which 
are either betweem 0 to 9 or A to Z!


Eric
-- 
Rendez-vous à Paris pour le Forum XML.
                    http://www.technoforum.fr/Pages/forumXML01/index.html
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
http://xsltunit.org      http://4xt.org           http://examplotron.org
------------------------------------------------------------------------

Received on Thursday, 15 November 2001 12:46:01 UTC