[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Why must an XML document contain an element?

  • From: Tim Bray <tbray@t...>
  • To: xml-dev@i...
  • Date: Tue, 06 May 1997 11:45:53 -0700

xml contain another xml element
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@i... the following message;
unsubscribe xml-dev
List coordinator, Henry Rzepa (rzepa@i...)


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.