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

Handling of empty content and white space-only content?


dtd empty whitespace

If you validate your XML with a DTD, then you can specify whether an
element contains only other elements, only parsable-character-data,
or both (mixed-content).

If an element is declared to contain only other elements, then
whitespace is not significant. If, however, an element is declared
to contain parsable-character-data, then all whitespace is
significant whether or not it comes directly after or directly before
an element tag.

If you don't validate your XML with a DTD, then all whitespace is
significant.

When I say that whitespace is significant, then I'm not referring to
the  whitespace within an element tag:
< foo /> and <foo/> are equivalent.

Now, whether whitespace is significant or not, the XML specification
says:
"An XML processor MUST always pass all characters in a document that
 are not markup through to the application.
 A validating XML processor MUST also inform the application which of
 these characters constitute white space appearing in element
 content."
This means that you'll always have all the whitespace to work with,
whether or not it is "significant".

The XML specification also says something about a xml:space attribute.
As I understand it, when this attribute has a value of "preserve",
then XML processors/applications should always treat whitespace as
significant.

Regarding empty elements:
An empty element can be written like <foo></foo> or <foo/>, they are
both equivalent. I assume that no XML processor will make a difference.

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.