1562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project/*
2562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectwww.sourceforge.net/projects/tinyxml
3562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source ProjectOriginal code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
4562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
5562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source ProjectThis software is provided 'as-is', without any express or implied
6562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectwarranty. In no event will the authors be held liable for any
7562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectdamages arising from the use of this software.
8562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
9562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source ProjectPermission is granted to anyone to use this software for any
10562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectpurpose, including commercial applications, and to alter it and
11562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectredistribute it freely, subject to the following restrictions:
12562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
13562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project1. The origin of this software must not be misrepresented; you must
14562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectnot claim that you wrote the original software. If you use this
15562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectsoftware in a product, an acknowledgment in the product documentation
16562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectwould be appreciated but is not required.
17562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
18562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project2. Altered source versions must be plainly marked as such, and
19562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectmust not be misrepresented as being the original software.
20562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
21562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project3. This notice may not be removed or altered from any source
22562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectdistribution.
23562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project*/
24562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
25562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
26562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#ifndef TINYXML_INCLUDED
27562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#define TINYXML_INCLUDED
28562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
29562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#ifdef _MSC_VER
30562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#pragma warning( push )
31562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#pragma warning( disable : 4530 )
32562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#pragma warning( disable : 4786 )
33562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#endif
34562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
35562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#include <ctype.h>
36562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#include <stdio.h>
37562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#include <stdlib.h>
38562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#include <string.h>
39562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#include <assert.h>
40562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
41562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project// Help out windows:
42562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#if defined( _DEBUG ) && !defined( DEBUG )
43562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#define DEBUG
44562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#endif
45562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
46562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#if defined( DEBUG ) && defined( _MSC_VER )
47562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#include <windows.h>
48562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#define TIXML_LOG OutputDebugString
49562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#else
50562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#define TIXML_LOG printf
51562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#endif
52562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
53562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#ifdef TIXML_USE_STL
54562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#include <string>
55562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project 	#include <iostream>
56562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#define TIXML_STRING	std::string
57562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#define TIXML_ISTREAM	std::istream
58562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#define TIXML_OSTREAM	std::ostream
59562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#else
60562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#include "tinystr.h"
61562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#define TIXML_STRING	TiXmlString
62562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#define TIXML_OSTREAM	TiXmlOutStream
63562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#endif
64562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
65562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project// Deprecated library function hell. Compilers want to use the
66562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project// new safe versions. This probably doesn't fully address the problem,
67562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project// but it gets closer. There are too many compilers for me to fully
68562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project// test. If you get compilation troubles, undefine TIXML_SAFE
69562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
70562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#define TIXML_SAFE		// TinyXml isn't fully buffer overrun protected, safe code. This is work in progress.
71562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#ifdef TIXML_SAFE
72562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#if defined(_MSC_VER) && (_MSC_VER >= 1200 )
73562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		// Microsoft visual studio, version 6 and higher.
74562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		//#pragma message( "Using _sn* functions." )
75562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		#define TIXML_SNPRINTF _snprintf
76562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		#define TIXML_SNSCANF  _snscanf
77562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#elif defined(__GNUC__) && (__GNUC__ >= 3 )
78562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		// GCC version 3 and higher.s
79562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		//#warning( "Using sn* functions." )
80562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		#define TIXML_SNPRINTF snprintf
81562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		#define TIXML_SNSCANF  snscanf
82562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#endif
83562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#endif
84562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
85562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectclass TiXmlDocument;
86562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectclass TiXmlElement;
87562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectclass TiXmlComment;
88562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectclass TiXmlUnknown;
89562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectclass TiXmlAttribute;
90562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectclass TiXmlText;
91562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectclass TiXmlDeclaration;
92562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectclass TiXmlParsingData;
93562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
94562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectconst int TIXML_MAJOR_VERSION = 2;
95562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectconst int TIXML_MINOR_VERSION = 4;
96562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectconst int TIXML_PATCH_VERSION = 0;
97562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
98562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project/*	Internal structure for tracking location of items
99562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	in the XML file.
100562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project*/
101562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectstruct TiXmlCursor
102562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project{
103562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlCursor()		{ Clear(); }
104562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void Clear()		{ row = col = -1; }
105562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
106562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	int row;	// 0 based.
107562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	int col;	// 0 based.
108562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project};
109562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
110562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
111562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project// Only used by Attribute::Query functions
112562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectenum
113562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project{
114562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TIXML_SUCCESS,
115562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TIXML_NO_ATTRIBUTE,
116562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TIXML_WRONG_TYPE
117562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project};
118562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
119562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
120562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project// Used by the parsing routines.
121562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectenum TiXmlEncoding
122562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project{
123562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TIXML_ENCODING_UNKNOWN,
124562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TIXML_ENCODING_UTF8,
125562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TIXML_ENCODING_LEGACY
126562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project};
127562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
128562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectconst TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN;
129562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
130562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project/** TiXmlBase is a base class for every class in TinyXml.
131562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	It does little except to establish that TinyXml classes
132562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	can be printed and provide some utility functions.
133562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
134562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	In XML, the document and elements can contain
135562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	other elements and other types of nodes.
136562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
137562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	@verbatim
138562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	A Document can contain:	Element	(container or leaf)
139562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project							Comment (leaf)
140562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project							Unknown (leaf)
141562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project							Declaration( leaf )
142562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
143562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	An Element can contain:	Element (container or leaf)
144562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project							Text	(leaf)
145562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project							Attributes (not on tree)
146562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project							Comment (leaf)
147562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project							Unknown (leaf)
148562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
149562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	A Decleration contains: Attributes (not on tree)
150562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	@endverbatim
151562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project*/
152562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectclass TiXmlBase
153562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project{
154562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	friend class TiXmlNode;
155562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	friend class TiXmlElement;
156562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	friend class TiXmlDocument;
157562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
158562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectpublic:
159562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlBase()	:	userData(0) {}
160562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual ~TiXmlBase()					{}
161562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
162562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/**	All TinyXml classes can print themselves to a filestream.
163562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		This is a formatted print, and will insert tabs and newlines.
164562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
165562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		(For an unformatted stream, use the << operator.)
166562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
167562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual void Print( FILE* cfile, int depth ) const = 0;
168562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
169562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/**	The world does not agree on whether white space should be kept or
170562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		not. In order to make everyone happy, these global, static functions
171562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		are provided to set whether or not TinyXml will condense all white space
172562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		into a single space or not. The default is to condense. Note changing this
173562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		values is not thread safe.
174562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
175562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	static void SetCondenseWhiteSpace( bool condense )		{ condenseWhiteSpace = condense; }
176562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
177562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Return the current white space setting.
178562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	static bool IsWhiteSpaceCondensed()						{ return condenseWhiteSpace; }
179562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
180562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Return the position, in the original source file, of this node or attribute.
181562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		The row and column are 1-based. (That is the first row and first column is
182562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		1,1). If the returns values are 0 or less, then the parser does not have
183562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		a row and column value.
184562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
185562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		Generally, the row and column value will be set when the TiXmlDocument::Load(),
186562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		TiXmlDocument::LoadFile(), or any TiXmlNode::Parse() is called. It will NOT be set
187562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		when the DOM was created from operator>>.
188562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
189562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		The values reflect the initial load. Once the DOM is modified programmatically
190562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		(by adding or changing nodes and attributes) the new values will NOT update to
191562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		reflect changes in the document.
192562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
193562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		There is a minor performance cost to computing the row and column. Computation
194562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		can be disabled if TiXmlDocument::SetTabSize() is called with 0 as the value.
195562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
196562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		@sa TiXmlDocument::SetTabSize()
197562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
198562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	int Row() const			{ return location.row + 1; }
199562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	int Column() const		{ return location.col + 1; }	///< See Row()
200562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
201562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void  SetUserData( void* user )			{ userData = user; }
202562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void* GetUserData()						{ return userData; }
203562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
204562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	// Table that returs, for a given lead byte, the total number of bytes
205562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	// in the UTF-8 sequence.
206562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	static const int utf8ByteTable[256];
207562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
208562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual const char* Parse(	const char* p,
209562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project								TiXmlParsingData* data,
210562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project								TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0;
211562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
212562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	enum
213562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	{
214562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		TIXML_NO_ERROR = 0,
215562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		TIXML_ERROR,
216562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		TIXML_ERROR_OPENING_FILE,
217562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		TIXML_ERROR_OUT_OF_MEMORY,
218562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		TIXML_ERROR_PARSING_ELEMENT,
219562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME,
220562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		TIXML_ERROR_READING_ELEMENT_VALUE,
221562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		TIXML_ERROR_READING_ATTRIBUTES,
222562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		TIXML_ERROR_PARSING_EMPTY,
223562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		TIXML_ERROR_READING_END_TAG,
224562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		TIXML_ERROR_PARSING_UNKNOWN,
225562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		TIXML_ERROR_PARSING_COMMENT,
226562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		TIXML_ERROR_PARSING_DECLARATION,
227562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		TIXML_ERROR_DOCUMENT_EMPTY,
228562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		TIXML_ERROR_EMBEDDED_NULL,
229562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		TIXML_ERROR_PARSING_CDATA,
230562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
231562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		TIXML_ERROR_STRING_COUNT
232562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	};
233562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
234562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectprotected:
235562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
236562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	// See STL_STRING_BUG
237562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	// Utility class to overcome a bug.
238562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	class StringToBuffer
239562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	{
240562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	  public:
241562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		StringToBuffer( const TIXML_STRING& str );
242562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		~StringToBuffer();
243562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		char* buffer;
244562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	};
245562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
246562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	static const char*	SkipWhiteSpace( const char*, TiXmlEncoding encoding );
247562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	inline static bool	IsWhiteSpace( char c )
248562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	{
249562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' );
250562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	}
251562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
252562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual void StreamOut (TIXML_OSTREAM *) const = 0;
253562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
254562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#ifdef TIXML_USE_STL
255562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	    static bool	StreamWhiteSpace( TIXML_ISTREAM * in, TIXML_STRING * tag );
256562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	    static bool StreamTo( TIXML_ISTREAM * in, int character, TIXML_STRING * tag );
257562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#endif
258562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
259562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/*	Reads an XML name into the string provided. Returns
260562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		a pointer just past the last character of the name,
261562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		or 0 if the function has an error.
262562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
263562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding );
264562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
265562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/*	Reads text. Returns a pointer past the given end tag.
266562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		Wickedly complex options, but it keeps the (sensitive) code in one place.
267562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
268562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	static const char* ReadText(	const char* in,				// where to start
269562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project									TIXML_STRING* text,			// the string read
270562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project									bool ignoreWhiteSpace,		// whether to keep the white space
271562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project									const char* endTag,			// what ends this text
272562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project									bool ignoreCase,			// whether to ignore case in the end tag
273562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project									TiXmlEncoding encoding );	// the current encoding
274562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
275562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	// If an entity has been found, transform it into a character.
276562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding );
277562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
278562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	// Get a character, while interpreting entities.
279562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	// The length can be from 0 to 4 bytes.
280562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding )
281562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	{
282562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		assert( p );
283562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		if ( encoding == TIXML_ENCODING_UTF8 )
284562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		{
285562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			*length = utf8ByteTable[ *((unsigned char*)p) ];
286562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			assert( *length >= 0 && *length < 5 );
287562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		}
288562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		else
289562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		{
290562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			*length = 1;
291562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		}
292562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
293562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		if ( *length == 1 )
294562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		{
295562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			if ( *p == '&' )
296562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project				return GetEntity( p, _value, length, encoding );
297562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			*_value = *p;
298562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			return p+1;
299562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		}
300562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		else if ( *length )
301562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		{
302562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			//strncpy( _value, p, *length );	// lots of compilers don't like this function (unsafe),
303562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project												// and the null terminator isn't needed
304562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			for( int i=0; p[i] && i<*length; ++i ) {
305562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project				_value[i] = p[i];
306562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			}
307562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			return p + (*length);
308562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		}
309562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		else
310562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		{
311562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			// Not valid text.
312562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			return 0;
313562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		}
314562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	}
315562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
316562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	// Puts a string to a stream, expanding entities as it goes.
317562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	// Note this should not contian the '<', '>', etc, or they will be transformed into entities!
318562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	static void PutString( const TIXML_STRING& str, TIXML_OSTREAM* out );
319562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
320562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	static void PutString( const TIXML_STRING& str, TIXML_STRING* out );
321562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
322562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	// Return true if the next characters in the stream are any of the endTag sequences.
323562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	// Ignore case only works for english, and should only be relied on when comparing
324562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	// to English words: StringEqual( p, "version", true ) is fine.
325562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	static bool StringEqual(	const char* p,
326562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project								const char* endTag,
327562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project								bool ignoreCase,
328562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project								TiXmlEncoding encoding );
329562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
330562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	static const char* errorString[ TIXML_ERROR_STRING_COUNT ];
331562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
332562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlCursor location;
333562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
334562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project    /// Field containing a generic user pointer
335562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void*			userData;
336562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
337562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	// None of these methods are reliable for any language except English.
338562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	// Good for approximation, not great for accuracy.
339562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding );
340562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding );
341562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	inline static int ToLower( int v, TiXmlEncoding encoding )
342562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	{
343562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		if ( encoding == TIXML_ENCODING_UTF8 )
344562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		{
345562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			if ( v < 128 ) return tolower( v );
346562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			return v;
347562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		}
348562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		else
349562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		{
350562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			return tolower( v );
351562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		}
352562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	}
353562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length );
354562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
355562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectprivate:
356562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlBase( const TiXmlBase& );				// not implemented.
357562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void operator=( const TiXmlBase& base );	// not allowed.
358562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
359562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	struct Entity
360562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	{
361562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		const char*     str;
362562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		unsigned int	strLength;
363562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		char		    chr;
364562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	};
365562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	enum
366562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	{
367562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		NUM_ENTITY = 5,
368562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		MAX_ENTITY_LENGTH = 6
369562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
370562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	};
371562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	static Entity entity[ NUM_ENTITY ];
372562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	static bool condenseWhiteSpace;
373562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project};
374562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
375562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
376562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project/** The parent class for everything in the Document Object Model.
377562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	(Except for attributes).
378562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	Nodes have siblings, a parent, and children. A node can be
379562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	in a document, or stand on its own. The type of a TiXmlNode
380562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	can be queried, and it can be cast to its more defined type.
381562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project*/
382562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectclass TiXmlNode : public TiXmlBase
383562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project{
384562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	friend class TiXmlDocument;
385562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	friend class TiXmlElement;
386562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
387562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectpublic:
388562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#ifdef TIXML_USE_STL
389562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
390562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	    /** An input stream operator, for every class. Tolerant of newlines and
391562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		    formatting, but doesn't expect them.
392562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	    */
393562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	    friend std::istream& operator >> (std::istream& in, TiXmlNode& base);
394562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
395562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	    /** An output stream operator, for every class. Note that this outputs
396562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		    without any newlines or formatting, as opposed to Print(), which
397562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		    includes tabs and new lines.
398562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
399562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		    The operator<< and operator>> are not completely symmetric. Writing
400562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		    a node to a stream is very well defined. You'll get a nice stream
401562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		    of output, without any extra whitespace or newlines.
402562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
403562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		    But reading is not as well defined. (As it always is.) If you create
404562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		    a TiXmlElement (for example) and read that from an input stream,
405562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		    the text needs to define an element or junk will result. This is
406562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		    true of all input streams, but it's worth keeping in mind.
407562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
408562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		    A TiXmlDocument will read nodes until it reads a root element, and
409562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			all the children of that root element.
410562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	    */
411562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	    friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base);
412562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
413562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		/// Appends the XML node or attribute to a std::string.
414562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		friend std::string& operator<< (std::string& out, const TiXmlNode& base );
415562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
416562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#else
417562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	    // Used internally, not part of the public API.
418562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	    friend TIXML_OSTREAM& operator<< (TIXML_OSTREAM& out, const TiXmlNode& base);
419562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#endif
420562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
421562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** The types of XML nodes supported by TinyXml. (All the
422562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			unsupported types are picked up by UNKNOWN.)
423562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
424562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	enum NodeType
425562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	{
426562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		DOCUMENT,
427562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		ELEMENT,
428562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		COMMENT,
429562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		UNKNOWN,
430562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		TEXT,
431562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		DECLARATION,
432562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		TYPECOUNT
433562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	};
434562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
435562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual ~TiXmlNode();
436562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
437562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** The meaning of 'value' changes for the specific type of
438562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		TiXmlNode.
439562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		@verbatim
440562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		Document:	filename of the xml file
441562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		Element:	name of the element
442562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		Comment:	the comment text
443562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		Unknown:	the tag contents
444562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		Text:		the text string
445562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		@endverbatim
446562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
447562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		The subclasses will wrap this function.
448562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
449562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const char *Value() const { return value.c_str (); }
450562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
451562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project    #ifdef TIXML_USE_STL
452562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Return Value() as a std::string. If you only use STL,
453562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	    this is more efficient than calling Value().
454562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		Only available in STL mode.
455562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
456562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const std::string& ValueStr() const { return value; }
457562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#endif
458562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
459562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Changes the value of the node. Defined as:
460562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		@verbatim
461562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		Document:	filename of the xml file
462562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		Element:	name of the element
463562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		Comment:	the comment text
464562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		Unknown:	the tag contents
465562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		Text:		the text string
466562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		@endverbatim
467562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
468562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void SetValue(const char * _value) { value = _value;}
469562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
470562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project    #ifdef TIXML_USE_STL
471562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// STL std::string form.
472562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void SetValue( const std::string& _value )
473562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	{
474562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		StringToBuffer buf( _value );
475562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		SetValue( buf.buffer ? buf.buffer : "" );
476562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	}
477562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#endif
478562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
479562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Delete all the children of this node. Does not affect 'this'.
480562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void Clear();
481562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
482562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// One step up the DOM.
483562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode* Parent()							{ return parent; }
484562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlNode* Parent() const				{ return parent; }
485562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
486562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlNode* FirstChild()	const	{ return firstChild; }		///< The first child of this node. Will be null if there are no children.
487562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode* FirstChild()					{ return firstChild; }
488562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlNode* FirstChild( const char * value ) const;			///< The first child of this node with the matching 'value'. Will be null if none found.
489562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode* FirstChild( const char * value );						///< The first child of this node with the matching 'value'. Will be null if none found.
490562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
491562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlNode* LastChild() const	{ return lastChild; }		/// The last child of this node. Will be null if there are no children.
492562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode* LastChild()	{ return lastChild; }
493562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlNode* LastChild( const char * value ) const;			/// The last child of this node matching 'value'. Will be null if there are no children.
494562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode* LastChild( const char * value );
495562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
496562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project    #ifdef TIXML_USE_STL
497562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlNode* FirstChild( const std::string& _value ) const	{	return FirstChild (_value.c_str ());	}	///< STL std::string form.
498562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode* FirstChild( const std::string& _value )				{	return FirstChild (_value.c_str ());	}	///< STL std::string form.
499562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlNode* LastChild( const std::string& _value ) const	{	return LastChild (_value.c_str ());	}	///< STL std::string form.
500562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode* LastChild( const std::string& _value )				{	return LastChild (_value.c_str ());	}	///< STL std::string form.
501562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#endif
502562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
503562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** An alternate way to walk the children of a node.
504562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		One way to iterate over nodes is:
505562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		@verbatim
506562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			for( child = parent->FirstChild(); child; child = child->NextSibling() )
507562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		@endverbatim
508562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
509562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		IterateChildren does the same thing with the syntax:
510562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		@verbatim
511562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			child = 0;
512562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			while( child = parent->IterateChildren( child ) )
513562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		@endverbatim
514562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
515562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		IterateChildren takes the previous child as input and finds
516562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		the next one. If the previous child is null, it returns the
517562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		first. IterateChildren will return null when done.
518562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
519562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const;
520562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode* IterateChildren( TiXmlNode* previous );
521562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
522562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// This flavor of IterateChildren searches for children with a particular 'value'
523562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlNode* IterateChildren( const char * value, const TiXmlNode* previous ) const;
524562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode* IterateChildren( const char * value, TiXmlNode* previous );
525562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
526562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project    #ifdef TIXML_USE_STL
527562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const	{	return IterateChildren (_value.c_str (), previous);	}	///< STL std::string form.
528562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode* IterateChildren( const std::string& _value, TiXmlNode* previous ) {	return IterateChildren (_value.c_str (), previous);	}	///< STL std::string form.
529562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#endif
530562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
531562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Add a new node related to this. Adds a child past the LastChild.
532562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		Returns a pointer to the new object or NULL if an error occured.
533562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
534562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode* InsertEndChild( const TiXmlNode& addThis );
535562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
536562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
537562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Add a new node related to this. Adds a child past the LastChild.
538562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
539562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		NOTE: the node to be added is passed by pointer, and will be
540562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		henceforth owned (and deleted) by tinyXml. This method is efficient
541562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		and avoids an extra copy, but should be used with care as it
542562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		uses a different memory model than the other insert functions.
543562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
544562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		@sa InsertEndChild
545562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
546562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode* LinkEndChild( TiXmlNode* addThis );
547562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
548562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Add a new node related to this. Adds a child before the specified child.
549562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		Returns a pointer to the new object or NULL if an error occured.
550562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
551562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis );
552562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
553562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Add a new node related to this. Adds a child after the specified child.
554562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		Returns a pointer to the new object or NULL if an error occured.
555562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
556562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode* InsertAfterChild(  TiXmlNode* afterThis, const TiXmlNode& addThis );
557562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
558562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Replace a child of this node.
559562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		Returns a pointer to the new object or NULL if an error occured.
560562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
561562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis );
562562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
563562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Delete a child of this node.
564562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	bool RemoveChild( TiXmlNode* removeThis );
565562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
566562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Navigate to a sibling node.
567562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlNode* PreviousSibling() const			{ return prev; }
568562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode* PreviousSibling()						{ return prev; }
569562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
570562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Navigate to a sibling node.
571562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlNode* PreviousSibling( const char * ) const;
572562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode* PreviousSibling( const char * );
573562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
574562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project    #ifdef TIXML_USE_STL
575562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlNode* PreviousSibling( const std::string& _value ) const	{	return PreviousSibling (_value.c_str ());	}	///< STL std::string form.
576562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode* PreviousSibling( const std::string& _value ) 			{	return PreviousSibling (_value.c_str ());	}	///< STL std::string form.
577562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlNode* NextSibling( const std::string& _value) const		{	return NextSibling (_value.c_str ());	}	///< STL std::string form.
578562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode* NextSibling( const std::string& _value) 					{	return NextSibling (_value.c_str ());	}	///< STL std::string form.
579562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#endif
580562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
581562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Navigate to a sibling node.
582562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlNode* NextSibling() const				{ return next; }
583562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode* NextSibling()							{ return next; }
584562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
585562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Navigate to a sibling node with the given 'value'.
586562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlNode* NextSibling( const char * ) const;
587562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode* NextSibling( const char * );
588562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
589562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Convenience function to get through elements.
590562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		Calls NextSibling and ToElement. Will skip all non-Element
591562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		nodes. Returns 0 if there is not another element.
592562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
593562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlElement* NextSiblingElement() const;
594562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlElement* NextSiblingElement();
595562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
596562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Convenience function to get through elements.
597562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		Calls NextSibling and ToElement. Will skip all non-Element
598562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		nodes. Returns 0 if there is not another element.
599562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
600562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlElement* NextSiblingElement( const char * ) const;
601562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlElement* NextSiblingElement( const char * );
602562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
603562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project    #ifdef TIXML_USE_STL
604562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlElement* NextSiblingElement( const std::string& _value) const	{	return NextSiblingElement (_value.c_str ());	}	///< STL std::string form.
605562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlElement* NextSiblingElement( const std::string& _value)				{	return NextSiblingElement (_value.c_str ());	}	///< STL std::string form.
606562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#endif
607562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
608562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Convenience function to get through elements.
609562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlElement* FirstChildElement()	const;
610562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlElement* FirstChildElement();
611562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
612562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Convenience function to get through elements.
613562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlElement* FirstChildElement( const char * value ) const;
614562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlElement* FirstChildElement( const char * value );
615562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
616562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project    #ifdef TIXML_USE_STL
617562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlElement* FirstChildElement( const std::string& _value ) const	{	return FirstChildElement (_value.c_str ());	}	///< STL std::string form.
618562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlElement* FirstChildElement( const std::string& _value )				{	return FirstChildElement (_value.c_str ());	}	///< STL std::string form.
619562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#endif
620562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
621562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Query the type (as an enumerated value, above) of this node.
622562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		The possible types are: DOCUMENT, ELEMENT, COMMENT,
623562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project								UNKNOWN, TEXT, and DECLARATION.
624562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
625562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual int Type() const	{ return type; }
626562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
627562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Return a pointer to the Document this node lives in.
628562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		Returns null if not in a document.
629562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
630562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlDocument* GetDocument() const;
631562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlDocument* GetDocument();
632562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
633562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Returns true if this node has no children.
634562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	bool NoChildren() const						{ return !firstChild; }
635562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
636562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlDocument* ToDocument()	const		{ return ( this && type == DOCUMENT ) ? (const TiXmlDocument*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
637562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlElement*  ToElement() const			{ return ( this && type == ELEMENT  ) ? (const TiXmlElement*)  this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
638562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlComment*  ToComment() const			{ return ( this && type == COMMENT  ) ? (const TiXmlComment*)  this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
639562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlUnknown*  ToUnknown() const			{ return ( this && type == UNKNOWN  ) ? (const TiXmlUnknown*)  this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
640562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlText*	   ToText()    const		{ return ( this && type == TEXT     ) ? (const TiXmlText*)     this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
641562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlDeclaration* ToDeclaration() const	{ return ( this && type == DECLARATION ) ? (const TiXmlDeclaration*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
642562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
643562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlDocument* ToDocument()			{ return ( this && type == DOCUMENT ) ? (TiXmlDocument*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
644562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlElement*  ToElement()			{ return ( this && type == ELEMENT  ) ? (TiXmlElement*)  this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
645562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlComment*  ToComment()			{ return ( this && type == COMMENT  ) ? (TiXmlComment*)  this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
646562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlUnknown*  ToUnknown()			{ return ( this && type == UNKNOWN  ) ? (TiXmlUnknown*)  this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
647562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlText*	   ToText()   			{ return ( this && type == TEXT     ) ? (TiXmlText*)     this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
648562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlDeclaration* ToDeclaration()	{ return ( this && type == DECLARATION ) ? (TiXmlDeclaration*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
649562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
650562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Create an exact duplicate of this node and return it. The memory must be deleted
651562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		by the caller.
652562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
653562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual TiXmlNode* Clone() const = 0;
654562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
655562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectprotected:
656562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode( NodeType _type );
657562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
658562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	// Copy to the allocated object. Shared functionality between Clone, Copy constructor,
659562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	// and the assignment operator.
660562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void CopyTo( TiXmlNode* target ) const;
661562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
662562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#ifdef TIXML_USE_STL
663562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	    // The real work of the input operator.
664562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	    virtual void StreamIn( TIXML_ISTREAM* in, TIXML_STRING* tag ) = 0;
665562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#endif
666562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
667562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	// Figure out what is at *p, and parse it. Returns null if it is not an xml node.
668562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode* Identify( const char* start, TiXmlEncoding encoding );
669562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
670562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode*		parent;
671562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	NodeType		type;
672562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
673562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode*		firstChild;
674562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode*		lastChild;
675562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
676562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TIXML_STRING	value;
677562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
678562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode*		prev;
679562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode*		next;
680562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
681562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectprivate:
682562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode( const TiXmlNode& );				// not implemented.
683562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void operator=( const TiXmlNode& base );	// not allowed.
684562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project};
685562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
686562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
687562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project/** An attribute is a name-value pair. Elements have an arbitrary
688562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	number of attributes, each with a unique name.
689562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
690562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	@note The attributes are not TiXmlNodes, since they are not
691562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		  part of the tinyXML document object model. There are other
692562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		  suggested ways to look at this problem.
693562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project*/
694562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectclass TiXmlAttribute : public TiXmlBase
695562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project{
696562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	friend class TiXmlAttributeSet;
697562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
698562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectpublic:
699562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Construct an empty attribute.
700562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlAttribute() : TiXmlBase()
701562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	{
702562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		document = 0;
703562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		prev = next = 0;
704562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	}
705562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
706562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#ifdef TIXML_USE_STL
707562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// std::string constructor.
708562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlAttribute( const std::string& _name, const std::string& _value )
709562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	{
710562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		name = _name;
711562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		value = _value;
712562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		document = 0;
713562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		prev = next = 0;
714562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	}
715562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#endif
716562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
717562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Construct an attribute with a name and value.
718562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlAttribute( const char * _name, const char * _value )
719562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	{
720562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		name = _name;
721562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		value = _value;
722562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		document = 0;
723562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		prev = next = 0;
724562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	}
725562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
726562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const char*		Name()  const		{ return name.c_str (); }		///< Return the name of this attribute.
727562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const char*		Value() const		{ return value.c_str (); }		///< Return the value of this attribute.
728562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	int				IntValue() const;									///< Return the value of this attribute, converted to an integer.
729562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	double			DoubleValue() const;								///< Return the value of this attribute, converted to a double.
730562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
731562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** QueryIntValue examines the value string. It is an alternative to the
732562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		IntValue() method with richer error checking.
733562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		If the value is an integer, it is stored in 'value' and
734562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		the call returns TIXML_SUCCESS. If it is not
735562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		an integer, it returns TIXML_WRONG_TYPE.
736562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
737562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		A specialized but useful call. Note that for success it returns 0,
738562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		which is the opposite of almost all other TinyXml calls.
739562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
740562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	int QueryIntValue( int* _value ) const;
741562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// QueryDoubleValue examines the value string. See QueryIntValue().
742562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	int QueryDoubleValue( double* _value ) const;
743562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
744562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void SetName( const char* _name )	{ name = _name; }				///< Set the name of this attribute.
745562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void SetValue( const char* _value )	{ value = _value; }				///< Set the value.
746562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
747562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void SetIntValue( int _value );										///< Set the value from an integer.
748562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void SetDoubleValue( double _value );								///< Set the value from a double.
749562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
750562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project    #ifdef TIXML_USE_STL
751562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// STL std::string form.
752562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void SetName( const std::string& _name )
753562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	{
754562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		StringToBuffer buf( _name );
755562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		SetName ( buf.buffer ? buf.buffer : "error" );
756562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	}
757562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// STL std::string form.
758562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void SetValue( const std::string& _value )
759562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	{
760562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		StringToBuffer buf( _value );
761562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		SetValue( buf.buffer ? buf.buffer : "error" );
762562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	}
763562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#endif
764562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
765562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Get the next sibling attribute in the DOM. Returns null at end.
766562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlAttribute* Next() const;
767562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlAttribute* Next();
768562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Get the previous sibling attribute in the DOM. Returns null at beginning.
769562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlAttribute* Previous() const;
770562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlAttribute* Previous();
771562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
772562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; }
773562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	bool operator<( const TiXmlAttribute& rhs )	 const { return name < rhs.name; }
774562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	bool operator>( const TiXmlAttribute& rhs )  const { return name > rhs.name; }
775562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
776562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/*	Attribute parsing starts: first letter of the name
777562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project						 returns: the next char after the value end quote
778562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
779562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
780562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
781562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	// Prints this Attribute to a FILE stream.
782562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual void Print( FILE* cfile, int depth ) const;
783562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
784562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual void StreamOut( TIXML_OSTREAM * out ) const;
785562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	// [internal use]
786562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	// Set the document pointer so the attribute can report errors.
787562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void SetDocument( TiXmlDocument* doc )	{ document = doc; }
788562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
789562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectprivate:
790562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlAttribute( const TiXmlAttribute& );				// not implemented.
791562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void operator=( const TiXmlAttribute& base );	// not allowed.
792562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
793562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlDocument*	document;	// A pointer back to a document, for error reporting.
794562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TIXML_STRING name;
795562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TIXML_STRING value;
796562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlAttribute*	prev;
797562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlAttribute*	next;
798562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project};
799562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
800562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
801562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project/*	A class used to manage a group of attributes.
802562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	It is only used internally, both by the ELEMENT and the DECLARATION.
803562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
804562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	The set can be changed transparent to the Element and Declaration
805562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	classes that use it, but NOT transparent to the Attribute
806562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	which has to implement a next() and previous() method. Which makes
807562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	it a bit problematic and prevents the use of STL.
808562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
809562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	This version is implemented with circular lists because:
810562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		- I like circular lists
811562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		- it demonstrates some independence from the (typical) doubly linked list.
812562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project*/
813562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectclass TiXmlAttributeSet
814562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project{
815562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectpublic:
816562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlAttributeSet();
817562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	~TiXmlAttributeSet();
818562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
819562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void Add( TiXmlAttribute* attribute );
820562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void Remove( TiXmlAttribute* attribute );
821562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
822562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlAttribute* First()	const	{ return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
823562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlAttribute* First()					{ return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
824562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlAttribute* Last() const		{ return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
825562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlAttribute* Last()					{ return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
826562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
827562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlAttribute*	Find( const char * name ) const;
828562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlAttribute*	Find( const char * name );
829562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
830562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectprivate:
831562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	//*ME:	Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element),
832562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	//*ME:	this class must be also use a hidden/disabled copy-constructor !!!
833562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlAttributeSet( const TiXmlAttributeSet& );	// not allowed
834562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void operator=( const TiXmlAttributeSet& );	// not allowed (as TiXmlAttribute)
835562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
836562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlAttribute sentinel;
837562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project};
838562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
839562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
840562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project/** The element is a container class. It has a value, the element name,
841562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	and can contain other elements, text, comments, and unknowns.
842562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	Elements also contain an arbitrary number of attributes.
843562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project*/
844562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectclass TiXmlElement : public TiXmlNode
845562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project{
846562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectpublic:
847562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Construct an element.
848562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlElement (const char * in_value);
849562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
850562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#ifdef TIXML_USE_STL
851562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// std::string constructor.
852562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlElement( const std::string& _value );
853562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#endif
854562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
855562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlElement( const TiXmlElement& );
856562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
857562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void operator=( const TiXmlElement& base );
858562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
859562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual ~TiXmlElement();
860562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
861562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Given an attribute name, Attribute() returns the value
862562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		for the attribute of that name, or null if none exists.
863562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
864562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const char* Attribute( const char* name ) const;
865562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
866562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Given an attribute name, Attribute() returns the value
867562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		for the attribute of that name, or null if none exists.
868562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		If the attribute exists and can be converted to an integer,
869562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		the integer value will be put in the return 'i', if 'i'
870562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		is non-null.
871562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
872562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const char* Attribute( const char* name, int* i ) const;
873562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
874562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Given an attribute name, Attribute() returns the value
875562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		for the attribute of that name, or null if none exists.
876562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		If the attribute exists and can be converted to an double,
877562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		the double value will be put in the return 'd', if 'd'
878562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		is non-null.
879562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
880562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const char* Attribute( const char* name, double* d ) const;
881562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
882562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** QueryIntAttribute examines the attribute - it is an alternative to the
883562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		Attribute() method with richer error checking.
884562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		If the attribute is an integer, it is stored in 'value' and
885562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		the call returns TIXML_SUCCESS. If it is not
886562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		an integer, it returns TIXML_WRONG_TYPE. If the attribute
887562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		does not exist, then TIXML_NO_ATTRIBUTE is returned.
888562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
889562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	int QueryIntAttribute( const char* name, int* _value ) const;
890562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// QueryDoubleAttribute examines the attribute - see QueryIntAttribute().
891562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	int QueryDoubleAttribute( const char* name, double* _value ) const;
892562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// QueryFloatAttribute examines the attribute - see QueryIntAttribute().
893562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	int QueryFloatAttribute( const char* name, float* _value ) const {
894562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		double d;
895562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		int result = QueryDoubleAttribute( name, &d );
896562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		if ( result == TIXML_SUCCESS ) {
897562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			*_value = (float)d;
898562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		}
899562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		return result;
900562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	}
901562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
902562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Sets an attribute of name to a given value. The attribute
903562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		will be created if it does not exist, or changed if it does.
904562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
905562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void SetAttribute( const char* name, const char * _value );
906562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
907562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project    #ifdef TIXML_USE_STL
908562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const char* Attribute( const std::string& name ) const				{ return Attribute( name.c_str() ); }
909562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const char* Attribute( const std::string& name, int* i ) const		{ return Attribute( name.c_str(), i ); }
910562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const char* Attribute( const std::string& name, double* d ) const	{ return Attribute( name.c_str(), d ); }
911562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	int QueryIntAttribute( const std::string& name, int* _value ) const	{ return QueryIntAttribute( name.c_str(), _value ); }
912562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	int QueryDoubleAttribute( const std::string& name, double* _value ) const { return QueryDoubleAttribute( name.c_str(), _value ); }
913562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
914562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// STL std::string form.
915562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void SetAttribute( const std::string& name, const std::string& _value )
916562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	{
917562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		StringToBuffer n( name );
918562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		StringToBuffer v( _value );
919562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		if ( n.buffer && v.buffer )
920562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			SetAttribute (n.buffer, v.buffer );
921562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	}
922562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	///< STL std::string form.
923562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void SetAttribute( const std::string& name, int _value )
924562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	{
925562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		StringToBuffer n( name );
926562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		if ( n.buffer )
927562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			SetAttribute (n.buffer, _value);
928562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	}
929562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#endif
930562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
931562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Sets an attribute of name to a given value. The attribute
932562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		will be created if it does not exist, or changed if it does.
933562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
934562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void SetAttribute( const char * name, int value );
935562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
936562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Sets an attribute of name to a given value. The attribute
937562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		will be created if it does not exist, or changed if it does.
938562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
939562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void SetDoubleAttribute( const char * name, double value );
940562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
941562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Deletes an attribute with the given name.
942562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
943562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void RemoveAttribute( const char * name );
944562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project    #ifdef TIXML_USE_STL
945562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void RemoveAttribute( const std::string& name )	{	RemoveAttribute (name.c_str ());	}	///< STL std::string form.
946562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#endif
947562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
948562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlAttribute* FirstAttribute() const	{ return attributeSet.First(); }		///< Access the first attribute in this element.
949562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlAttribute* FirstAttribute() 				{ return attributeSet.First(); }
950562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlAttribute* LastAttribute()	const 	{ return attributeSet.Last(); }		///< Access the last attribute in this element.
951562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlAttribute* LastAttribute()					{ return attributeSet.Last(); }
952562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
953562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Convenience function for easy access to the text inside an element. Although easy
954562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		and concise, GetText() is limited compared to getting the TiXmlText child
955562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		and accessing it directly.
956562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
957562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		If the first child of 'this' is a TiXmlText, the GetText()
958562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		returs the character string of the Text node, else null is returned.
959562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
960562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		This is a convenient method for getting the text of simple contained text:
961562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		@verbatim
962562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		<foo>This is text</foo>
963562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		const char* str = fooElement->GetText();
964562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		@endverbatim
965562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
966562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		'str' will be a pointer to "This is text".
967562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
968562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		Note that this function can be misleading. If the element foo was created from
969562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		this XML:
970562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		@verbatim
971562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		<foo><b>This is text</b></foo>
972562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		@endverbatim
973562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
974562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		then the value of str would be null. The first child node isn't a text node, it is
975562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		another element. From this XML:
976562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		@verbatim
977562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		<foo>This is <b>text</b></foo>
978562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		@endverbatim
979562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		GetText() will return "This is ".
980562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
981562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		WARNING: GetText() accesses a child node - don't become confused with the
982562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project				 similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are
983562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project				 safe type casts on the referenced node.
984562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
985562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const char* GetText() const;
986562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
987562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Creates a new Element and returns it - the returned element is a copy.
988562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual TiXmlNode* Clone() const;
989562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	// Print the Element to a FILE stream.
990562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual void Print( FILE* cfile, int depth ) const;
991562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
992562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/*	Attribtue parsing starts: next char past '<'
993562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project						 returns: next char past '>'
994562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
995562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
996562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
997562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectprotected:
998562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
999562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void CopyTo( TiXmlElement* target ) const;
1000562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void ClearThis();	// like clear, but initializes 'this' object as well
1001562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1002562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	// Used to be public [internal use]
1003562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#ifdef TIXML_USE_STL
1004562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	    virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
1005562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#endif
1006562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual void StreamOut( TIXML_OSTREAM * out ) const;
1007562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1008562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/*	[internal use]
1009562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		Reads the "value" of the element -- another element, or text.
1010562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		This should terminate with the current end tag.
1011562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
1012562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding );
1013562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1014562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectprivate:
1015562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1016562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlAttributeSet attributeSet;
1017562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project};
1018562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1019562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1020562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project/**	An XML comment.
1021562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project*/
1022562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectclass TiXmlComment : public TiXmlNode
1023562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project{
1024562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectpublic:
1025562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Constructs an empty comment.
1026562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlComment() : TiXmlNode( TiXmlNode::COMMENT ) {}
1027562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlComment( const TiXmlComment& );
1028562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void operator=( const TiXmlComment& base );
1029562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1030562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual ~TiXmlComment()	{}
1031562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1032562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Returns a copy of this Comment.
1033562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual TiXmlNode* Clone() const;
1034562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Write this Comment to a FILE stream.
1035562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual void Print( FILE* cfile, int depth ) const;
1036562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1037562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/*	Attribtue parsing starts: at the ! of the !--
1038562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project						 returns: next char past '>'
1039562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
1040562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1041562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1042562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectprotected:
1043562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void CopyTo( TiXmlComment* target ) const;
1044562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1045562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	// used to be public
1046562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#ifdef TIXML_USE_STL
1047562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	    virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
1048562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#endif
1049562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual void StreamOut( TIXML_OSTREAM * out ) const;
1050562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1051562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectprivate:
1052562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1053562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project};
1054562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1055562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1056562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project/** XML text. A text node can have 2 ways to output the next. "normal" output
1057562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	and CDATA. It will default to the mode it was parsed from the XML file and
1058562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	you generally want to leave it alone, but you can change the output mode with
1059562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	SetCDATA() and query it with CDATA().
1060562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project*/
1061562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectclass TiXmlText : public TiXmlNode
1062562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project{
1063562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	friend class TiXmlElement;
1064562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectpublic:
1065562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Constructor for text element. By default, it is treated as
1066562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		normal, encoded text. If you want it be output as a CDATA text
1067562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		element, set the parameter _cdata to 'true'
1068562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
1069562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlText (const char * initValue ) : TiXmlNode (TiXmlNode::TEXT)
1070562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	{
1071562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		SetValue( initValue );
1072562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		cdata = false;
1073562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	}
1074562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual ~TiXmlText() {}
1075562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1076562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#ifdef TIXML_USE_STL
1077562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Constructor.
1078562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TEXT)
1079562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	{
1080562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		SetValue( initValue );
1081562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		cdata = false;
1082562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	}
1083562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#endif
1084562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1085562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TEXT )	{ copy.CopyTo( this ); }
1086562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void operator=( const TiXmlText& base )							 	{ base.CopyTo( this ); }
1087562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1088562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Write this text object to a FILE stream.
1089562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual void Print( FILE* cfile, int depth ) const;
1090562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1091562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Queries whether this represents text using a CDATA section.
1092562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	bool CDATA()					{ return cdata; }
1093562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Turns on or off a CDATA representation of text.
1094562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void SetCDATA( bool _cdata )	{ cdata = _cdata; }
1095562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1096562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1097562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1098562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectprotected :
1099562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	///  [internal use] Creates a new Element and returns it.
1100562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual TiXmlNode* Clone() const;
1101562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void CopyTo( TiXmlText* target ) const;
1102562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1103562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual void StreamOut ( TIXML_OSTREAM * out ) const;
1104562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	bool Blank() const;	// returns true if all white space and new lines
1105562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	// [internal use]
1106562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#ifdef TIXML_USE_STL
1107562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	    virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
1108562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#endif
1109562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1110562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectprivate:
1111562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	bool cdata;			// true if this should be input and output as a CDATA style text element
1112562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project};
1113562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1114562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1115562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project/** In correct XML the declaration is the first entry in the file.
1116562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	@verbatim
1117562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		<?xml version="1.0" standalone="yes"?>
1118562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	@endverbatim
1119562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1120562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TinyXml will happily read or write files without a declaration,
1121562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	however. There are 3 possible attributes to the declaration:
1122562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	version, encoding, and standalone.
1123562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1124562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	Note: In this version of the code, the attributes are
1125562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	handled as special cases, not generic attributes, simply
1126562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	because there can only be at most 3 and they are always the same.
1127562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project*/
1128562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectclass TiXmlDeclaration : public TiXmlNode
1129562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project{
1130562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectpublic:
1131562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Construct an empty declaration.
1132562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlDeclaration()   : TiXmlNode( TiXmlNode::DECLARATION ) {}
1133562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1134562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#ifdef TIXML_USE_STL
1135562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Constructor.
1136562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlDeclaration(	const std::string& _version,
1137562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project						const std::string& _encoding,
1138562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project						const std::string& _standalone );
1139562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#endif
1140562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1141562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Construct.
1142562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlDeclaration(	const char* _version,
1143562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project						const char* _encoding,
1144562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project						const char* _standalone );
1145562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1146562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlDeclaration( const TiXmlDeclaration& copy );
1147562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void operator=( const TiXmlDeclaration& copy );
1148562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1149562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual ~TiXmlDeclaration()	{}
1150562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1151562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Version. Will return an empty string if none was found.
1152562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const char *Version() const			{ return version.c_str (); }
1153562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Encoding. Will return an empty string if none was found.
1154562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const char *Encoding() const		{ return encoding.c_str (); }
1155562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Is this a standalone document?
1156562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const char *Standalone() const		{ return standalone.c_str (); }
1157562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1158562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Creates a copy of this Declaration and returns it.
1159562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual TiXmlNode* Clone() const;
1160562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Print this declaration to a FILE stream.
1161562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual void Print( FILE* cfile, int depth ) const;
1162562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1163562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1164562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1165562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectprotected:
1166562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void CopyTo( TiXmlDeclaration* target ) const;
1167562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	// used to be public
1168562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#ifdef TIXML_USE_STL
1169562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	    virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
1170562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#endif
1171562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual void StreamOut ( TIXML_OSTREAM * out) const;
1172562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1173562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectprivate:
1174562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1175562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TIXML_STRING version;
1176562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TIXML_STRING encoding;
1177562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TIXML_STRING standalone;
1178562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project};
1179562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1180562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1181562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project/** Any tag that tinyXml doesn't recognize is saved as an
1182562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	unknown. It is a tag of text, but should not be modified.
1183562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	It will be written back to the XML, unchanged, when the file
1184562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	is saved.
1185562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1186562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	DTD tags get thrown into TiXmlUnknowns.
1187562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project*/
1188562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectclass TiXmlUnknown : public TiXmlNode
1189562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project{
1190562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectpublic:
1191562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlUnknown() : TiXmlNode( TiXmlNode::UNKNOWN )	{}
1192562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual ~TiXmlUnknown() {}
1193562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1194562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::UNKNOWN )		{ copy.CopyTo( this ); }
1195562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void operator=( const TiXmlUnknown& copy )										{ copy.CopyTo( this ); }
1196562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1197562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Creates a copy of this Unknown and returns it.
1198562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual TiXmlNode* Clone() const;
1199562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Print this Unknown to a FILE stream.
1200562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual void Print( FILE* cfile, int depth ) const;
1201562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1202562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1203562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1204562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectprotected:
1205562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void CopyTo( TiXmlUnknown* target ) const;
1206562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1207562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#ifdef TIXML_USE_STL
1208562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	    virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
1209562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#endif
1210562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual void StreamOut ( TIXML_OSTREAM * out ) const;
1211562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1212562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectprivate:
1213562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1214562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project};
1215562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1216562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1217562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project/** Always the top level node. A document binds together all the
1218562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	XML pieces. It can be saved, loaded, and printed to the screen.
1219562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	The 'value' of a document node is the xml file name.
1220562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project*/
1221562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectclass TiXmlDocument : public TiXmlNode
1222562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project{
1223562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectpublic:
1224562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Create an empty document, that has no name.
1225562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlDocument();
1226562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Create a document with a name. The name of the document is also the filename of the xml.
1227562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlDocument( const char * documentName );
1228562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1229562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#ifdef TIXML_USE_STL
1230562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Constructor.
1231562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlDocument( const std::string& documentName );
1232562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#endif
1233562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1234562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlDocument( const TiXmlDocument& copy );
1235562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void operator=( const TiXmlDocument& copy );
1236562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1237562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual ~TiXmlDocument() {}
1238562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1239562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Load a file using the current document value.
1240562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		Returns true if successful. Will delete any existing
1241562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		document data before loading.
1242562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
1243562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1244562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Save a file using the current document value. Returns true if successful.
1245562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	bool SaveFile() const;
1246562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Load a file using the given filename. Returns true if successful.
1247562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	bool LoadFile( const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1248562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Save a file using the given filename. Returns true if successful.
1249562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	bool SaveFile( const char * filename ) const;
1250562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1251562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#ifdef TIXML_USE_STL
1252562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING )			///< STL std::string version.
1253562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	{
1254562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		StringToBuffer f( filename );
1255562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		return ( f.buffer && LoadFile( f.buffer, encoding ));
1256562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	}
1257562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	bool SaveFile( const std::string& filename ) const		///< STL std::string version.
1258562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	{
1259562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		StringToBuffer f( filename );
1260562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		return ( f.buffer && SaveFile( f.buffer ));
1261562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	}
1262562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#endif
1263562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1264562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Parse the given null terminated block of xml data. Passing in an encoding to this
1265562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		method (either TIXML_ENCODING_LEGACY or TIXML_ENCODING_UTF8 will force TinyXml
1266562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		to use that encoding, regardless of what TinyXml might otherwise try to detect.
1267562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
1268562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual const char* Parse( const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1269562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1270562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Get the root element -- the only top level element -- of the document.
1271562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		In well formed XML, there should only be one. TinyXml is tolerant of
1272562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		multiple elements at the document level.
1273562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
1274562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const TiXmlElement* RootElement() const		{ return FirstChildElement(); }
1275562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlElement* RootElement()					{ return FirstChildElement(); }
1276562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1277562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** If an error occurs, Error will be set to true. Also,
1278562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		- The ErrorId() will contain the integer identifier of the error (not generally useful)
1279562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		- The ErrorDesc() method will return the name of the error. (very useful)
1280562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		- The ErrorRow() and ErrorCol() will return the location of the error (if known)
1281562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
1282562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	bool Error() const						{ return error; }
1283562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1284562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Contains a textual (english) description of the error if one occurs.
1285562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	const char * ErrorDesc() const	{ return errorDesc.c_str (); }
1286562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1287562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Generally, you probably want the error string ( ErrorDesc() ). But if you
1288562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		prefer the ErrorId, this function will fetch it.
1289562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
1290562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	int ErrorId()	const				{ return errorId; }
1291562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1292562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Returns the location (if known) of the error. The first column is column 1,
1293562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		and the first row is row 1. A value of 0 means the row and column wasn't applicable
1294562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		(memory errors, for example, have no row/column) or the parser lost the error. (An
1295562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		error in the error reporting, in that case.)
1296562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1297562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		@sa SetTabSize, Row, Column
1298562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
1299562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	int ErrorRow()	{ return errorLocation.row+1; }
1300562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	int ErrorCol()	{ return errorLocation.col+1; }	///< The column where the error occured. See ErrorRow()
1301562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1302562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** SetTabSize() allows the error reporting functions (ErrorRow() and ErrorCol())
1303562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		to report the correct values for row and column. It does not change the output
1304562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		or input in any way.
1305562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1306562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		By calling this method, with a tab size
1307562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		greater than 0, the row and column of each node and attribute is stored
1308562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		when the file is loaded. Very useful for tracking the DOM back in to
1309562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		the source file.
1310562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1311562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		The tab size is required for calculating the location of nodes. If not
1312562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		set, the default of 4 is used. The tabsize is set per document. Setting
1313562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		the tabsize to 0 disables row/column tracking.
1314562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1315562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		Note that row and column tracking is not supported when using operator>>.
1316562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1317562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		The tab size needs to be enabled before the parse or load. Correct usage:
1318562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		@verbatim
1319562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		TiXmlDocument doc;
1320562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		doc.SetTabSize( 8 );
1321562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		doc.Load( "myfile.xml" );
1322562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		@endverbatim
1323562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1324562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		@sa Row, Column
1325562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
1326562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void SetTabSize( int _tabsize )		{ tabsize = _tabsize; }
1327562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1328562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	int TabSize() const	{ return tabsize; }
1329562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1330562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** If you have handled the error, it can be reset with this call. The error
1331562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		state is automatically cleared if you Parse a new XML block.
1332562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
1333562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void ClearError()						{	error = false;
1334562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project												errorId = 0;
1335562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project												errorDesc = "";
1336562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project												errorLocation.row = errorLocation.col = 0;
1337562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project												//errorLocation.last = 0;
1338562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project											}
1339562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1340562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Dump the document to standard out. */
1341562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void Print() const						{ Print( stdout, 0 ); }
1342562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1343562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Print this Document to a FILE stream.
1344562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual void Print( FILE* cfile, int depth = 0 ) const;
1345562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	// [internal use]
1346562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding );
1347562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1348562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectprotected :
1349562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual void StreamOut ( TIXML_OSTREAM * out) const;
1350562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	// [internal use]
1351562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	virtual TiXmlNode* Clone() const;
1352562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#ifdef TIXML_USE_STL
1353562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	    virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
1354562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#endif
1355562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1356562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectprivate:
1357562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	void CopyTo( TiXmlDocument* target ) const;
1358562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1359562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	bool error;
1360562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	int  errorId;
1361562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TIXML_STRING errorDesc;
1362562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	int tabsize;
1363562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlCursor errorLocation;
1364562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	bool useMicrosoftBOM;		// the UTF-8 BOM were found when read. Note this, and try to write.
1365562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project};
1366562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1367562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1368562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project/**
1369562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	A TiXmlHandle is a class that wraps a node pointer with null checks; this is
1370562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	an incredibly useful thing. Note that TiXmlHandle is not part of the TinyXml
1371562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	DOM structure. It is a separate utility class.
1372562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1373562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	Take an example:
1374562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	@verbatim
1375562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	<Document>
1376562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		<Element attributeA = "valueA">
1377562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			<Child attributeB = "value1" />
1378562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			<Child attributeB = "value2" />
1379562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		</Element>
1380562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	<Document>
1381562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	@endverbatim
1382562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1383562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very
1384562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	easy to write a *lot* of code that looks like:
1385562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1386562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	@verbatim
1387562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlElement* root = document.FirstChildElement( "Document" );
1388562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	if ( root )
1389562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	{
1390562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		TiXmlElement* element = root->FirstChildElement( "Element" );
1391562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		if ( element )
1392562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		{
1393562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			TiXmlElement* child = element->FirstChildElement( "Child" );
1394562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			if ( child )
1395562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			{
1396562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project				TiXmlElement* child2 = child->NextSiblingElement( "Child" );
1397562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project				if ( child2 )
1398562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project				{
1399562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project					// Finally do something useful.
1400562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	@endverbatim
1401562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1402562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	And that doesn't even cover "else" cases. TiXmlHandle addresses the verbosity
1403562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	of such code. A TiXmlHandle checks for null	pointers so it is perfectly safe
1404562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	and correct to use:
1405562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1406562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	@verbatim
1407562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlHandle docHandle( &document );
1408562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlElement* child2 = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", 1 ).Element();
1409562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	if ( child2 )
1410562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	{
1411562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		// do something useful
1412562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	@endverbatim
1413562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1414562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	Which is MUCH more concise and useful.
1415562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1416562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	It is also safe to copy handles - internally they are nothing more than node pointers.
1417562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	@verbatim
1418562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlHandle handleCopy = handle;
1419562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	@endverbatim
1420562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1421562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	What they should not be used for is iteration:
1422562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1423562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	@verbatim
1424562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	int i=0;
1425562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	while ( true )
1426562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	{
1427562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", i ).Element();
1428562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		if ( !child )
1429562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project			break;
1430562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		// do something
1431562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		++i;
1432562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	}
1433562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	@endverbatim
1434562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1435562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	It seems reasonable, but it is in fact two embedded while loops. The Child method is
1436562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	a linear walk to find the element, so this code would iterate much more than it needs
1437562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	to. Instead, prefer:
1438562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1439562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	@verbatim
1440562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).FirstChild( "Child" ).Element();
1441562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1442562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	for( child; child; child=child->NextSiblingElement() )
1443562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	{
1444562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		// do something
1445562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	}
1446562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	@endverbatim
1447562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project*/
1448562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectclass TiXmlHandle
1449562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project{
1450562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectpublic:
1451562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Create a handle from any node (at any depth of the tree.) This can be a null pointer.
1452562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlHandle( TiXmlNode* _node )					{ this->node = _node; }
1453562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Copy constructor
1454562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlHandle( const TiXmlHandle& ref )			{ this->node = ref.node; }
1455562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlHandle operator=( const TiXmlHandle& ref ) { this->node = ref.node; return *this; }
1456562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1457562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Return a handle to the first child node.
1458562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlHandle FirstChild() const;
1459562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Return a handle to the first child node with the given name.
1460562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlHandle FirstChild( const char * value ) const;
1461562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Return a handle to the first child element.
1462562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlHandle FirstChildElement() const;
1463562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Return a handle to the first child element with the given name.
1464562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlHandle FirstChildElement( const char * value ) const;
1465562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1466562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Return a handle to the "index" child with the given name.
1467562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		The first child is 0, the second 1, etc.
1468562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
1469562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlHandle Child( const char* value, int index ) const;
1470562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Return a handle to the "index" child.
1471562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		The first child is 0, the second 1, etc.
1472562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
1473562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlHandle Child( int index ) const;
1474562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Return a handle to the "index" child element with the given name.
1475562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		The first child element is 0, the second 1, etc. Note that only TiXmlElements
1476562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		are indexed: other types are not counted.
1477562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
1478562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlHandle ChildElement( const char* value, int index ) const;
1479562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/** Return a handle to the "index" child element.
1480562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		The first child element is 0, the second 1, etc. Note that only TiXmlElements
1481562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project		are indexed: other types are not counted.
1482562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	*/
1483562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlHandle ChildElement( int index ) const;
1484562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1485562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#ifdef TIXML_USE_STL
1486562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlHandle FirstChild( const std::string& _value ) const				{ return FirstChild( _value.c_str() ); }
1487562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlHandle FirstChildElement( const std::string& _value ) const		{ return FirstChildElement( _value.c_str() ); }
1488562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1489562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlHandle Child( const std::string& _value, int index ) const			{ return Child( _value.c_str(), index ); }
1490562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlHandle ChildElement( const std::string& _value, int index ) const	{ return ChildElement( _value.c_str(), index ); }
1491562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	#endif
1492562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1493562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Return the handle as a TiXmlNode. This may return null.
1494562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode* Node() const			{ return node; }
1495562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Return the handle as a TiXmlElement. This may return null.
1496562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlElement* Element() const	{ return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); }
1497562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Return the handle as a TiXmlText. This may return null.
1498562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlText* Text() const			{ return ( ( node && node->ToText() ) ? node->ToText() : 0 ); }
1499562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	/// Return the handle as a TiXmlUnknown. This may return null;
1500562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlUnknown* Unknown() const			{ return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); }
1501562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1502562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Projectprivate:
1503562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project	TiXmlNode* node;
1504562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project};
1505562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1506562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#ifdef _MSC_VER
1507562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#pragma warning( pop )
1508562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#endif
1509562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1510562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project#endif
1511562be06492c3ac43adf153f550abaede6bc18a44The Android Open Source Project
1512