Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: when will empty tags pass schema validation? [Thread Next] Re: when will empty tags pass schema validation?To: NULL Date: 5/5/2006 11:48:00 PM
wolf_y wrote:
> Thanks for answering, but maybe I should have led with my disclaimer:
> I'm a newbie to XML, primarily program in SAS, and consulted online
> documentation.
>
> Some of my confusion stems from the way terms such as empty, missing,
> null, and blank are used/handled in different languages. I don't mind
> reading docs, but I can't find an answer I understand at
> http://www.w3.org/ or url links I've found.
>
> I don't want to create an empty element, but need to know under what
> circumstances an empty element will pass schema checks,
I think the confusion arises from the two different meanings of the word.
a) EMPTY (in caps) is an XML keyword used to declare that a certain
element type can *never* have any content (neither character data
content nor other elements)
b) empty (in lowercase) is just an adjective meaning "with no content";
it doesn't specify whether content is permitted or not, it simply
says that there isn't any content at the moment.
An element type declared as EMPTY can be represented as <foo/> or as
<foo></foo>. The first is often recommended because it is unambiguous
and there is no possibility of anyone ever manually inserting any
content and thereby breaking the document model.
An element type declared *with* content *may* be empty on some
occasions (like this <name></name>) but that does not necessarily mean
that it was declared EMPTY: you'd have to consult the Schema or DTD
to find that out.
So an empty element like <name></name> will pass a validation check
either
a) if it was declared EMPTY, or
b) it was declared with optional content and just doesn't happen to
have any right now.
An element like <foo/> will only pass a validation check if it was
declared EMPTY.
(In both cases I am assuming there are no compulsory attributes.)
///Peter
--
XML FAQ: http://xml.silmaril.ie/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
