Handling of empty content and white space-only content?
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!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format