LISTSERV mailing list manager LISTSERV 15.5

Help for XML-L Archives


XML-L Archives

XML-L Archives


View:

Next Message | Previous Message
Next in Topic | Previous in Topic
Next by Same Author | Previous by Same Author
Chronologically | Most Recent First
Proportional Font | Monospaced Font

Options:

Join or Leave XML-L
Reply | Post New Message
Search Archives


Subject: Re: Basic Question regarding PCDATA content model
From: Murray Altheim <[log in to unmask]>
Reply-To:General discussion of Extensible Markup Language <[log in to unmask]>
Date:Mon, 20 Dec 1999 09:57:02 -0800
Content-Type:text/plain
Parts/Attachments:
Parts/Attachments

text/plain (49 lines)


"John E. Simpson" wrote:
[...]
> I *think* what Vinod was getting at was not about using mixed content models.
>
> As I read his question, he's got a content model that contains at least one
> #PCDATA element. And he's discovered that this element validates OK even if
> it is empty. For example:
>
>       <!DOCTYPE para [
>       <!ELEMENT para (#PCDATA) >
>       ]>
>       <para></para>
>
> This doesn't produce any validity or even any warning messages. (Caveat: I
> haven't checked it against more than a couple validating parsers. Possibly
> it's parser-dependent, although I don't think so.)

No, this is correct behaviour.

> If this *is* what Vinod was asking, then no, as far as I know there's no
> way to require that the para element (in this example) be non-empty.

No, not in element content.

> As for why this is allowed, I don't know. I imagine it simplifies a
> parser's processing -- it's kind of the equivalent of a DBMS that doesn't
> distinguish between empty strings ("") and true null values. It's certainly
> convenient when you're first developing a DTD, and know that the presence
> of a given element is required but don't yet need to actually populate it
> with test data.

There are very fundamental reasons why. Validation is based on markup
structure, not data content or structure. This is the reason why the
database folks are so interested in XML Schemas: schemas allow for not
only markup structure validation, but data validation based on typing.
If you want to validate the actual content of your document and not the
structure of its markup, you should investigate XML Schemas, although
it might be awhile before a completely compliant parser exists (there's
only one completely compliant validating XML parser I'm aware of: Sun's).

Murray

...........................................................................
Murray Altheim, SGML Grease Monkey         <mailto:altheim&#64;eng.sun.com>
Member of Technical Staff, Tools Development & Support
Sun Microsystems, 901 San Antonio Rd., UMPK17-102, Palo Alto, CA 94303-4900

   the honey bee is sad and cross and wicked as a weasel
   and when she perches on you boss she leaves a little measle -- archy

Back to: Top of Message | Previous Page | Main XML-L Page

Permalink



LISTSERV.HEANET.IE

CataList Email List Search Powered by the LISTSERV Email List Manager