whitespace doc

This commit is contained in:
Lee Thomason (grinliz) 2012-09-08 22:06:14 -07:00
parent 0fa8299d99
commit c5defa6b25
1 changed files with 18 additions and 1 deletions

View File

@ -106,7 +106,7 @@ by the Document. When the Document is deleted, so are all the nodes it contains.
Microsoft has an excellent article on white space: http://msdn.microsoft.com/en-us/library/ms256097.aspx Microsoft has an excellent article on white space: http://msdn.microsoft.com/en-us/library/ms256097.aspx
TinyXML-2 preserves white space in a (hopefully) sane way that is almost complient with the By default, TinyXML-2 preserves white space in a (hopefully) sane way that is almost complient with the
spec.(TinyXML-1 used a completely outdated model.) spec.(TinyXML-1 used a completely outdated model.)
As a first step, all newlines / carriage-returns / line-feeds are normalized to a As a first step, all newlines / carriage-returns / line-feeds are normalized to a
@ -134,6 +134,23 @@ valuable. TinyXML-2 sees these as the same XML:
<document><data>1</data><data>2</data><data>3</data></document> <document><data>1</data><data>2</data><data>3</data></document>
#### Whitespace Collapse
For some applications, it is preferable to collapse whitespace. TinyXML-2
supports this with the 'whitespace' parameter to the XMLDocument constructor.
(The default is to preserve whitespace, as described above.)
However, you may also use COLLAPSE_WHITESPACE, which will:
* Remove leading and trailing whitespace
* Convert newlines and line-feeds into a space character
* Collapse a run of any number of space characters into a single space character
This can be useful for text documents stored in XML.
Note that (currently) there is a performance impact for using COLLAPSE_WHITESPACE.
It essentially causes the XML to be parsed twice.
### Entities ### Entities
TinyXML-2 recognizes the pre-defined "character entities", meaning special TinyXML-2 recognizes the pre-defined "character entities", meaning special