Pārlūkot izejas kodu

working out whitespace notes

Lee Thomason (grinliz) 13 gadi atpakaļ
vecāks
revīzija
9b6011c478
1 mainītis faili ar 11 papildinājumiem un 8 dzēšanām
  1. 11 8
      readme.md

+ 11 - 8
readme.md

@@ -104,10 +104,12 @@ by the Document. When the Document is deleted, so are all the nodes it contains.
 
 
 ### White Space
 ### White Space
 
 
+#### Whitespace Preservation (default)
+
 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
 
 
 By default, 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 different model, much more similar to 'collapse', below.)
 
 
 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
 line-feed character, as required by the XML spec.
 line-feed character, as required by the XML spec.
@@ -136,17 +138,18 @@ valuable. TinyXML-2 sees these as the same XML:
 
 
 #### Whitespace Collapse
 #### Whitespace Collapse
 
 
-For some applications, it is preferable to collapse whitespace. TinyXML-2
-supports this with the 'whitespace' parameter to the XMLDocument constructor.
+For some applications, it is preferable to collapse whitespace. Collapsing
+whitespace gives you "HTML-like" behavior, which is sometimes more suitable
+for hand typed documents. 
+
+TinyXML-2 supports this with the 'whitespace' parameter to the XMLDocument constructor.
 (The default is to preserve whitespace, as described above.)
 (The default is to preserve whitespace, as described above.)
 
 
 However, you may also use COLLAPSE_WHITESPACE, which will:
 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.
+* 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
 
 
 Note that (currently) there is a performance impact for using COLLAPSE_WHITESPACE.
 Note that (currently) there is a performance impact for using COLLAPSE_WHITESPACE.
 It essentially causes the XML to be parsed twice.
 It essentially causes the XML to be parsed twice.