GEAR  1.6.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Friends Pages
tinyxml.cc
1 /*
2 www.sourceforge.net/projects/tinyxml
3 Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
4 
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any
7 damages arising from the use of this software.
8 
9 Permission is granted to anyone to use this software for any
10 purpose, including commercial applications, and to alter it and
11 redistribute it freely, subject to the following restrictions:
12 
13 1. The origin of this software must not be misrepresented; you must
14 not claim that you wrote the original software. If you use this
15 software in a product, an acknowledgment in the product documentation
16 would be appreciated but is not required.
17 
18 2. Altered source versions must be plainly marked as such, and
19 must not be misrepresented as being the original software.
20 
21 3. This notice may not be removed or altered from any source
22 distribution.
23 
24 
25  F.Gaede, DESY : changed extension to .cc for use with gear
26  and include from "gearxml/tinyxml.h"
27  : put in namespace gear
28  : changed output format to scientific with precision 9: "%.9e"
29 
30  $Id: tinyxml.cc,v 1.2 2007-08-08 08:58:32 gaede Exp $
31 */
32 
33 
34 #include <ctype.h>
35 #include "gearxml/tinyxml.h"
36 
37 #ifdef TIXML_USE_STL
38 #include <sstream>
39 #endif
40 
41 
42 //fg: put in namespace gear
43 namespace gear {
44 
45 
46 
47 bool TiXmlBase::condenseWhiteSpace = true;
48 
49 void TiXmlBase::PutString( const TIXML_STRING& str, TIXML_OSTREAM* stream )
50 {
51  TIXML_STRING buffer;
52  PutString( str, &buffer );
53  (*stream) << buffer;
54 }
55 
56 void TiXmlBase::PutString( const TIXML_STRING& str, TIXML_STRING* outString )
57 {
58  int i=0;
59 
60  while( i<(int)str.length() )
61  {
62  unsigned char c = (unsigned char) str[i];
63 
64  if ( c == '&'
65  && i < ( (int)str.length() - 2 )
66  && str[i+1] == '#'
67  && str[i+2] == 'x' )
68  {
69  // Hexadecimal character reference.
70  // Pass through unchanged.
71  // &#xA9; -- copyright symbol, for example.
72  //
73  // The -1 is a bug fix from Rob Laveaux. It keeps
74  // an overflow from happening if there is no ';'.
75  // There are actually 2 ways to exit this loop -
76  // while fails (error case) and break (semicolon found).
77  // However, there is no mechanism (currently) for
78  // this function to return an error.
79  while ( i<(int)str.length()-1 )
80  {
81  outString->append( str.c_str() + i, 1 );
82  ++i;
83  if ( str[i] == ';' )
84  break;
85  }
86  }
87  else if ( c == '&' )
88  {
89  outString->append( entity[0].str, entity[0].strLength );
90  ++i;
91  }
92  else if ( c == '<' )
93  {
94  outString->append( entity[1].str, entity[1].strLength );
95  ++i;
96  }
97  else if ( c == '>' )
98  {
99  outString->append( entity[2].str, entity[2].strLength );
100  ++i;
101  }
102  else if ( c == '\"' )
103  {
104  outString->append( entity[3].str, entity[3].strLength );
105  ++i;
106  }
107  else if ( c == '\'' )
108  {
109  outString->append( entity[4].str, entity[4].strLength );
110  ++i;
111  }
112  else if ( c < 32 )
113  {
114  // Easy pass at non-alpha/numeric/symbol
115  // Below 32 is symbolic.
116  char buf[ 32 ];
117  sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) );
118  //*ME: warning C4267: convert 'size_t' to 'int'
119  //*ME: Int-Cast to make compiler happy ...
120  outString->append( buf, (int)strlen( buf ) );
121  ++i;
122  }
123  else
124  {
125  //char realc = (char) c;
126  //outString->append( &realc, 1 );
127  *outString += (char) c; // somewhat more efficient function call.
128  ++i;
129  }
130  }
131 }
132 
133 
134 // <-- Strange class for a bug fix. Search for STL_STRING_BUG
135 TiXmlBase::StringToBuffer::StringToBuffer( const TIXML_STRING& str )
136 {
137  buffer = new char[ str.length()+1 ];
138  if ( buffer )
139  {
140  strcpy( buffer, str.c_str() );
141  }
142 }
143 
144 
145 TiXmlBase::StringToBuffer::~StringToBuffer()
146 {
147  delete [] buffer;
148 }
149 // End strange bug fix. -->
150 
151 
152 TiXmlNode::TiXmlNode( NodeType _type ) : TiXmlBase()
153 {
154  parent = 0;
155  type = _type;
156  firstChild = 0;
157  lastChild = 0;
158  prev = 0;
159  next = 0;
160 }
161 
162 
163 TiXmlNode::~TiXmlNode()
164 {
165  TiXmlNode* node = firstChild;
166  TiXmlNode* temp = 0;
167 
168  while ( node )
169  {
170  temp = node;
171  node = node->next;
172  delete temp;
173  }
174 }
175 
176 
177 void TiXmlNode::CopyTo( TiXmlNode* target ) const
178 {
179  target->SetValue (value.c_str() );
180  target->userData = userData;
181 }
182 
183 
185 {
186  TiXmlNode* node = firstChild;
187  TiXmlNode* temp = 0;
188 
189  while ( node )
190  {
191  temp = node;
192  node = node->next;
193  delete temp;
194  }
195 
196  firstChild = 0;
197  lastChild = 0;
198 }
199 
200 
202 {
203  node->parent = this;
204 
205  node->prev = lastChild;
206  node->next = 0;
207 
208  if ( lastChild )
209  lastChild->next = node;
210  else
211  firstChild = node; // it was an empty list.
212 
213  lastChild = node;
214  return node;
215 }
216 
217 
219 {
220  TiXmlNode* node = addThis.Clone();
221  if ( !node )
222  return 0;
223 
224  return LinkEndChild( node );
225 }
226 
227 
229 {
230  if ( !beforeThis || beforeThis->parent != this )
231  return 0;
232 
233  TiXmlNode* node = addThis.Clone();
234  if ( !node )
235  return 0;
236  node->parent = this;
237 
238  node->next = beforeThis;
239  node->prev = beforeThis->prev;
240  if ( beforeThis->prev )
241  {
242  beforeThis->prev->next = node;
243  }
244  else
245  {
246  assert( firstChild == beforeThis );
247  firstChild = node;
248  }
249  beforeThis->prev = node;
250  return node;
251 }
252 
253 
255 {
256  if ( !afterThis || afterThis->parent != this )
257  return 0;
258 
259  TiXmlNode* node = addThis.Clone();
260  if ( !node )
261  return 0;
262  node->parent = this;
263 
264  node->prev = afterThis;
265  node->next = afterThis->next;
266  if ( afterThis->next )
267  {
268  afterThis->next->prev = node;
269  }
270  else
271  {
272  assert( lastChild == afterThis );
273  lastChild = node;
274  }
275  afterThis->next = node;
276  return node;
277 }
278 
279 
280 TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis )
281 {
282  if ( replaceThis->parent != this )
283  return 0;
284 
285  TiXmlNode* node = withThis.Clone();
286  if ( !node )
287  return 0;
288 
289  node->next = replaceThis->next;
290  node->prev = replaceThis->prev;
291 
292  if ( replaceThis->next )
293  replaceThis->next->prev = node;
294  else
295  lastChild = node;
296 
297  if ( replaceThis->prev )
298  replaceThis->prev->next = node;
299  else
300  firstChild = node;
301 
302  delete replaceThis;
303  node->parent = this;
304  return node;
305 }
306 
307 
309 {
310  if ( removeThis->parent != this )
311  {
312  assert( 0 );
313  return false;
314  }
315 
316  if ( removeThis->next )
317  removeThis->next->prev = removeThis->prev;
318  else
319  lastChild = removeThis->prev;
320 
321  if ( removeThis->prev )
322  removeThis->prev->next = removeThis->next;
323  else
324  firstChild = removeThis->next;
325 
326  delete removeThis;
327  return true;
328 }
329 
330 const TiXmlNode* TiXmlNode::FirstChild( const char * _value ) const
331 {
332  const TiXmlNode* node;
333  for ( node = firstChild; node; node = node->next )
334  {
335  if ( node->SValue() == _value )
336  return node;
337  }
338  return 0;
339 }
340 
341 
342 TiXmlNode* TiXmlNode::FirstChild( const char * _value )
343 {
344  TiXmlNode* node;
345  for ( node = firstChild; node; node = node->next )
346  {
347  if ( node->SValue() == _value )
348  return node;
349  }
350  return 0;
351 }
352 
353 
354 const TiXmlNode* TiXmlNode::LastChild( const char * _value ) const
355 {
356  const TiXmlNode* node;
357  for ( node = lastChild; node; node = node->prev )
358  {
359  if ( node->SValue() == _value )
360  return node;
361  }
362  return 0;
363 }
364 
365 TiXmlNode* TiXmlNode::LastChild( const char * _value )
366 {
367  TiXmlNode* node;
368  for ( node = lastChild; node; node = node->prev )
369  {
370  if ( node->SValue() == _value )
371  return node;
372  }
373  return 0;
374 }
375 
376 const TiXmlNode* TiXmlNode::IterateChildren( const TiXmlNode* previous ) const
377 {
378  if ( !previous )
379  {
380  return FirstChild();
381  }
382  else
383  {
384  assert( previous->parent == this );
385  return previous->NextSibling();
386  }
387 }
388 
390 {
391  if ( !previous )
392  {
393  return FirstChild();
394  }
395  else
396  {
397  assert( previous->parent == this );
398  return previous->NextSibling();
399  }
400 }
401 
402 const TiXmlNode* TiXmlNode::IterateChildren( const char * val, const TiXmlNode* previous ) const
403 {
404  if ( !previous )
405  {
406  return FirstChild( val );
407  }
408  else
409  {
410  assert( previous->parent == this );
411  return previous->NextSibling( val );
412  }
413 }
414 
415 TiXmlNode* TiXmlNode::IterateChildren( const char * val, TiXmlNode* previous )
416 {
417  if ( !previous )
418  {
419  return FirstChild( val );
420  }
421  else
422  {
423  assert( previous->parent == this );
424  return previous->NextSibling( val );
425  }
426 }
427 
428 const TiXmlNode* TiXmlNode::NextSibling( const char * _value ) const
429 {
430  const TiXmlNode* node;
431  for ( node = next; node; node = node->next )
432  {
433  if ( node->SValue() == _value )
434  return node;
435  }
436  return 0;
437 }
438 
439 TiXmlNode* TiXmlNode::NextSibling( const char * _value )
440 {
441  TiXmlNode* node;
442  for ( node = next; node; node = node->next )
443  {
444  if ( node->SValue() == _value )
445  return node;
446  }
447  return 0;
448 }
449 
450 const TiXmlNode* TiXmlNode::PreviousSibling( const char * _value ) const
451 {
452  const TiXmlNode* node;
453  for ( node = prev; node; node = node->prev )
454  {
455  if ( node->SValue() == _value )
456  return node;
457  }
458  return 0;
459 }
460 
461 TiXmlNode* TiXmlNode::PreviousSibling( const char * _value )
462 {
463  TiXmlNode* node;
464  for ( node = prev; node; node = node->prev )
465  {
466  if ( node->SValue() == _value )
467  return node;
468  }
469  return 0;
470 }
471 
472 void TiXmlElement::RemoveAttribute( const char * name )
473 {
474  TiXmlAttribute* node = attributeSet.Find( name );
475  if ( node )
476  {
477  attributeSet.Remove( node );
478  delete node;
479  }
480 }
481 
483 {
484  const TiXmlNode* node;
485 
486  for ( node = FirstChild();
487  node;
488  node = node->NextSibling() )
489  {
490  if ( node->ToElement() )
491  return node->ToElement();
492  }
493  return 0;
494 }
495 
497 {
498  TiXmlNode* node;
499 
500  for ( node = FirstChild();
501  node;
502  node = node->NextSibling() )
503  {
504  if ( node->ToElement() )
505  return node->ToElement();
506  }
507  return 0;
508 }
509 
510 const TiXmlElement* TiXmlNode::FirstChildElement( const char * _value ) const
511 {
512  const TiXmlNode* node;
513 
514  for ( node = FirstChild( _value );
515  node;
516  node = node->NextSibling( _value ) )
517  {
518  if ( node->ToElement() )
519  return node->ToElement();
520  }
521  return 0;
522 }
523 
524 TiXmlElement* TiXmlNode::FirstChildElement( const char * _value )
525 {
526  TiXmlNode* node;
527 
528  for ( node = FirstChild( _value );
529  node;
530  node = node->NextSibling( _value ) )
531  {
532  if ( node->ToElement() )
533  return node->ToElement();
534  }
535  return 0;
536 }
537 
539 {
540  const TiXmlNode* node;
541 
542  for ( node = NextSibling();
543  node;
544  node = node->NextSibling() )
545  {
546  if ( node->ToElement() )
547  return node->ToElement();
548  }
549  return 0;
550 }
551 
553 {
554  TiXmlNode* node;
555 
556  for ( node = NextSibling();
557  node;
558  node = node->NextSibling() )
559  {
560  if ( node->ToElement() )
561  return node->ToElement();
562  }
563  return 0;
564 }
565 
566 const TiXmlElement* TiXmlNode::NextSiblingElement( const char * _value ) const
567 {
568  const TiXmlNode* node;
569 
570  for ( node = NextSibling( _value );
571  node;
572  node = node->NextSibling( _value ) )
573  {
574  if ( node->ToElement() )
575  return node->ToElement();
576  }
577  return 0;
578 }
579 
580 TiXmlElement* TiXmlNode::NextSiblingElement( const char * _value )
581 {
582  TiXmlNode* node;
583 
584  for ( node = NextSibling( _value );
585  node;
586  node = node->NextSibling( _value ) )
587  {
588  if ( node->ToElement() )
589  return node->ToElement();
590  }
591  return 0;
592 }
593 
594 
596 {
597  const TiXmlNode* node;
598 
599  for( node = this; node; node = node->parent )
600  {
601  if ( node->ToDocument() )
602  return node->ToDocument();
603  }
604  return 0;
605 }
606 
608 {
609  TiXmlNode* node;
610 
611  for( node = this; node; node = node->parent )
612  {
613  if ( node->ToDocument() )
614  return node->ToDocument();
615  }
616  return 0;
617 }
618 
619 TiXmlElement::TiXmlElement (const char * _value)
620  : TiXmlNode( TiXmlNode::ELEMENT )
621 {
622  firstChild = lastChild = 0;
623  value = _value;
624 }
625 
626 
627 #ifdef TIXML_USE_STL
628 TiXmlElement::TiXmlElement( const std::string& _value )
629  : TiXmlNode( TiXmlNode::ELEMENT )
630 {
631  firstChild = lastChild = 0;
632  value = _value;
633 }
634 #endif
635 
636 
637 TiXmlElement::TiXmlElement( const TiXmlElement& copy)
638  : TiXmlNode( TiXmlNode::ELEMENT )
639 {
640  firstChild = lastChild = 0;
641  copy.CopyTo( this );
642 }
643 
644 
645 void TiXmlElement::operator=( const TiXmlElement& base )
646 {
647  ClearThis();
648  base.CopyTo( this );
649 }
650 
651 
652 TiXmlElement::~TiXmlElement()
653 {
654  ClearThis();
655 }
656 
657 
658 void TiXmlElement::ClearThis()
659 {
660  Clear();
661  while( attributeSet.First() )
662  {
663  TiXmlAttribute* node = attributeSet.First();
664  attributeSet.Remove( node );
665  delete node;
666  }
667 }
668 
669 
670 const char * TiXmlElement::Attribute( const char * name ) const
671 {
672  const TiXmlAttribute* node = attributeSet.Find( name );
673 
674  if ( node )
675  return node->Value();
676 
677  return 0;
678 }
679 
680 
681 const char * TiXmlElement::Attribute( const char * name, int* i ) const
682 {
683  const char * s = Attribute( name );
684  if ( i )
685  {
686  if ( s )
687  *i = atoi( s );
688  else
689  *i = 0;
690  }
691  return s;
692 }
693 
694 
695 const char * TiXmlElement::Attribute( const char * name, double* d ) const
696 {
697  const char * s = Attribute( name );
698  if ( d )
699  {
700  if ( s )
701  *d = atof( s );
702  else
703  *d = 0;
704  }
705  return s;
706 }
707 
708 
709 int TiXmlElement::QueryIntAttribute( const char* name, int* ival ) const
710 {
711  const TiXmlAttribute* node = attributeSet.Find( name );
712  if ( !node )
713  return TIXML_NO_ATTRIBUTE;
714 
715  return node->QueryIntValue( ival );
716 }
717 
718 
719 int TiXmlElement::QueryDoubleAttribute( const char* name, double* dval ) const
720 {
721  const TiXmlAttribute* node = attributeSet.Find( name );
722  if ( !node )
723  return TIXML_NO_ATTRIBUTE;
724 
725  return node->QueryDoubleValue( dval );
726 }
727 
728 
729 void TiXmlElement::SetAttribute( const char * name, int val )
730 {
731  char buf[64];
732  sprintf( buf, "%d", val );
733  SetAttribute( name, buf );
734 }
735 
736 
737 void TiXmlElement::SetDoubleAttribute( const char * name, double val )
738 {
739  char buf[256];
740  sprintf( buf, "%.9e", val );
741  SetAttribute( name, buf );
742 }
743 
744 
745 void TiXmlElement::SetAttribute( const char * name, const char * _value )
746 {
747  TiXmlAttribute* node = attributeSet.Find( name );
748  if ( node )
749  {
750  node->SetValue( _value );
751  return;
752  }
753 
754  TiXmlAttribute* attrib = new TiXmlAttribute( name, _value );
755  if ( attrib )
756  {
757  attributeSet.Add( attrib );
758  }
759  else
760  {
761  TiXmlDocument* document = GetDocument();
762  if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN );
763  }
764 }
765 
766 void TiXmlElement::Print( FILE* cfile, int depth ) const
767 {
768  int i;
769  for ( i=0; i<depth; i++ )
770  {
771  fprintf( cfile, " " );
772  }
773 
774  fprintf( cfile, "<%s", value.c_str() );
775 
776  const TiXmlAttribute* attrib;
777  for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() )
778  {
779  fprintf( cfile, " " );
780  attrib->Print( cfile, depth );
781  }
782 
783  // There are 3 different formatting approaches:
784  // 1) An element without children is printed as a <foo /> node
785  // 2) An element with only a text child is printed as <foo> text </foo>
786  // 3) An element with children is printed on multiple lines.
787  TiXmlNode* node;
788  if ( !firstChild )
789  {
790  fprintf( cfile, " />" );
791  }
792  else if ( firstChild == lastChild && firstChild->ToText() )
793  {
794  fprintf( cfile, ">" );
795  firstChild->Print( cfile, depth + 1 );
796  fprintf( cfile, "</%s>", value.c_str() );
797  }
798  else
799  {
800  fprintf( cfile, ">" );
801 
802  for ( node = firstChild; node; node=node->NextSibling() )
803  {
804  if ( !node->ToText() )
805  {
806  fprintf( cfile, "\n" );
807  }
808  node->Print( cfile, depth+1 );
809  }
810  fprintf( cfile, "\n" );
811  for( i=0; i<depth; ++i )
812  fprintf( cfile, " " );
813  fprintf( cfile, "</%s>", value.c_str() );
814  }
815 }
816 
817 void TiXmlElement::StreamOut( TIXML_OSTREAM * stream ) const
818 {
819  (*stream) << "<" << value;
820 
821  const TiXmlAttribute* attrib;
822  for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() )
823  {
824  (*stream) << " ";
825  attrib->StreamOut( stream );
826  }
827 
828  // If this node has children, give it a closing tag. Else
829  // make it an empty tag.
830  TiXmlNode* node;
831  if ( firstChild )
832  {
833  (*stream) << ">";
834 
835  for ( node = firstChild; node; node=node->NextSibling() )
836  {
837  node->StreamOut( stream );
838  }
839  (*stream) << "</" << value << ">";
840  }
841  else
842  {
843  (*stream) << " />";
844  }
845 }
846 
847 
848 void TiXmlElement::CopyTo( TiXmlElement* target ) const
849 {
850  // superclass:
851  TiXmlNode::CopyTo( target );
852 
853  // Element class:
854  // Clone the attributes, then clone the children.
855  const TiXmlAttribute* attribute = 0;
856  for( attribute = attributeSet.First();
857  attribute;
858  attribute = attribute->Next() )
859  {
860  target->SetAttribute( attribute->Name(), attribute->Value() );
861  }
862 
863  TiXmlNode* node = 0;
864  for ( node = firstChild; node; node = node->NextSibling() )
865  {
866  target->LinkEndChild( node->Clone() );
867  }
868 }
869 
870 
872 {
873  TiXmlElement* clone = new TiXmlElement( Value() );
874  if ( !clone )
875  return 0;
876 
877  CopyTo( clone );
878  return clone;
879 }
880 
881 
883 {
884  tabsize = 4;
885  ClearError();
886 }
887 
888 TiXmlDocument::TiXmlDocument( const char * documentName ) : TiXmlNode( TiXmlNode::DOCUMENT )
889 {
890  tabsize = 4;
891  value = documentName;
892  ClearError();
893 }
894 
895 
896 #ifdef TIXML_USE_STL
897 TiXmlDocument::TiXmlDocument( const std::string& documentName ) : TiXmlNode( TiXmlNode::DOCUMENT )
898 {
899  tabsize = 4;
900  value = documentName;
901  ClearError();
902 }
903 #endif
904 
905 
906 TiXmlDocument::TiXmlDocument( const TiXmlDocument& copy ) : TiXmlNode( TiXmlNode::DOCUMENT )
907 {
908  copy.CopyTo( this );
909 }
910 
911 
912 void TiXmlDocument::operator=( const TiXmlDocument& copy )
913 {
914  Clear();
915  copy.CopyTo( this );
916 }
917 
918 
919 bool TiXmlDocument::LoadFile( TiXmlEncoding encoding )
920 {
921  // See STL_STRING_BUG below.
922  StringToBuffer buf( value );
923 
924  if ( buf.buffer && LoadFile( buf.buffer, encoding ) )
925  return true;
926 
927  return false;
928 }
929 
930 
932 {
933  // See STL_STRING_BUG below.
934  StringToBuffer buf( value );
935 
936  if ( buf.buffer && SaveFile( buf.buffer ) )
937  return true;
938 
939  return false;
940 }
941 
942 bool TiXmlDocument::LoadFile( const char* filename, TiXmlEncoding encoding )
943 {
944  // Delete the existing data:
945  Clear();
946  location.Clear();
947 
948  // There was a really terrifying little bug here. The code:
949  // value = filename
950  // in the STL case, cause the assignment method of the std::string to
951  // be called. What is strange, is that the std::string had the same
952  // address as it's c_str() method, and so bad things happen. Looks
953  // like a bug in the Microsoft STL implementation.
954  // See STL_STRING_BUG above.
955  // Fixed with the StringToBuffer class.
956  value = filename;
957 
958  FILE* file = fopen( value.c_str (), "r" );
959 
960  if ( file )
961  {
962  // Get the file size, so we can pre-allocate the string. HUGE speed impact.
963  long length = 0;
964  fseek( file, 0, SEEK_END );
965  length = ftell( file );
966  fseek( file, 0, SEEK_SET );
967 
968  // Strange case, but good to handle up front.
969  if ( length == 0 )
970  {
971  fclose( file );
972  return false;
973  }
974 
975  // If we have a file, assume it is all one big XML file, and read it in.
976  // The document parser may decide the document ends sooner than the entire file, however.
977  TIXML_STRING data;
978  data.reserve( length );
979 
980  const int BUF_SIZE = 2048;
981  char buf[BUF_SIZE];
982 
983  while( fgets( buf, BUF_SIZE, file ) )
984  {
985  data += buf;
986  }
987  fclose( file );
988 
989  Parse( data.c_str(), 0, encoding );
990 
991  if ( Error() )
992  return false;
993  else
994  return true;
995  }
996  SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN );
997  return false;
998 }
999 
1000 bool TiXmlDocument::SaveFile( const char * filename ) const
1001 {
1002  // The old c stuff lives on...
1003  FILE* fp = fopen( filename, "w" );
1004  if ( fp )
1005  {
1006  Print( fp, 0 );
1007  fclose( fp );
1008  return true;
1009  }
1010  return false;
1011 }
1012 
1013 
1014 void TiXmlDocument::CopyTo( TiXmlDocument* target ) const
1015 {
1016  TiXmlNode::CopyTo( target );
1017 
1018  target->error = error;
1019  target->errorDesc = errorDesc.c_str ();
1020 
1021  TiXmlNode* node = 0;
1022  for ( node = firstChild; node; node = node->NextSibling() )
1023  {
1024  target->LinkEndChild( node->Clone() );
1025  }
1026 }
1027 
1028 
1030 {
1031  TiXmlDocument* clone = new TiXmlDocument();
1032  if ( !clone )
1033  return 0;
1034 
1035  CopyTo( clone );
1036  return clone;
1037 }
1038 
1039 
1040 void TiXmlDocument::Print( FILE* cfile, int depth ) const
1041 {
1042  const TiXmlNode* node;
1043  for ( node=FirstChild(); node; node=node->NextSibling() )
1044  {
1045  node->Print( cfile, depth );
1046  fprintf( cfile, "\n" );
1047  }
1048 }
1049 
1050 void TiXmlDocument::StreamOut( TIXML_OSTREAM * out ) const
1051 {
1052  const TiXmlNode* node;
1053  for ( node=FirstChild(); node; node=node->NextSibling() )
1054  {
1055  node->StreamOut( out );
1056 
1057  // Special rule for streams: stop after the root element.
1058  // The stream in code will only read one element, so don't
1059  // write more than one.
1060  if ( node->ToElement() )
1061  break;
1062  }
1063 }
1064 
1065 
1067 {
1068  // We are using knowledge of the sentinel. The sentinel
1069  // have a value or name.
1070  if ( next->value.empty() && next->name.empty() )
1071  return 0;
1072  return next;
1073 }
1074 
1076 {
1077  // We are using knowledge of the sentinel. The sentinel
1078  // have a value or name.
1079  if ( next->value.empty() && next->name.empty() )
1080  return 0;
1081  return next;
1082 }
1083 
1085 {
1086  // We are using knowledge of the sentinel. The sentinel
1087  // have a value or name.
1088  if ( prev->value.empty() && prev->name.empty() )
1089  return 0;
1090  return prev;
1091 }
1092 
1094 {
1095  // We are using knowledge of the sentinel. The sentinel
1096  // have a value or name.
1097  if ( prev->value.empty() && prev->name.empty() )
1098  return 0;
1099  return prev;
1100 }
1101 
1102 void TiXmlAttribute::Print( FILE* cfile, int /*depth*/ ) const
1103 {
1104  TIXML_STRING n, v;
1105 
1106  PutString( name, &n );
1107  PutString( value, &v );
1108 
1109  if (value.find ('\"') == TIXML_STRING::npos)
1110  fprintf (cfile, "%s=\"%s\"", n.c_str(), v.c_str() );
1111  else
1112  fprintf (cfile, "%s='%s'", n.c_str(), v.c_str() );
1113 }
1114 
1115 
1116 void TiXmlAttribute::StreamOut( TIXML_OSTREAM * stream ) const
1117 {
1118  if (value.find( '\"' ) != TIXML_STRING::npos)
1119  {
1120  PutString( name, stream );
1121  (*stream) << "=" << "'";
1122  PutString( value, stream );
1123  (*stream) << "'";
1124  }
1125  else
1126  {
1127  PutString( name, stream );
1128  (*stream) << "=" << "\"";
1129  PutString( value, stream );
1130  (*stream) << "\"";
1131  }
1132 }
1133 
1134 int TiXmlAttribute::QueryIntValue( int* ival ) const
1135 {
1136  if ( sscanf( value.c_str(), "%d", ival ) == 1 )
1137  return TIXML_SUCCESS;
1138  return TIXML_WRONG_TYPE;
1139 }
1140 
1141 int TiXmlAttribute::QueryDoubleValue( double* dval ) const
1142 {
1143  if ( sscanf( value.c_str(), "%le", dval ) == 1 )
1144  return TIXML_SUCCESS;
1145  return TIXML_WRONG_TYPE;
1146 }
1147 
1149 {
1150  char buf [64];
1151  sprintf (buf, "%d", _value);
1152  SetValue (buf);
1153 }
1154 
1155 void TiXmlAttribute::SetDoubleValue( double _value )
1156 {
1157  char buf [256];
1158 //fg: sprintf (buf, "%lf", _value);
1159 // %lf is not ISO C++
1160  sprintf (buf, "%.9e", _value);
1161  SetValue (buf);
1162 }
1163 
1165 {
1166  return atoi (value.c_str ());
1167 }
1168 
1170 {
1171  return atof (value.c_str ());
1172 }
1173 
1174 
1175 TiXmlComment::TiXmlComment( const TiXmlComment& copy ) : TiXmlNode( TiXmlNode::COMMENT )
1176 {
1177  copy.CopyTo( this );
1178 }
1179 
1180 
1181 void TiXmlComment::operator=( const TiXmlComment& base )
1182 {
1183  Clear();
1184  base.CopyTo( this );
1185 }
1186 
1187 
1188 void TiXmlComment::Print( FILE* cfile, int depth ) const
1189 {
1190  for ( int i=0; i<depth; i++ )
1191  {
1192  fputs( " ", cfile );
1193  }
1194  fprintf( cfile, "<!--%s-->", value.c_str() );
1195 }
1196 
1197 void TiXmlComment::StreamOut( TIXML_OSTREAM * stream ) const
1198 {
1199  (*stream) << "<!--";
1200  //PutString( value, stream );
1201  (*stream) << value;
1202  (*stream) << "-->";
1203 }
1204 
1205 
1206 void TiXmlComment::CopyTo( TiXmlComment* target ) const
1207 {
1208  TiXmlNode::CopyTo( target );
1209 }
1210 
1211 
1213 {
1214  TiXmlComment* clone = new TiXmlComment();
1215 
1216  if ( !clone )
1217  return 0;
1218 
1219  CopyTo( clone );
1220  return clone;
1221 }
1222 
1223 
1224 void TiXmlText::Print( FILE* cfile, int /*depth*/ ) const
1225 {
1226  TIXML_STRING buffer;
1227  PutString( value, &buffer );
1228  fprintf( cfile, "%s", buffer.c_str() );
1229 }
1230 
1231 
1232 void TiXmlText::StreamOut( TIXML_OSTREAM * stream ) const
1233 {
1234  PutString( value, stream );
1235 }
1236 
1237 
1238 void TiXmlText::CopyTo( TiXmlText* target ) const
1239 {
1240  TiXmlNode::CopyTo( target );
1241 }
1242 
1243 
1245 {
1246  TiXmlText* clone = 0;
1247  clone = new TiXmlText( "" );
1248 
1249  if ( !clone )
1250  return 0;
1251 
1252  CopyTo( clone );
1253  return clone;
1254 }
1255 
1256 
1257 TiXmlDeclaration::TiXmlDeclaration( const char * _version,
1258  const char * _encoding,
1259  const char * _standalone )
1260  : TiXmlNode( TiXmlNode::DECLARATION )
1261 {
1262  version = _version;
1263  encoding = _encoding;
1264  standalone = _standalone;
1265 }
1266 
1267 
1268 #ifdef TIXML_USE_STL
1269 TiXmlDeclaration::TiXmlDeclaration( const std::string& _version,
1270  const std::string& _encoding,
1271  const std::string& _standalone )
1272  : TiXmlNode( TiXmlNode::DECLARATION )
1273 {
1274  version = _version;
1275  encoding = _encoding;
1276  standalone = _standalone;
1277 }
1278 #endif
1279 
1280 
1281 TiXmlDeclaration::TiXmlDeclaration( const TiXmlDeclaration& copy )
1282  : TiXmlNode( TiXmlNode::DECLARATION )
1283 {
1284  copy.CopyTo( this );
1285 }
1286 
1287 
1288 void TiXmlDeclaration::operator=( const TiXmlDeclaration& copy )
1289 {
1290  Clear();
1291  copy.CopyTo( this );
1292 }
1293 
1294 
1295 void TiXmlDeclaration::Print( FILE* cfile, int /*depth*/ ) const
1296 {
1297  fprintf (cfile, "<?xml ");
1298 
1299  if ( !version.empty() )
1300  fprintf (cfile, "version=\"%s\" ", version.c_str ());
1301  if ( !encoding.empty() )
1302  fprintf (cfile, "encoding=\"%s\" ", encoding.c_str ());
1303  if ( !standalone.empty() )
1304  fprintf (cfile, "standalone=\"%s\" ", standalone.c_str ());
1305  fprintf (cfile, "?>");
1306 }
1307 
1308 void TiXmlDeclaration::StreamOut( TIXML_OSTREAM * stream ) const
1309 {
1310  (*stream) << "<?xml ";
1311 
1312  if ( !version.empty() )
1313  {
1314  (*stream) << "version=\"";
1315  PutString( version, stream );
1316  (*stream) << "\" ";
1317  }
1318  if ( !encoding.empty() )
1319  {
1320  (*stream) << "encoding=\"";
1321  PutString( encoding, stream );
1322  (*stream ) << "\" ";
1323  }
1324  if ( !standalone.empty() )
1325  {
1326  (*stream) << "standalone=\"";
1327  PutString( standalone, stream );
1328  (*stream) << "\" ";
1329  }
1330  (*stream) << "?>";
1331 }
1332 
1333 
1334 void TiXmlDeclaration::CopyTo( TiXmlDeclaration* target ) const
1335 {
1336  TiXmlNode::CopyTo( target );
1337 
1338  target->version = version;
1339  target->encoding = encoding;
1340  target->standalone = standalone;
1341 }
1342 
1343 
1345 {
1346  TiXmlDeclaration* clone = new TiXmlDeclaration();
1347 
1348  if ( !clone )
1349  return 0;
1350 
1351  CopyTo( clone );
1352  return clone;
1353 }
1354 
1355 
1356 void TiXmlUnknown::Print( FILE* cfile, int depth ) const
1357 {
1358  for ( int i=0; i<depth; i++ )
1359  fprintf( cfile, " " );
1360  fprintf( cfile, "<%s>", value.c_str() );
1361 }
1362 
1363 
1364 void TiXmlUnknown::StreamOut( TIXML_OSTREAM * stream ) const
1365 {
1366  (*stream) << "<" << value << ">"; // Don't use entities here! It is unknown.
1367 }
1368 
1369 
1370 void TiXmlUnknown::CopyTo( TiXmlUnknown* target ) const
1371 {
1372  TiXmlNode::CopyTo( target );
1373 }
1374 
1375 
1377 {
1378  TiXmlUnknown* clone = new TiXmlUnknown();
1379 
1380  if ( !clone )
1381  return 0;
1382 
1383  CopyTo( clone );
1384  return clone;
1385 }
1386 
1387 
1388 TiXmlAttributeSet::TiXmlAttributeSet()
1389 {
1390  sentinel.next = &sentinel;
1391  sentinel.prev = &sentinel;
1392 }
1393 
1394 
1395 TiXmlAttributeSet::~TiXmlAttributeSet()
1396 {
1397  assert( sentinel.next == &sentinel );
1398  assert( sentinel.prev == &sentinel );
1399 }
1400 
1401 
1402 void TiXmlAttributeSet::Add( TiXmlAttribute* addMe )
1403 {
1404  assert( !Find( addMe->Name() ) ); // Shouldn't be multiply adding to the set.
1405 
1406  addMe->next = &sentinel;
1407  addMe->prev = sentinel.prev;
1408 
1409  sentinel.prev->next = addMe;
1410  sentinel.prev = addMe;
1411 }
1412 
1413 void TiXmlAttributeSet::Remove( TiXmlAttribute* removeMe )
1414 {
1415  TiXmlAttribute* node;
1416 
1417  for( node = sentinel.next; node != &sentinel; node = node->next )
1418  {
1419  if ( node == removeMe )
1420  {
1421  node->prev->next = node->next;
1422  node->next->prev = node->prev;
1423  node->next = 0;
1424  node->prev = 0;
1425  return;
1426  }
1427  }
1428  assert( 0 ); // we tried to remove a non-linked attribute.
1429 }
1430 
1431 const TiXmlAttribute* TiXmlAttributeSet::Find( const char * name ) const
1432 {
1433  const TiXmlAttribute* node;
1434 
1435  for( node = sentinel.next; node != &sentinel; node = node->next )
1436  {
1437  if ( node->name == name )
1438  return node;
1439  }
1440  return 0;
1441 }
1442 
1443 TiXmlAttribute* TiXmlAttributeSet::Find( const char * name )
1444 {
1445  TiXmlAttribute* node;
1446 
1447  for( node = sentinel.next; node != &sentinel; node = node->next )
1448  {
1449  if ( node->name == name )
1450  return node;
1451  }
1452  return 0;
1453 }
1454 
1455 #ifdef TIXML_USE_STL
1456 TIXML_ISTREAM & operator >> (TIXML_ISTREAM & in, TiXmlNode & base)
1457 {
1458  TIXML_STRING tag;
1459  tag.reserve( 8 * 1000 );
1460  base.StreamIn( &in, &tag );
1461 
1462  base.Parse( tag.c_str(), 0, TIXML_DEFAULT_ENCODING );
1463  return in;
1464 }
1465 #endif
1466 
1467 
1468 TIXML_OSTREAM & operator<< (TIXML_OSTREAM & out, const TiXmlNode & base)
1469 {
1470  base.StreamOut (& out);
1471  return out;
1472 }
1473 
1474 
1475 #ifdef TIXML_USE_STL
1476 std::string & operator<< (std::string& out, const TiXmlNode& base )
1477 {
1478  std::ostringstream os_stream( std::ostringstream::out );
1479  base.StreamOut( &os_stream );
1480 
1481  out.append( os_stream.str() );
1482  return out;
1483 }
1484 #endif
1485 
1486 
1488 {
1489  if ( node )
1490  {
1491  TiXmlNode* child = node->FirstChild();
1492  if ( child )
1493  return TiXmlHandle( child );
1494  }
1495  return TiXmlHandle( 0 );
1496 }
1497 
1498 
1499 TiXmlHandle TiXmlHandle::FirstChild( const char * value ) const
1500 {
1501  if ( node )
1502  {
1503  TiXmlNode* child = node->FirstChild( value );
1504  if ( child )
1505  return TiXmlHandle( child );
1506  }
1507  return TiXmlHandle( 0 );
1508 }
1509 
1510 
1512 {
1513  if ( node )
1514  {
1515  TiXmlElement* child = node->FirstChildElement();
1516  if ( child )
1517  return TiXmlHandle( child );
1518  }
1519  return TiXmlHandle( 0 );
1520 }
1521 
1522 
1523 TiXmlHandle TiXmlHandle::FirstChildElement( const char * value ) const
1524 {
1525  if ( node )
1526  {
1527  TiXmlElement* child = node->FirstChildElement( value );
1528  if ( child )
1529  return TiXmlHandle( child );
1530  }
1531  return TiXmlHandle( 0 );
1532 }
1533 
1534 
1536 {
1537  if ( node )
1538  {
1539  int i;
1540  TiXmlNode* child = node->FirstChild();
1541  for ( i=0;
1542  child && i<count;
1543  child = child->NextSibling(), ++i )
1544  {
1545  // nothing
1546  }
1547  if ( child )
1548  return TiXmlHandle( child );
1549  }
1550  return TiXmlHandle( 0 );
1551 }
1552 
1553 
1554 TiXmlHandle TiXmlHandle::Child( const char* value, int count ) const
1555 {
1556  if ( node )
1557  {
1558  int i;
1559  TiXmlNode* child = node->FirstChild( value );
1560  for ( i=0;
1561  child && i<count;
1562  child = child->NextSibling( value ), ++i )
1563  {
1564  // nothing
1565  }
1566  if ( child )
1567  return TiXmlHandle( child );
1568  }
1569  return TiXmlHandle( 0 );
1570 }
1571 
1572 
1574 {
1575  if ( node )
1576  {
1577  int i;
1578  TiXmlElement* child = node->FirstChildElement();
1579  for ( i=0;
1580  child && i<count;
1581  child = child->NextSiblingElement(), ++i )
1582  {
1583  // nothing
1584  }
1585  if ( child )
1586  return TiXmlHandle( child );
1587  }
1588  return TiXmlHandle( 0 );
1589 }
1590 
1591 
1592 TiXmlHandle TiXmlHandle::ChildElement( const char* value, int count ) const
1593 {
1594  if ( node )
1595  {
1596  int i;
1597  TiXmlElement* child = node->FirstChildElement( value );
1598  for ( i=0;
1599  child && i<count;
1600  child = child->NextSiblingElement( value ), ++i )
1601  {
1602  // nothing
1603  }
1604  if ( child )
1605  return TiXmlHandle( child );
1606  }
1607  return TiXmlHandle( 0 );
1608 }
1609 
1610 } //fg: end namespace gear
virtual const char * Parse(const char *p, TiXmlParsingData *data=0, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
Parse the given null terminated block of xml data.
bool SaveFile() const
Save a file using the current document value. Returns true if successful.
Definition: tinyxml.cc:931
TiXmlDeclaration()
Construct an empty declaration.
Definition: tinyxml.h:1063
void SetDoubleValue(double value)
Set the value from a double.
Definition: tinyxml.cc:1155
void SetValue(const char *_value)
Set the value.
Definition: tinyxml.h:726
int IntValue() const
Return the value of this attribute, converted to an integer.
Definition: tinyxml.cc:1164
const TiXmlNode * NextSibling(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:555
virtual TiXmlNode * Clone() const
Creates a new Element and returns it - the returned element is a copy.
Definition: tinyxml.cc:871
TiXmlElement(const char *in_value)
Construct an element.
Definition: tinyxml.cc:619
virtual void Print(FILE *cfile, int depth) const =0
All TinyXml classes can print themselves to a filestream.
TiXmlNode * LinkEndChild(TiXmlNode *addThis)
Add a new node related to this.
Definition: tinyxml.cc:201
virtual TiXmlNode * Clone() const =0
Create an exact duplicate of this node and return it.
TiXmlComment()
Constructs an empty comment.
Definition: tinyxml.h:971
virtual void Print(FILE *cfile, int depth) const
Print this declaration to a FILE stream.
Definition: tinyxml.cc:1295
bool LoadFile(TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
Load a file using the current document value.
Definition: tinyxml.cc:919
void Clear()
Delete all the children of this node. Does not affect 'this'.
Definition: tinyxml.cc:184
In correct XML the declaration is the first entry in the file.
Definition: tinyxml.h:1059
An attribute is a name-value pair.
Definition: tinyxml.h:675
virtual TiXmlNode * Clone() const
Creates a copy of this Unknown and returns it.
Definition: tinyxml.cc:1376
const TiXmlNode * NextSibling() const
Navigate to a sibling node.
Definition: tinyxml.h:560
virtual void Print(FILE *cfile, int depth) const
Write this text object to a FILE stream.
Definition: tinyxml.cc:1224
void SetIntValue(int value)
Set the value from an integer.
Definition: tinyxml.cc:1148
const char * Value() const
The meaning of 'value' changes for the specific type of TiXmlNode.
Definition: tinyxml.h:435
A TiXmlHandle is a class that wraps a node pointer with null checks; this is an incredibly useful thi...
Definition: tinyxml.h:1374
const TiXmlDocument * ToDocument() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:614
virtual void Print(FILE *cfile, int depth) const
Print this Unknown to a FILE stream.
Definition: tinyxml.cc:1356
Always the top level node.
Definition: tinyxml.h:1152
double DoubleValue() const
Return the value of this attribute, converted to a double.
Definition: tinyxml.cc:1169
TiXmlNode * InsertBeforeChild(TiXmlNode *beforeThis, const TiXmlNode &addThis)
Add a new node related to this.
Definition: tinyxml.cc:228
virtual TiXmlNode * Clone() const
Returns a copy of this Comment.
Definition: tinyxml.cc:1212
int QueryDoubleAttribute(const char *name, double *value) const
QueryDoubleAttribute examines the attribute - see QueryIntAttribute().
Definition: tinyxml.cc:719
Any tag that tinyXml doesn't recognize is saved as an unknown.
Definition: tinyxml.h:1119
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:368
const char * Attribute(const char *name) const
Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists.
Definition: tinyxml.cc:670
TiXmlHandle ChildElement(const char *value, int index) const
Return a handle to the "index" child element with the given name.
Definition: tinyxml.cc:1592
TiXmlNode * ReplaceChild(TiXmlNode *replaceThis, const TiXmlNode &withThis)
Replace a child of this node.
Definition: tinyxml.cc:280
int QueryDoubleValue(double *value) const
QueryDoubleValue examines the value string. See QueryIntValue().
Definition: tinyxml.cc:1141
virtual TiXmlNode * Clone() const
Create an exact duplicate of this node and return it.
Definition: tinyxml.cc:1029
const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:615
void * userData
Field containing a generic user pointer.
Definition: tinyxml.h:321
int QueryIntAttribute(const char *name, int *value) const
QueryIntAttribute examines the attribute - it is an alternative to the Attribute() method with richer...
Definition: tinyxml.cc:709
virtual TiXmlNode * Clone() const
Creates a copy of this Declaration and returns it.
Definition: tinyxml.cc:1344
An XML comment.
Definition: tinyxml.h:967
The element is a container class.
Definition: tinyxml.h:825
const TiXmlNode * PreviousSibling() const
Navigate to a sibling node.
Definition: tinyxml.h:545
TiXmlNode * InsertEndChild(const TiXmlNode &addThis)
Add a new node related to this.
Definition: tinyxml.cc:218
bool Error() const
If an error occurs, Error will be set to true.
Definition: tinyxml.h:1213
bool RemoveChild(TiXmlNode *removeThis)
Delete a child of this node.
Definition: tinyxml.cc:308
void SetDoubleAttribute(const char *name, double value)
Sets an attribute of name to a given value.
Definition: tinyxml.cc:737
TiXmlHandle(TiXmlNode *node)
Create a handle from any node (at any depth of the tree.) This can be a null pointer.
Definition: tinyxml.h:1378
XML text.
Definition: tinyxml.h:1003
void RemoveAttribute(const char *name)
Deletes an attribute with the given name.
Definition: tinyxml.cc:472
virtual void Print(FILE *cfile, int depth) const
All TinyXml classes can print themselves to a filestream.
Definition: tinyxml.cc:766
void ClearError()
If you have handled the error, it can be reset with this call.
Definition: tinyxml.h:1260
const TiXmlNode * FirstChild() const
The first child of this node. Will be null if there are no children.
Definition: tinyxml.h:464
TiXmlHandle Child(const char *value, int index) const
Return a handle to the "index" child with the given name.
Definition: tinyxml.cc:1554
const char * Value() const
Return the value of this attribute.
Definition: tinyxml.h:708
TiXmlDocument()
Create an empty document, that has no name.
Definition: tinyxml.cc:882
virtual TiXmlNode * Clone() const
[internal use] Creates a new Element and returns it.
Definition: tinyxml.cc:1244
const TiXmlElement * NextSiblingElement() const
Convenience function to get through elements.
Definition: tinyxml.cc:538
virtual void Print(FILE *cfile, int depth) const
Write this Comment to a FILE stream.
Definition: tinyxml.cc:1188
TiXmlNode * InsertAfterChild(TiXmlNode *afterThis, const TiXmlNode &addThis)
Add a new node related to this.
Definition: tinyxml.cc:254
TiXmlHandle FirstChildElement() const
Return a handle to the first child element.
Definition: tinyxml.cc:1511
int QueryIntValue(int *value) const
QueryIntValue examines the value string.
Definition: tinyxml.cc:1134
const TiXmlNode * IterateChildren(const TiXmlNode *previous) const
An alternate way to walk the children of a node.
Definition: tinyxml.cc:376
const TiXmlText * ToText() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:618
void SetAttribute(const char *name, const char *value)
Sets an attribute of name to a given value.
Definition: tinyxml.cc:745
virtual void Print(FILE *cfile, int depth) const
All TinyXml classes can print themselves to a filestream.
Definition: tinyxml.cc:1102
const TiXmlDocument * GetDocument() const
Return a pointer to the Document this node lives in.
Definition: tinyxml.cc:595
void Print() const
Dump the document to standard out.
Definition: tinyxml.h:1268
const TiXmlAttribute * Next() const
Get the next sibling attribute in the DOM. Returns null at end.
Definition: tinyxml.cc:1066
TiXmlText(const char *initValue)
Constructor.
Definition: tinyxml.h:1008
TiXmlHandle FirstChild() const
Return a handle to the first child node.
Definition: tinyxml.cc:1487
const TiXmlElement * FirstChildElement() const
Convenience function to get through elements.
Definition: tinyxml.cc:482
const TiXmlAttribute * Previous() const
Get the previous sibling attribute in the DOM. Returns null at beginning.
Definition: tinyxml.cc:1084