OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: Why must an XML document contain an element?

[ Lists Home | Date Index | Thread Index ]
  • From: Tim Bray <tbray@textuality.com>
  • To: xml-dev@ic.ac.uk
  • Date: Tue, 06 May 1997 11:45:53 -0700

At 02:19 PM 5/6/97 -0400, Eric Baatz - Sun Microsystems Labs BOS wrote:

>  [23] document ::= Prolog element Misc*
>So I could force the client to send:
>  <?XML version="1.0" encoding="UCS-2"?>
>  <foobar/>
>  This is plain text.

This would still not work, because "This is plain text." doesn't
match the nonterminal 'Misc'.  You need:

<foobar>This is plain text.</foobar>

>But forcing the inclusion of characters that don't convey any
>useful information to the application goes against my sense of
>cleanliness.
>
>Why must an XML document include at least one element?

If you don't have any useful info to convey, then don't put in
the tag.  It's not XML, but the text is presumably still useful.

It is a defining characteristic of XML that any "character data", 
i.e. non-markup text, has to be part of an element.  In other words,
a document must have a logical structure, and all its text must
have a place in that logical structure.  One benefit: you know
unambiguously when the message has ended, without waiting for
sockets to close and so on.  One of the things that makes XML
processors simple is they can look simple-mindedly for begin and
end tags, no exceptions.

I can accept that there are tons of useful documents that do not
have an explicitly-marked up logical structure, and an important
place in the world for plain text.  And, we hope, an important 
place for XML.  But they're not the same thing. -Tim


xml-dev: A list for W3C XML Developers
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To unsubscribe, send to majordomo@ic.ac.uk the following message;
unsubscribe xml-dev
List coordinator, Henry Rzepa (rzepa@ic.ac.uk)





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS