Moving string in/out into XMLUtil. Using that across the API. Supporting text queries of primitive types.

This commit is contained in:
Lee Thomason
2012-07-15 17:27:22 -07:00
parent 78a773ddd9
commit 21be882810
6 changed files with 387 additions and 48 deletions

View File

@@ -92,3 +92,38 @@
looking for XMLText, not an element, and ToText()
is a cast from a Node to a XMLText.
*/
/** @page Example-4 Read attributes and text information.
@dontinclude ./xmltest.cpp
There are fundamentally 2 ways of writing a key-value
pair into an XML file. (Something that's always annoyed
me about XML.) Either by using attributes, or by writing
the key name into an element and the value into
the text node wrapped by the element. Both approaches
are illustrated in this example, which shows two ways
to encode the value "2" into the key "v":
@skip example_4
@until "</information>";
TinyXML-2 has accessors for both approaches.
When using an attribute, you navigate to the XMLElement
with that attribute and use the QueryIntAttribute()
group of methods. (Also QueryFloatAttribute(), etc.)
@skip XMLElement* attributeApproachElement
@until &v0 );
When using the text approach, you need to navigate
down one more step to the XMLElement that contains
the text. Note the extra FirstChildElement( "v" )
in the code below. The value of the text can then
be safely queried with the QueryIntText() group
of methods. (Also QueryFloatText(), etc.)
@skip XMLElement* textApproachElement
@until &v1 );
*/