mirror of https://github.com/AxioDL/tinyxml2.git
clean up readme.txt
This commit is contained in:
parent
618dbf82c5
commit
12d5a03e33
26
readme.txt
26
readme.txt
|
@ -71,7 +71,7 @@ Both parsers:
|
||||||
Advantages of TinyXML-2
|
Advantages of TinyXML-2
|
||||||
<ol>
|
<ol>
|
||||||
<li>The focus of all future dev.</li>
|
<li>The focus of all future dev.</li>
|
||||||
<li>Many fewer memory allocation (about 1/100th), uses less memory (about 40% of TinyXML-1), and faster.</li>
|
<li>Many fewer memory allocation (1/10th to 1/100th), uses less memory (about 40% of TinyXML-1), and faster.</li>
|
||||||
<li>No STL requirement.</li>
|
<li>No STL requirement.</li>
|
||||||
<li>More modern C++, including a proper namespace.</li>
|
<li>More modern C++, including a proper namespace.</li>
|
||||||
<li>Proper and useful handling of whitespace</li>
|
<li>Proper and useful handling of whitespace</li>
|
||||||
|
@ -107,52 +107,41 @@ As a first step, all newlines / carriage-returns / line-feeds are normalized to
|
||||||
line-feed character, as required by the XML spec.
|
line-feed character, as required by the XML spec.
|
||||||
|
|
||||||
White space in text is preserved. For example:
|
White space in text is preserved. For example:
|
||||||
@verbatim
|
|
||||||
<element> Hello, World</element>
|
<element> Hello, World</element>
|
||||||
@endverbatim
|
|
||||||
|
|
||||||
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 preserved.
|
||||||
Line-feeds are preserved, as in this example:
|
Line-feeds are preserved, as in this example:
|
||||||
|
|
||||||
@verbatim
|
|
||||||
<element> Hello again,
|
<element> Hello again,
|
||||||
World</element>
|
World</element>
|
||||||
@endverbatim
|
|
||||||
|
|
||||||
However, white space between elements is *not* preserved. Although not strictly compliant,
|
However, white space between elements is *not* preserved. Although not strictly compliant,
|
||||||
tracking and reporting inta-element space is awkward, and not normally valuable. TinyXML-2
|
tracking and reporting inta-element space is awkward, and not normally valuable. TinyXML-2
|
||||||
sees these as the same XML:
|
sees these as the same XML:
|
||||||
|
|
||||||
@verbatim
|
|
||||||
<document>
|
<document>
|
||||||
<data>1</data>
|
<data>1</data>
|
||||||
<data>2</data>
|
<data>2</data>
|
||||||
<data>3</data>
|
<data>3</data>
|
||||||
</document>
|
</document>
|
||||||
@endverbatim
|
|
||||||
|
|
||||||
@verbatim
|
|
||||||
<document><data>1</data><data>2</data><data>3</data></document>
|
<document><data>1</data><data>2</data><data>3</data></document>
|
||||||
@endverbatim
|
|
||||||
|
|
||||||
<h3> Entities </h3>
|
<h3> Entities </h3>
|
||||||
TinyXML-2 recognizes the pre-defined "character entities", meaning special
|
TinyXML-2 recognizes the pre-defined "character entities", meaning special
|
||||||
characters. Namely:
|
characters. Namely:
|
||||||
|
|
||||||
@verbatim
|
|
||||||
& &
|
& &
|
||||||
< <
|
< <
|
||||||
> >
|
> >
|
||||||
" "
|
" "
|
||||||
' '
|
' '
|
||||||
@endverbatim
|
|
||||||
|
|
||||||
These are recognized when the XML document is read, and translated to there
|
These are recognized when the XML document is read, and translated to there
|
||||||
UTF-8 equivalents. For instance, text with the XML of:
|
UTF-8 equivalents. For instance, text with the XML of:
|
||||||
|
|
||||||
@verbatim
|
|
||||||
Far & Away
|
Far & Away
|
||||||
@endverbatim
|
|
||||||
|
|
||||||
will have the Value() of "Far & Away" when queried from the XMLText object,
|
will have the Value() of "Far & Away" when queried from the XMLText object,
|
||||||
and will be written back to the XML stream/file as an ampersand.
|
and will be written back to the XML stream/file as an ampersand.
|
||||||
|
@ -167,25 +156,22 @@ regular code point. The output is correct, but the entity syntax isn't preserved
|
||||||
|
|
||||||
<h4> Print to file </h4>
|
<h4> Print to file </h4>
|
||||||
You can directly use the convenience function:
|
You can directly use the convenience function:
|
||||||
@verbatim
|
|
||||||
XMLDocument doc;
|
XMLDocument doc;
|
||||||
...
|
...
|
||||||
doc.Save( "foo.xml" );
|
doc.Save( "foo.xml" );
|
||||||
@endverbatim
|
|
||||||
|
|
||||||
Or the XMLPrinter class:
|
Or the XMLPrinter class:
|
||||||
@verbatim
|
|
||||||
XMLPrinter printer( fp );
|
XMLPrinter printer( fp );
|
||||||
doc.Print( &printer );
|
doc.Print( &printer );
|
||||||
@endverbatim
|
|
||||||
|
|
||||||
<h4> Print to memory </h4>
|
<h4> Print to memory </h4>
|
||||||
Printing to memory is supported by the XMLPrinter.
|
Printing to memory is supported by the XMLPrinter.
|
||||||
@verbatim
|
|
||||||
XMLPrinter printer;
|
XMLPrinter printer;
|
||||||
doc->Print( &printer );
|
doc->Print( &printer );
|
||||||
// printer.CStr() has a const char* to the XML
|
// printer.CStr() has a const char* to the XML
|
||||||
@endverbatim
|
|
||||||
|
|
||||||
<h4> Print without an XMLDocument </h4>
|
<h4> Print without an XMLDocument </h4>
|
||||||
|
|
||||||
|
@ -197,12 +183,10 @@ Printing to memory is supported by the XMLPrinter.
|
||||||
prints out a trivially simple XML file without ever creating
|
prints out a trivially simple XML file without ever creating
|
||||||
an XML document.
|
an XML document.
|
||||||
|
|
||||||
@verbatim
|
|
||||||
XMLPrinter printer( fp );
|
XMLPrinter printer( fp );
|
||||||
printer.OpenElement( "foo" );
|
printer.OpenElement( "foo" );
|
||||||
printer.PushAttribute( "foo", "bar" );
|
printer.PushAttribute( "foo", "bar" );
|
||||||
printer.CloseElement();
|
printer.CloseElement();
|
||||||
@endverbatim
|
|
||||||
|
|
||||||
<h2> Using and Installing </h2>
|
<h2> Using and Installing </h2>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue