- Escaping XML Data
- XML Encoding
- XML 1. 0 EBNF
- XML 1.1 EBNF
- Byte Order Marker
- XML Schemas
- XML Mixed Content
- Describing Complex Structures in XML
There are 3 types of whitespace within an XML document, XML Syntax, Significant and Insignificant.
<?xml version="1.0" ?>
<Address type=" billing">↲
<Street> Revello Drive</Street>↲
Follow Route 1↲
Left After crossing↲
First house with green door</Directions>↲
XML Syntactical whitespace
This is whitespace required by the XML Spec in order to delimitate XML constructs. The XML parser digests this all internally, it is not passed on to the application consuming then XML.
This is whitespace that is not considered part of an element, if 2 element tags are separated by just whitespace its considered insignificant.
An XML parser processes this information, and may pass it to the underlying application marked as insignificant whitespace.
Insignificant whitespace is typically added to an XML file in order to format it, provide the indenting etc. and in principal it has not impact on the meaning of the document.
Significant whitespace is whitespace contained within XML element, attribute, or processing instruction data. The XML parser will passed this on to the consuming application as data.
When an XML Schema is being used, the schema can impose its own whitespace rules on the data contained in elements and attributes. This can cause leading/trailing whitespace to be removed and runs of whitespace converted into a single space, see DTD Whitespace Rules and XSD Whitespace Rules.
The characters that XML considered to be whitespace are described by the W3C as using EBNF as follows (space, tab, carriage return, line feed).
 S ::= (#x20 | #x9 | #xD | #xA)+