diff --git a/docs/_example-1.html b/docs/_example-1.html deleted file mode 100644 index 307d61f..0000000 --- a/docs/_example-1.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - -TinyXML-2: Load an XML File - - - - - - - - - -
-
- - - - - - -
-
TinyXML-2 -  6.0.0 -
-
-
- - - - - - - - -
-
- - -
- -
- -
-
-
-
Load an XML File
-
-
-
Basic XML file loading. The basic syntax to load an XML file from disk and check for an error. (ErrorID() will return 0 for no error.)
int example_1()
{
XMLDocument doc;
doc.LoadFile( "resources/dream.xml" );
return doc.ErrorID();
}

-
- - - - diff --git a/docs/_example-2.html b/docs/_example-2.html deleted file mode 100644 index 1d2516f..0000000 --- a/docs/_example-2.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - -TinyXML-2: Parse an XML from char buffer - - - - - - - - - -
-
- - - - - - -
-
TinyXML-2 -  6.0.0 -
-
-
- - - - - - - - -
-
- - -
- -
- -
-
-
-
Parse an XML from char buffer
-
-
-
Basic XML string parsing. The basic syntax to parse an XML for a char* and check for an error. (ErrorID() will return 0 for no error.)
int example_2()
{
static const char* xml = "<element/>";
XMLDocument doc;
doc.Parse( xml );
return doc.ErrorID();
}

-
- - - - diff --git a/docs/_example-3.html b/docs/_example-3.html deleted file mode 100644 index 3e3f6a3..0000000 --- a/docs/_example-3.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - -TinyXML-2: Get information out of XML - - - - - - - - - -
-
- - - - - - -
-
TinyXML-2 -  6.0.0 -
-
-
- - - - - - - - -
-
- - -
- -
- -
-
-
-
Get information out of XML
-
-
-
In this example, we navigate a simple XML file, and read some interesting text. Note that this example doesn't use error checking; working code should check for null pointers when walking an XML tree, or use XMLHandle.

-

(The XML is an excerpt from "dream.xml").

-

