mirror of https://github.com/AxioDL/tinyxml2.git
fix some help formatting
This commit is contained in:
parent
7f7b162b6f
commit
c50b6b4e7e
27
readme.txt
27
readme.txt
|
@ -100,8 +100,8 @@ 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 spec.
|
TinyXML-2 preserves white space in a (hopefully) sane way that is almost complient with the
|
||||||
(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
|
||||||
line-feed character, as required by the XML spec.
|
line-feed character, as required by the XML spec.
|
||||||
|
@ -110,15 +110,15 @@ White space in text is preserved. For example:
|
||||||
|
|
||||||
<element> Hello, World</element>
|
<element> Hello, World</element>
|
||||||
|
|
||||||
The leading space before the "Hello" and the double space after the comma are preserved.
|
The leading space before the "Hello" and the double space after the comma are
|
||||||
Line-feeds are preserved, as in this example:
|
preserved. Line-feeds are preserved, as in this example:
|
||||||
|
|
||||||
<element> Hello again,
|
<element> Hello again,
|
||||||
World</element>
|
World</element>
|
||||||
|
|
||||||
However, white space between elements is *not* preserved. Although not strictly compliant,
|
However, white space between elements is *not* preserved. Although not strictly
|
||||||
tracking and reporting inta-element space is awkward, and not normally valuable. TinyXML-2
|
compliant, tracking and reporting inter-element space is awkward, and not normally
|
||||||
sees these as the same XML:
|
valuable. TinyXML-2 sees these as the same XML:
|
||||||
|
|
||||||
<document>
|
<document>
|
||||||
<data>1</data>
|
<data>1</data>
|
||||||
|
@ -207,15 +207,18 @@ an XML document.
|
||||||
doc.LoadFile( "dream.xml" );
|
doc.LoadFile( "dream.xml" );
|
||||||
|
|
||||||
// Structure of the XML file:
|
// Structure of the XML file:
|
||||||
// - Element "PLAY" the root Element, which is the FirstChildElement of the Document
|
// - Element "PLAY" the root Element, which is the
|
||||||
// - - Element "TITLE" child of the root PLAY Element
|
// FirstChildElement of the Document
|
||||||
// - - - Text child of the TITLE Element
|
// - - Element "TITLE" child of the root PLAY Element
|
||||||
|
// - - - Text child of the TITLE Element
|
||||||
|
|
||||||
// Navigate to the title, using the convenience function, with a dangerous lack of error checking.
|
// Navigate to the title, using the convenience function,
|
||||||
|
// with a dangerous lack of error checking.
|
||||||
const char* title = doc.FirstChildElement( "PLAY" )->FirstChildElement( "TITLE" )->GetText();
|
const char* title = doc.FirstChildElement( "PLAY" )->FirstChildElement( "TITLE" )->GetText();
|
||||||
printf( "Name of play (1): %s\n", title );
|
printf( "Name of play (1): %s\n", title );
|
||||||
|
|
||||||
// Text is just another Node to TinyXML-2. The more general way to get to the XMLText:
|
// Text is just another Node to TinyXML-2. The more
|
||||||
|
// general way to get to the XMLText:
|
||||||
XMLText* textNode = doc.FirstChildElement( "PLAY" )->FirstChildElement( "TITLE" )->FirstChild()->ToText();
|
XMLText* textNode = doc.FirstChildElement( "PLAY" )->FirstChildElement( "TITLE" )->FirstChild()->ToText();
|
||||||
title = textNode->Value();
|
title = textNode->Value();
|
||||||
printf( "Name of play (2): %s\n", title );
|
printf( "Name of play (2): %s\n", title );
|
||||||
|
|
Loading…
Reference in New Issue