[Home] [By Thread] [By Date] [Recent Entries]

  • To: xml-dev@l...
  • Subject: RE: Validation of missing elements in xml:
  • From: Eric van der Vlist <vdv@d...>
  • Date: Mon, 03 Apr 2006 17:39:19 +0200
  • In-reply-to: <20060403153140.2F9F57F573F@g...>
  • Organization: Dyomedea (http://dyomedea.com)
  • References: <20060403153140.2F9F57F573F@g...>

Le lundi 03 avril 2006 à 16:26 +0100, Michael Kay a écrit :
> With a DTD, there are very few ways to constrain the textual content of an
> element (you can constrain it to be EMPTY, but not to be non-empty).
> 
> In XML Schema, you can declare the element to be of type my:non-empty-string
> where my:non-empty-string is a simple type derived from xs:string using the
> facet <minLength value="1"/>

True, but that depends what you call "empty"...

Deriving from xs:string won't catch cases where you only have
whitespaces such as;

<Person>
        <name>
	</name>
        <email>
		aaa.bbb@x...
	</email>
</Person>

If this should be considered invalid (which happens to be consistent
with the behavior of other datatypes), you should derive form xs:token
instead of xs:string...

Eric (caught on one of his most frequent rants again)

-- 
GPG-PGP: 2A528005
Did you know it? Python has now a Relax NG (partial) implementation.
                                          http://advogato.org/proj/xvif/
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
(ISO) RELAX NG   ISBN:0-596-00421-4 http://oreilly.com/catalog/relax
(W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema
------------------------------------------------------------------------

Ceci est une partie de message=?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member