int example_3()
{
static const char* xml =
"<?xml version=\"1.0\"?>"
"<!DOCTYPE PLAY SYSTEM \"play.dtd\">"
"<PLAY>"
"<TITLE>A Midsummer Night's Dream</TITLE>"
"</PLAY>";

-

The structure of the XML file is:

- -

For this example, we want to print out the title of the play. The text of the title (what we want) is child of the "TITLE" element which is a child of the "PLAY" element.

-

We want to skip the declaration and dtd, so the method FirstChildElement() is a good choice. The FirstChildElement() of the Document is the "PLAY" Element, the FirstChildElement() of the "PLAY" Element is the "TITLE" Element.

-

XMLDocument doc;
doc.Parse( xml );
XMLElement* titleElement = doc.FirstChildElement( "PLAY" )->FirstChildElement( "TITLE" );

-

We can then use the convenience function GetText() to get the title of the play.

-

const char* title = titleElement->GetText();
printf( "Name of play (1): %s\n", title );

-

Text is just another Node in the XML DOM. And in fact you should be a little cautious with it, as text nodes can contain elements.

-
Consider: A Midsummer Night's <b>Dream</b>
-

It is more correct to actually query the Text Node if in doubt:

-

XMLText* textNode = titleElement->FirstChild()->ToText();
title = textNode->Value();
printf( "Name of play (2): %s\n", title );

-

Noting that here we use FirstChild() since we are looking for XMLText, not an element, and ToText() is a cast from a Node to a XMLText.

-
- - - - diff --git a/docs/_example-4.html b/docs/_example-4.html deleted file mode 100644 index 76b73b2..0000000 --- a/docs/_example-4.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - -TinyXML-2: Read attributes and text information. - - - - - - - - - -
-
- - - - - - -
-
TinyXML-2 -  6.0.0 -
-
-
- - - - - - - - -
-
- - -
- -
- -
-
-
-
Read attributes and text information.
-
-
-

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":

-

bool example_4()
{
static const char* xml =
"<information>"
" <attributeApproach v='2' />"
" <textApproach>"
" <v>2</v>"
" </textApproach>"
"</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.)

-

XMLElement* attributeApproachElement = doc.FirstChildElement()->FirstChildElement( "attributeApproach" );
attributeApproachElement->QueryIntAttribute( "v", &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.)

-

XMLElement* textApproachElement = doc.FirstChildElement()->FirstChildElement( "textApproach" );
textApproachElement->FirstChildElement( "v" )->QueryIntText( &v1 );

-
- - - - diff --git a/docs/_example_1.html b/docs/_example_1.html index ef2ce7c..29362d6 100644 --- a/docs/_example_1.html +++ b/docs/_example_1.html @@ -67,7 +67,7 @@ $(function() { diff --git a/docs/_example_2.html b/docs/_example_2.html index d852f7e..e4fe6c6 100644 --- a/docs/_example_2.html +++ b/docs/_example_2.html @@ -67,7 +67,7 @@ $(function() { diff --git a/docs/_example_3.html b/docs/_example_3.html index a64edfe..34551d3 100644 --- a/docs/_example_3.html +++ b/docs/_example_3.html @@ -96,7 +96,7 @@ Text "A Midsummer Night's Dream" diff --git a/docs/_example_4.html b/docs/_example_4.html index 7bae7ce..ad871b9 100644 --- a/docs/_example_4.html +++ b/docs/_example_4.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/annotated.html b/docs/annotated.html index 35afe8b..795cea1 100644 --- a/docs/annotated.html +++ b/docs/annotated.html @@ -83,7 +83,7 @@ $(function() { diff --git a/docs/classes.html b/docs/classes.html index aa5daf7..e7d20bc 100644 --- a/docs/classes.html +++ b/docs/classes.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/classtinyxml2_1_1_x_m_l_attribute-members.html b/docs/classtinyxml2_1_1_x_m_l_attribute-members.html index c2c6687..e25e284 100644 --- a/docs/classtinyxml2_1_1_x_m_l_attribute-members.html +++ b/docs/classtinyxml2_1_1_x_m_l_attribute-members.html @@ -95,7 +95,7 @@ $(function() { diff --git a/docs/classtinyxml2_1_1_x_m_l_attribute.html b/docs/classtinyxml2_1_1_x_m_l_attribute.html index 4aabc58..2e82a10 100644 --- a/docs/classtinyxml2_1_1_x_m_l_attribute.html +++ b/docs/classtinyxml2_1_1_x_m_l_attribute.html @@ -215,7 +215,7 @@ void  diff --git a/docs/classtinyxml2_1_1_x_m_l_comment-members.html b/docs/classtinyxml2_1_1_x_m_l_comment-members.html index 6341306..e4e8d8a 100644 --- a/docs/classtinyxml2_1_1_x_m_l_comment-members.html +++ b/docs/classtinyxml2_1_1_x_m_l_comment-members.html @@ -105,7 +105,7 @@ $(function() { diff --git a/docs/classtinyxml2_1_1_x_m_l_comment.html b/docs/classtinyxml2_1_1_x_m_l_comment.html index 7a7811d..1c60c12 100644 --- a/docs/classtinyxml2_1_1_x_m_l_comment.html +++ b/docs/classtinyxml2_1_1_x_m_l_comment.html @@ -292,7 +292,7 @@ const char* xmlcstr = printer.CStr(); diff --git a/docs/classtinyxml2_1_1_x_m_l_const_handle-members.html b/docs/classtinyxml2_1_1_x_m_l_const_handle-members.html index 28f1a94..7f02f67 100644 --- a/docs/classtinyxml2_1_1_x_m_l_const_handle-members.html +++ b/docs/classtinyxml2_1_1_x_m_l_const_handle-members.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/classtinyxml2_1_1_x_m_l_const_handle.html b/docs/classtinyxml2_1_1_x_m_l_const_handle.html index 746c08a..4f5b6c5 100644 --- a/docs/classtinyxml2_1_1_x_m_l_const_handle.html +++ b/docs/classtinyxml2_1_1_x_m_l_const_handle.html @@ -79,7 +79,7 @@ $(function() { diff --git a/docs/classtinyxml2_1_1_x_m_l_declaration-members.html b/docs/classtinyxml2_1_1_x_m_l_declaration-members.html index 4e57bcd..416c830 100644 --- a/docs/classtinyxml2_1_1_x_m_l_declaration-members.html +++ b/docs/classtinyxml2_1_1_x_m_l_declaration-members.html @@ -105,7 +105,7 @@ $(function() { diff --git a/docs/classtinyxml2_1_1_x_m_l_declaration.html b/docs/classtinyxml2_1_1_x_m_l_declaration.html index 1055f11..a3e5d66 100644 --- a/docs/classtinyxml2_1_1_x_m_l_declaration.html +++ b/docs/classtinyxml2_1_1_x_m_l_declaration.html @@ -294,7 +294,7 @@ const char* xmlcstr = printer.CStr(); diff --git a/docs/classtinyxml2_1_1_x_m_l_document-members.html b/docs/classtinyxml2_1_1_x_m_l_document-members.html index 1d19769..e3d048d 100644 --- a/docs/classtinyxml2_1_1_x_m_l_document-members.html +++ b/docs/classtinyxml2_1_1_x_m_l_document-members.html @@ -128,7 +128,7 @@ $(function() { diff --git a/docs/classtinyxml2_1_1_x_m_l_document.html b/docs/classtinyxml2_1_1_x_m_l_document.html index c6f81ab..61d46e1 100644 --- a/docs/classtinyxml2_1_1_x_m_l_document.html +++ b/docs/classtinyxml2_1_1_x_m_l_document.html @@ -734,7 +734,7 @@ doc.Print( &printer ); diff --git a/docs/classtinyxml2_1_1_x_m_l_element-members.html b/docs/classtinyxml2_1_1_x_m_l_element-members.html index c8396c7..251fbf7 100644 --- a/docs/classtinyxml2_1_1_x_m_l_element-members.html +++ b/docs/classtinyxml2_1_1_x_m_l_element-members.html @@ -150,7 +150,7 @@ $(function() { diff --git a/docs/classtinyxml2_1_1_x_m_l_element.html b/docs/classtinyxml2_1_1_x_m_l_element.html index 34ad7f4..1b4af4e 100644 --- a/docs/classtinyxml2_1_1_x_m_l_element.html +++ b/docs/classtinyxml2_1_1_x_m_l_element.html @@ -700,7 +700,7 @@ QueryIntAttribute( "foo", &value ); // if "foo" isn't found, value will diff --git a/docs/classtinyxml2_1_1_x_m_l_handle-members.html b/docs/classtinyxml2_1_1_x_m_l_handle-members.html index 5d6b991..ee29d71 100644 --- a/docs/classtinyxml2_1_1_x_m_l_handle-members.html +++ b/docs/classtinyxml2_1_1_x_m_l_handle-members.html @@ -90,7 +90,7 @@ $(function() { diff --git a/docs/classtinyxml2_1_1_x_m_l_handle.html b/docs/classtinyxml2_1_1_x_m_l_handle.html index 143c292..c97e671 100644 --- a/docs/classtinyxml2_1_1_x_m_l_handle.html +++ b/docs/classtinyxml2_1_1_x_m_l_handle.html @@ -181,7 +181,7 @@ if ( child2 ) diff --git a/docs/classtinyxml2_1_1_x_m_l_node-members.html b/docs/classtinyxml2_1_1_x_m_l_node-members.html index 28f194c..b50e248 100644 --- a/docs/classtinyxml2_1_1_x_m_l_node-members.html +++ b/docs/classtinyxml2_1_1_x_m_l_node-members.html @@ -105,7 +105,7 @@ $(function() { diff --git a/docs/classtinyxml2_1_1_x_m_l_node.html b/docs/classtinyxml2_1_1_x_m_l_node.html index fee79b3..7ef3181 100644 --- a/docs/classtinyxml2_1_1_x_m_l_node.html +++ b/docs/classtinyxml2_1_1_x_m_l_node.html @@ -573,7 +573,7 @@ Text: the text string diff --git a/docs/classtinyxml2_1_1_x_m_l_printer-members.html b/docs/classtinyxml2_1_1_x_m_l_printer-members.html index bf5c2ca..cad8dc2 100644 --- a/docs/classtinyxml2_1_1_x_m_l_printer-members.html +++ b/docs/classtinyxml2_1_1_x_m_l_printer-members.html @@ -98,7 +98,7 @@ $(function() { diff --git a/docs/classtinyxml2_1_1_x_m_l_printer.html b/docs/classtinyxml2_1_1_x_m_l_printer.html index a9c492b..76237b2 100644 --- a/docs/classtinyxml2_1_1_x_m_l_printer.html +++ b/docs/classtinyxml2_1_1_x_m_l_printer.html @@ -402,7 +402,7 @@ printer.CloseElement(); diff --git a/docs/classtinyxml2_1_1_x_m_l_text-members.html b/docs/classtinyxml2_1_1_x_m_l_text-members.html index 6688804..ce0f317 100644 --- a/docs/classtinyxml2_1_1_x_m_l_text-members.html +++ b/docs/classtinyxml2_1_1_x_m_l_text-members.html @@ -107,7 +107,7 @@ $(function() { diff --git a/docs/classtinyxml2_1_1_x_m_l_text.html b/docs/classtinyxml2_1_1_x_m_l_text.html index 0ae5864..0a3b095 100644 --- a/docs/classtinyxml2_1_1_x_m_l_text.html +++ b/docs/classtinyxml2_1_1_x_m_l_text.html @@ -302,7 +302,7 @@ const char* xmlcstr = printer.CStr(); diff --git a/docs/classtinyxml2_1_1_x_m_l_unknown-members.html b/docs/classtinyxml2_1_1_x_m_l_unknown-members.html index b9d2a6a..e00b2e4 100644 --- a/docs/classtinyxml2_1_1_x_m_l_unknown-members.html +++ b/docs/classtinyxml2_1_1_x_m_l_unknown-members.html @@ -105,7 +105,7 @@ $(function() { diff --git a/docs/classtinyxml2_1_1_x_m_l_unknown.html b/docs/classtinyxml2_1_1_x_m_l_unknown.html index 7274825..52235fc 100644 --- a/docs/classtinyxml2_1_1_x_m_l_unknown.html +++ b/docs/classtinyxml2_1_1_x_m_l_unknown.html @@ -293,7 +293,7 @@ const char* xmlcstr = printer.CStr(); diff --git a/docs/classtinyxml2_1_1_x_m_l_visitor-members.html b/docs/classtinyxml2_1_1_x_m_l_visitor-members.html index a06aae6..dc04079 100644 --- a/docs/classtinyxml2_1_1_x_m_l_visitor-members.html +++ b/docs/classtinyxml2_1_1_x_m_l_visitor-members.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/classtinyxml2_1_1_x_m_l_visitor.html b/docs/classtinyxml2_1_1_x_m_l_visitor.html index 1751452..5333aec 100644 --- a/docs/classtinyxml2_1_1_x_m_l_visitor.html +++ b/docs/classtinyxml2_1_1_x_m_l_visitor.html @@ -130,7 +130,7 @@ virtual bool  diff --git a/docs/files.html b/docs/files.html index 1e17bfb..3569d82 100644 --- a/docs/files.html +++ b/docs/files.html @@ -71,7 +71,7 @@ $(function() { diff --git a/docs/functions.html b/docs/functions.html index 1b34f44..14c8996 100644 --- a/docs/functions.html +++ b/docs/functions.html @@ -533,7 +533,7 @@ $(function() { diff --git a/docs/functions_func.html b/docs/functions_func.html index 03ddd2e..bfc9182 100644 --- a/docs/functions_func.html +++ b/docs/functions_func.html @@ -533,7 +533,7 @@ $(function() { diff --git a/docs/hierarchy.html b/docs/hierarchy.html index 5a2435d..5c9166a 100644 --- a/docs/hierarchy.html +++ b/docs/hierarchy.html @@ -82,7 +82,7 @@ $(function() { diff --git a/docs/index.html b/docs/index.html index 9b08d16..e5171f8 100644 --- a/docs/index.html +++ b/docs/index.html @@ -222,7 +222,7 @@ printer.CloseElement(); diff --git a/docs/pages.html b/docs/pages.html index fefa1e2..8673889 100644 --- a/docs/pages.html +++ b/docs/pages.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/tinyxml2_8h_source.html b/docs/tinyxml2_8h_source.html index 673070a..30a2f3e 100644 --- a/docs/tinyxml2_8h_source.html +++ b/docs/tinyxml2_8h_source.html @@ -172,7 +172,7 @@ $(function() {