test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Types | Private Member Functions | Static Private Attributes | Friends
TiXmlBase Class Referenceabstract

#include <tinyxml.h>

Inheritance diagram for TiXmlBase:
TiXmlAttribute TiXmlNode TiXmlComment TiXmlDeclaration TiXmlDocument TiXmlElement TiXmlText TiXmlUnknown

Classes

struct  Entity
 

Public Types

enum  {
  TIXML_NO_ERROR = 0, TIXML_ERROR, TIXML_ERROR_OPENING_FILE, TIXML_ERROR_OUT_OF_MEMORY,
  TIXML_ERROR_PARSING_ELEMENT, TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, TIXML_ERROR_READING_ELEMENT_VALUE, TIXML_ERROR_READING_ATTRIBUTES,
  TIXML_ERROR_PARSING_EMPTY, TIXML_ERROR_READING_END_TAG, TIXML_ERROR_PARSING_UNKNOWN, TIXML_ERROR_PARSING_COMMENT,
  TIXML_ERROR_PARSING_DECLARATION, TIXML_ERROR_DOCUMENT_EMPTY, TIXML_ERROR_EMBEDDED_NULL, TIXML_ERROR_PARSING_CDATA,
  TIXML_ERROR_DOCUMENT_TOP_ONLY, TIXML_ERROR_STRING_COUNT
}
 

Public Member Functions

int Column () const
 See Row() More...
 
void * GetUserData ()
 Get a pointer to arbitrary user data. More...
 
const void * GetUserData () const
 Get a pointer to arbitrary user data. More...
 
virtual const char * Parse (const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)=0
 
virtual void Print (FILE *cfile, int depth) const =0
 
int Row () const
 
void SetUserData (void *user)
 Set a pointer to arbitrary user data. More...
 
 TiXmlBase ()
 
virtual ~TiXmlBase ()
 

Static Public Member Functions

static void EncodeString (const std::string &str, std::string *out)
 
static bool IsWhiteSpaceCondensed ()
 Return the current white space setting. More...
 
static void SetCondenseWhiteSpace (bool condense)
 

Static Public Attributes

static const int utf8ByteTable [256]
 

Static Protected Member Functions

static void ConvertUTF32ToUTF8 (unsigned long input, char *output, int *length)
 
static const char * GetChar (const char *p, char *_value, int *length, TiXmlEncoding encoding)
 
static const char * GetEntity (const char *in, char *value, int *length, TiXmlEncoding encoding)
 
static int IsAlpha (unsigned char anyByte, TiXmlEncoding encoding)
 
static int IsAlphaNum (unsigned char anyByte, TiXmlEncoding encoding)
 
static bool IsWhiteSpace (char c)
 
static bool IsWhiteSpace (int c)
 
static const char * ReadName (const char *p, std::string *name, TiXmlEncoding encoding)
 
static const char * ReadText (const char *in, std::string *text, bool ignoreWhiteSpace, const char *endTag, bool ignoreCase, TiXmlEncoding encoding)
 
static const char * SkipWhiteSpace (const char *, TiXmlEncoding encoding)
 
static bool StreamTo (std::istream *in, int character, std::string *tag)
 
static bool StreamWhiteSpace (std::istream *in, std::string *tag)
 
static bool StringEqual (const char *p, const char *endTag, bool ignoreCase, TiXmlEncoding encoding)
 
static int ToLower (int v, TiXmlEncoding encoding)
 

Protected Attributes

TiXmlCursor location
 
void * userData
 Field containing a generic user pointer. More...
 

Static Protected Attributes

static const char * errorString [TIXML_ERROR_STRING_COUNT]
 

Private Types

enum  { NUM_ENTITY = 5, MAX_ENTITY_LENGTH = 6 }
 

Private Member Functions

TiXmlBaseoperator= (const TiXmlBase &base)
 
 TiXmlBase (const TiXmlBase &)
 

Static Private Attributes

static bool condenseWhiteSpace = true
 
static Entity entity [NUM_ENTITY]
 

Friends

class TiXmlDocument
 
class TiXmlElement
 
class TiXmlNode
 

Detailed Description

TiXmlBase is a base class for every class in TinyXml. It does little except to establish that TinyXml classes can be printed and provide some utility functions.

In XML, the document and elements can contain other elements and other types of nodes.

A Document can contain: Element (container or leaf)
                        Comment (leaf)
                        Unknown (leaf)
                        Declaration( leaf )

An Element can contain: Element (container or leaf)
                        Text    (leaf)
                        Attributes (not on tree)
                        Comment (leaf)
                        Unknown (leaf)

A Decleration contains: Attributes (not on tree)

Definition at line 198 of file tinyxml.h.

Member Enumeration Documentation

anonymous enum
Enumerator
TIXML_NO_ERROR 
TIXML_ERROR 
TIXML_ERROR_OPENING_FILE 
TIXML_ERROR_OUT_OF_MEMORY 
TIXML_ERROR_PARSING_ELEMENT 
TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME 
TIXML_ERROR_READING_ELEMENT_VALUE 
TIXML_ERROR_READING_ATTRIBUTES 
TIXML_ERROR_PARSING_EMPTY 
TIXML_ERROR_READING_END_TAG 
TIXML_ERROR_PARSING_UNKNOWN 
TIXML_ERROR_PARSING_COMMENT 
TIXML_ERROR_PARSING_DECLARATION 
TIXML_ERROR_DOCUMENT_EMPTY 
TIXML_ERROR_EMBEDDED_NULL 
TIXML_ERROR_PARSING_CDATA 
TIXML_ERROR_DOCUMENT_TOP_ONLY 
TIXML_ERROR_STRING_COUNT 

Definition at line 268 of file tinyxml.h.

269  {
270  TIXML_NO_ERROR = 0,
271  TIXML_ERROR,
287 
289  };
anonymous enum
private
Enumerator
NUM_ENTITY 
MAX_ENTITY_LENGTH 

Definition at line 410 of file tinyxml.h.

411  {
412  NUM_ENTITY = 5,
414 
415  };

Constructor & Destructor Documentation

TiXmlBase::TiXmlBase ( )
inline

Definition at line 205 of file tinyxml.h.

205 : userData(0) {}
void * userData
Field containing a generic user pointer.
Definition: tinyxml.h:380
virtual TiXmlBase::~TiXmlBase ( )
inlinevirtual

Definition at line 206 of file tinyxml.h.

206 {}
TiXmlBase::TiXmlBase ( const TiXmlBase )
private

Member Function Documentation

int TiXmlBase::Column ( ) const
inline

See Row()

Definition at line 249 of file tinyxml.h.

References TiXmlCursor::col, and location.

void TiXmlBase::ConvertUTF32ToUTF8 ( unsigned long  input,
char *  output,
int *  length 
)
staticprotected

Definition at line 100 of file tinyxmlparser.cc.

References hitfit::char, and convertSQLitetoXML_cfg::output.

Referenced by GetEntity().

101 {
102  const unsigned long BYTE_MASK = 0xBF;
103  const unsigned long BYTE_MARK = 0x80;
104  const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
105 
106  if (input < 0x80)
107  *length = 1;
108  else if ( input < 0x800 )
109  *length = 2;
110  else if ( input < 0x10000 )
111  *length = 3;
112  else if ( input < 0x200000 )
113  *length = 4;
114  else
115  { *length = 0; return; } // This code won't covert this correctly anyway.
116 
117  output += *length;
118 
119  // Scary scary fall throughs.
120  switch (*length)
121  {
122  case 4:
123  --output;
124  *output = (char)((input | BYTE_MARK) & BYTE_MASK);
125  input >>= 6;
126  case 3:
127  --output;
128  *output = (char)((input | BYTE_MARK) & BYTE_MASK);
129  input >>= 6;
130  case 2:
131  --output;
132  *output = (char)((input | BYTE_MARK) & BYTE_MASK);
133  input >>= 6;
134  case 1:
135  --output;
136  *output = (char)(input | FIRST_BYTE_MARK[*length]);
137  }
138 }
static std::string const input
Definition: EdmProvDump.cc:44
void TiXmlBase::EncodeString ( const std::string &  str,
std::string *  out 
)
static

Expands entities in a string. Note this should not contian the tag's '<', '>', etc, or they will be transformed into entities!

Definition at line 59 of file tinyxml.cc.

References trackerHits::c, hitfit::char, entity, and i.

Referenced by TiXmlAttribute::Print(), TiXmlText::Print(), and TiXmlPrinter::Visit().

60 {
61  int i=0;
62 
63  while( i<(int)str.length() )
64  {
65  unsigned char c = (unsigned char) str[i];
66 
67  if ( c == '&'
68  && i < ( (int)str.length() - 2 )
69  && str[i+1] == '#'
70  && str[i+2] == 'x' )
71  {
72  // Hexadecimal character reference.
73  // Pass through unchanged.
74  // &#xA9; -- copyright symbol, for example.
75  //
76  // The -1 is a bug fix from Rob Laveaux. It keeps
77  // an overflow from happening if there is no ';'.
78  // There are actually 2 ways to exit this loop -
79  // while fails (error case) and break (semicolon found).
80  // However, there is no mechanism (currently) for
81  // this function to return an error.
82  while ( i<(int)str.length()-1 )
83  {
84  outString->append( str.c_str() + i, 1 );
85  ++i;
86  if ( str[i] == ';' )
87  break;
88  }
89  }
90  else if ( c == '&' )
91  {
92  outString->append( entity[0].str, entity[0].strLength );
93  ++i;
94  }
95  else if ( c == '<' )
96  {
97  outString->append( entity[1].str, entity[1].strLength );
98  ++i;
99  }
100  else if ( c == '>' )
101  {
102  outString->append( entity[2].str, entity[2].strLength );
103  ++i;
104  }
105  else if ( c == '\"' )
106  {
107  outString->append( entity[3].str, entity[3].strLength );
108  ++i;
109  }
110  else if ( c == '\'' )
111  {
112  outString->append( entity[4].str, entity[4].strLength );
113  ++i;
114  }
115  else if ( c < 32 )
116  {
117  // Easy pass at non-alpha/numeric/symbol
118  // Below 32 is symbolic.
119  char buf[ 32 ];
120 
121  #if defined(TIXML_SNPRINTF)
122  TIXML_SNPRINTF( buf, sizeof(buf), "&#x%02X;", (unsigned) ( c & 0xff ) );
123  #else
124  snprintf( buf, sizeof(buf), "&#x%02X;", (unsigned) ( c & 0xff ) );
125  #endif
126 
127  //*ME: warning C4267: convert 'size_t' to 'int'
128  //*ME: Int-Cast to make compiler happy ...
129  outString->append( buf, (int)strlen( buf ) );
130  ++i;
131  }
132  else
133  {
134  //char realc = (char) c;
135  //outString->append( &realc, 1 );
136  *outString += (char) c; // somewhat more efficient function call.
137  ++i;
138  }
139  }
140 }
int i
Definition: DBlmapReader.cc:9
static Entity entity[NUM_ENTITY]
Definition: tinyxml.h:416
static const char* TiXmlBase::GetChar ( const char *  p,
char *  _value,
int *  length,
TiXmlEncoding  encoding 
)
inlinestaticprotected

Definition at line 331 of file tinyxml.h.

References GetEntity(), i, AlCaHLTBitMon_ParallelJobs::p, TIXML_ENCODING_UTF8, and utf8ByteTable.

Referenced by ReadText().

332  {
333  assert( p );
334  if ( encoding == TIXML_ENCODING_UTF8 )
335  {
336  *length = utf8ByteTable[ *((const unsigned char*)p) ];
337  assert( *length >= 0 && *length < 5 );
338  }
339  else
340  {
341  *length = 1;
342  }
343 
344  if ( *length == 1 )
345  {
346  if ( *p == '&' )
347  return GetEntity( p, _value, length, encoding );
348  *_value = *p;
349  return p+1;
350  }
351  else if ( *length )
352  {
353  //strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe),
354  // and the null terminator isn't needed
355  for( int i=0; p[i] && i<*length; ++i ) {
356  _value[i] = p[i];
357  }
358  return p + (*length);
359  }
360  else
361  {
362  // Not valid text.
363  return 0;
364  }
365  }
static const int utf8ByteTable[256]
Definition: tinyxml.h:257
int i
Definition: DBlmapReader.cc:9
static const char * GetEntity(const char *in, char *value, int *length, TiXmlEncoding encoding)
const char * TiXmlBase::GetEntity ( const char *  in,
char *  value,
int *  length,
TiXmlEncoding  encoding 
)
staticprotected

Definition at line 451 of file tinyxmlparser.cc.

References hitfit::char, TiXmlBase::Entity::chr, ConvertUTF32ToUTF8(), delta, entity, i, VarParsing::mult, NUM_ENTITY, AlCaHLTBitMon_ParallelJobs::p, lumiQueryAPI::q, TIXML_ENCODING_UTF8, and TIXML_STRING.

Referenced by GetChar().

452 {
453  // Presume an entity, and pull it out.
454  TIXML_STRING ent;
455  *length = 0;
456 
457  if ( *(p+1) && *(p+1) == '#' && *(p+2) )
458  {
459  unsigned long ucs = 0;
460  ptrdiff_t delta = 0;
461  unsigned mult = 1;
462 
463  if ( *(p+2) == 'x' )
464  {
465  // Hexadecimal.
466  if ( !*(p+3) ) return 0;
467 
468  const char* q = p+3;
469  q = strchr( q, ';' );
470 
471  if ( !q || !*q ) return 0;
472 
473  delta = q-p;
474  --q;
475 
476  while ( *q != 'x' )
477  {
478  if ( *q >= '0' && *q <= '9' )
479  ucs += mult * (*q - '0');
480  else if ( *q >= 'a' && *q <= 'f' )
481  ucs += mult * (*q - 'a' + 10);
482  else if ( *q >= 'A' && *q <= 'F' )
483  ucs += mult * (*q - 'A' + 10 );
484  else
485  return 0;
486  mult *= 16;
487  --q;
488  }
489  }
490  else
491  {
492  // Decimal.
493  if ( !*(p+2) ) return 0;
494 
495  const char* q = p+2;
496  q = strchr( q, ';' );
497 
498  if ( !q || !*q ) return 0;
499 
500  delta = q-p;
501  --q;
502 
503  while ( *q != '#' )
504  {
505  if ( *q >= '0' && *q <= '9' )
506  ucs += mult * (*q - '0');
507  else
508  return 0;
509  mult *= 10;
510  --q;
511  }
512  }
513  if ( encoding == TIXML_ENCODING_UTF8 )
514  {
515  // convert the UCS to UTF-8
516  ConvertUTF32ToUTF8( ucs, value, length );
517  }
518  else
519  {
520  *value = (char)ucs;
521  *length = 1;
522  }
523  return p + delta + 1;
524  }
525 
526  // Now try to match it.
527  for( int i=0; i<NUM_ENTITY; ++i )
528  {
529  if ( strncmp( entity[i].str, p, entity[i].strLength ) == 0 )
530  {
531  assert( strlen( entity[i].str ) == entity[i].strLength );
532  *value = entity[i].chr;
533  *length = 1;
534  return ( p + entity[i].strLength );
535  }
536  }
537 
538  // So it wasn't an entity, its unrecognized, or something like that.
539  *value = *p; // Don't put back the last one, since we return it!
540  //*length = 1; // Leave unrecognized entities - this doesn't really work.
541  // Just writes strange XML.
542  return p+1;
543 }
dbl * delta
Definition: mlp_gen.cc:36
int i
Definition: DBlmapReader.cc:9
static void ConvertUTF32ToUTF8(unsigned long input, char *output, int *length)
static Entity entity[NUM_ENTITY]
Definition: tinyxml.h:416
#define TIXML_STRING
Definition: tinyxml.h:57
void* TiXmlBase::GetUserData ( )
inline

Get a pointer to arbitrary user data.

Definition at line 252 of file tinyxml.h.

References userData.

const void* TiXmlBase::GetUserData ( ) const
inline

Get a pointer to arbitrary user data.

Definition at line 253 of file tinyxml.h.

References userData.

int TiXmlBase::IsAlpha ( unsigned char  anyByte,
TiXmlEncoding  encoding 
)
staticprotected

Definition at line 141 of file tinyxmlparser.cc.

Referenced by TiXmlNode::Identify(), and ReadName().

142 {
143  // This will only work for low-ascii, everything else is assumed to be a valid
144  // letter. I'm not sure this is the best approach, but it is quite tricky trying
145  // to figure out alhabetical vs. not across encoding. So take a very
146  // conservative approach.
147 
148 // if ( encoding == TIXML_ENCODING_UTF8 )
149 // {
150  if ( anyByte < 127 )
151  return isalpha( anyByte );
152  else
153  return 1; // What else to do? The unicode set is huge...get the english ones right.
154 // }
155 // else
156 // {
157 // return isalpha( anyByte );
158 // }
159 }
int TiXmlBase::IsAlphaNum ( unsigned char  anyByte,
TiXmlEncoding  encoding 
)
staticprotected

Definition at line 162 of file tinyxmlparser.cc.

Referenced by ReadName().

163 {
164  // This will only work for low-ascii, everything else is assumed to be a valid
165  // letter. I'm not sure this is the best approach, but it is quite tricky trying
166  // to figure out alhabetical vs. not across encoding. So take a very
167  // conservative approach.
168 
169 // if ( encoding == TIXML_ENCODING_UTF8 )
170 // {
171  if ( anyByte < 127 )
172  return isalnum( anyByte );
173  else
174  return 1; // What else to do? The unicode set is huge...get the english ones right.
175 // }
176 // else
177 // {
178 // return isalnum( anyByte );
179 // }
180 }
static bool TiXmlBase::IsWhiteSpace ( char  c)
inlinestaticprotected

Definition at line 294 of file tinyxml.h.

Referenced by TiXmlText::Blank(), IsWhiteSpace(), TiXmlAttribute::Parse(), TiXmlDeclaration::Parse(), ReadText(), SkipWhiteSpace(), TiXmlElement::StreamIn(), and StreamWhiteSpace().

295  {
296  return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' );
297  }
static bool TiXmlBase::IsWhiteSpace ( int  c)
inlinestaticprotected

Definition at line 298 of file tinyxml.h.

References IsWhiteSpace().

299  {
300  if ( c < 256 )
301  return IsWhiteSpace( (char) c );
302  return false; // Again, only truly correct for English/Latin...but usually works.
303  }
static bool IsWhiteSpace(char c)
Definition: tinyxml.h:294
static bool TiXmlBase::IsWhiteSpaceCondensed ( )
inlinestatic

Return the current white space setting.

Definition at line 228 of file tinyxml.h.

References condenseWhiteSpace.

Referenced by TiXmlElement::ReadValue().

228 { return condenseWhiteSpace; }
static bool condenseWhiteSpace
Definition: tinyxml.h:417
TiXmlBase& TiXmlBase::operator= ( const TiXmlBase base)
private
virtual const char* TiXmlBase::Parse ( const char *  p,
TiXmlParsingData data,
TiXmlEncoding  encoding 
)
pure virtual
virtual void TiXmlBase::Print ( FILE *  cfile,
int  depth 
) const
pure virtual

All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL mode, std::string in STL mode.) Either or both cfile and str can be null.

This is a formatted print, and will insert tabs and newlines.

(For an unformatted stream, use the << operator.)

Implemented in TiXmlDocument, TiXmlUnknown, TiXmlDeclaration, TiXmlText, TiXmlComment, TiXmlElement, and TiXmlAttribute.

Referenced by TiXmlElement::Print().

const char * TiXmlBase::ReadName ( const char *  p,
std::string *  name,
TiXmlEncoding  encoding 
)
staticprotected

Definition at line 414 of file tinyxmlparser.cc.

References IsAlpha(), IsAlphaNum(), AlCaHLTBitMon_ParallelJobs::p, and dqm_diff::start.

Referenced by TiXmlAttribute::Parse(), and TiXmlElement::Parse().

415 {
416  // Oddly, not supported on some comilers,
417  //name->clear();
418  // So use this:
419  *name = "";
420  assert( p );
421 
422  // Names start with letters or underscores.
423  // Of course, in unicode, tinyxml has no idea what a letter *is*. The
424  // algorithm is generous.
425  //
426  // After that, they can be letters, underscores, numbers,
427  // hyphens, or colons. (Colons are valid ony for namespaces,
428  // but tinyxml can't tell namespaces from names.)
429  if ( p && *p
430  && ( IsAlpha( (unsigned char) *p, encoding ) || *p == '_' ) )
431  {
432  const char* start = p;
433  while( p && *p
434  && ( IsAlphaNum( (unsigned char ) *p, encoding )
435  || *p == '_'
436  || *p == '-'
437  || *p == '.'
438  || *p == ':' ) )
439  {
440  //(*name) += *p; // expensive
441  ++p;
442  }
443  if ( p-start > 0 ) {
444  name->assign( start, p-start );
445  }
446  return p;
447  }
448  return 0;
449 }
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
static int IsAlphaNum(unsigned char anyByte, TiXmlEncoding encoding)
static int IsAlpha(unsigned char anyByte, TiXmlEncoding encoding)
const char * TiXmlBase::ReadText ( const char *  in,
std::string *  text,
bool  ignoreWhiteSpace,
const char *  endTag,
bool  ignoreCase,
TiXmlEncoding  encoding 
)
staticprotected

Definition at line 586 of file tinyxmlparser.cc.

References condenseWhiteSpace, GetChar(), IsWhiteSpace(), AlCaHLTBitMon_ParallelJobs::p, SkipWhiteSpace(), and StringEqual().

Referenced by TiXmlAttribute::Parse(), and TiXmlText::Parse().

592 {
593  *text = "";
594  if ( !trimWhiteSpace // certain tags always keep whitespace
595  || !condenseWhiteSpace ) // if true, whitespace is always kept
596  {
597  // Keep all the white space.
598  while ( p && *p
599  && !StringEqual( p, endTag, caseInsensitive, encoding )
600  )
601  {
602  int len = 0;
603  char cArr[4] = { 0, 0, 0, 0 };
604  p = GetChar( p, cArr, &len, encoding );
605  text->append( cArr, len );
606  }
607  }
608  else
609  {
610  bool whitespace = false;
611 
612  // Remove leading white space:
613  p = SkipWhiteSpace( p, encoding );
614  while ( p && *p
615  && !StringEqual( p, endTag, caseInsensitive, encoding ) )
616  {
617  if ( *p == '\r' || *p == '\n' )
618  {
619  whitespace = true;
620  ++p;
621  }
622  else if ( IsWhiteSpace( *p ) )
623  {
624  whitespace = true;
625  ++p;
626  }
627  else
628  {
629  // If we've found whitespace, add it before the
630  // new character. Any whitespace just becomes a space.
631  if ( whitespace )
632  {
633  (*text) += ' ';
634  whitespace = false;
635  }
636  int len = 0;
637  char cArr[4] = { 0, 0, 0, 0 };
638  p = GetChar( p, cArr, &len, encoding );
639  if ( len == 1 )
640  (*text) += cArr[0]; // more efficient
641  else
642  text->append( cArr, len );
643  }
644  }
645  }
646  if ( p )
647  p += strlen( endTag );
648  return p;
649 }
static bool condenseWhiteSpace
Definition: tinyxml.h:417
static bool IsWhiteSpace(char c)
Definition: tinyxml.h:294
tuple text
Definition: runonSM.py:42
static const char * SkipWhiteSpace(const char *, TiXmlEncoding encoding)
static bool StringEqual(const char *p, const char *endTag, bool ignoreCase, TiXmlEncoding encoding)
static const char * GetChar(const char *p, char *_value, int *length, TiXmlEncoding encoding)
Definition: tinyxml.h:331
int TiXmlBase::Row ( ) const
inline

Return the position, in the original source file, of this node or attribute. The row and column are 1-based. (That is the first row and first column is 1,1). If the returns values are 0 or less, then the parser does not have a row and column value.

Generally, the row and column value will be set when the TiXmlDocument::Load(), TiXmlDocument::LoadFile(), or any TiXmlNode::Parse() is called. It will NOT be set when the DOM was created from operator>>.

The values reflect the initial load. Once the DOM is modified programmatically (by adding or changing nodes and attributes) the new values will NOT update to reflect changes in the document.

There is a minor performance cost to computing the row and column. Computation can be disabled if TiXmlDocument::SetTabSize() is called with 0 as the value.

See Also
TiXmlDocument::SetTabSize()

Definition at line 248 of file tinyxml.h.

References location, and TiXmlCursor::row.

248 { return location.row + 1; }
TiXmlCursor location
Definition: tinyxml.h:377
static void TiXmlBase::SetCondenseWhiteSpace ( bool  condense)
inlinestatic

The world does not agree on whether white space should be kept or not. In order to make everyone happy, these global, static functions are provided to set whether or not TinyXml will condense all white space into a single space or not. The default is to condense. Note changing this value is not thread safe.

Definition at line 225 of file tinyxml.h.

References condenseWhiteSpace.

225 { condenseWhiteSpace = condense; }
static bool condenseWhiteSpace
Definition: tinyxml.h:417
void TiXmlBase::SetUserData ( void *  user)
inline

Set a pointer to arbitrary user data.

Definition at line 251 of file tinyxml.h.

References hcal_dqm_sourceclient-file_cfg::user, and userData.

const char * TiXmlBase::SkipWhiteSpace ( const char *  p,
TiXmlEncoding  encoding 
)
staticprotected

Definition at line 326 of file tinyxmlparser.cc.

References IsWhiteSpace(), AlCaHLTBitMon_ParallelJobs::p, TIXML_ENCODING_UTF8, TIXML_UTF_LEAD_0, TIXML_UTF_LEAD_1, and TIXML_UTF_LEAD_2.

Referenced by TiXmlNode::Identify(), TiXmlAttribute::Parse(), TiXmlElement::Parse(), TiXmlComment::Parse(), TiXmlDeclaration::Parse(), TiXmlUnknown::Parse(), TiXmlDocument::Parse(), ReadText(), and TiXmlElement::ReadValue().

327 {
328  if ( !p || !*p )
329  {
330  return 0;
331  }
332  if ( encoding == TIXML_ENCODING_UTF8 )
333  {
334  while ( *p )
335  {
336  const unsigned char* pU = (const unsigned char*)p;
337 
338  // Skip the stupid Microsoft UTF-8 Byte order marks
339  if ( *(pU+0)==TIXML_UTF_LEAD_0
340  && *(pU+1)==TIXML_UTF_LEAD_1
341  && *(pU+2)==TIXML_UTF_LEAD_2 )
342  {
343  p += 3;
344  continue;
345  }
346  else if(*(pU+0)==TIXML_UTF_LEAD_0
347  && *(pU+1)==0xbfU
348  && *(pU+2)==0xbeU )
349  {
350  p += 3;
351  continue;
352  }
353  else if(*(pU+0)==TIXML_UTF_LEAD_0
354  && *(pU+1)==0xbfU
355  && *(pU+2)==0xbfU )
356  {
357  p += 3;
358  continue;
359  }
360 
361  if ( IsWhiteSpace( *p ) || *p == '\n' || *p =='\r' ) // Still using old rules for white space.
362  ++p;
363  else
364  break;
365  }
366  }
367  else
368  {
369  // Code altered by user. An extra pair of () was added to eliminate a compiler warning.
370  while ( ( *p && IsWhiteSpace( *p ) ) || *p == '\n' || *p =='\r' )
371  ++p;
372  }
373 
374  return p;
375 }
const unsigned char TIXML_UTF_LEAD_2
const unsigned char TIXML_UTF_LEAD_0
const unsigned char TIXML_UTF_LEAD_1
static bool IsWhiteSpace(char c)
Definition: tinyxml.h:294
bool TiXmlBase::StreamTo ( std::istream *  in,
int  character,
std::string *  tag 
)
staticprotected

Definition at line 393 of file tinyxmlparser.cc.

References trackerHits::c, and hitfit::char.

Referenced by TiXmlDocument::StreamIn().

394 {
395  //assert( character > 0 && character < 128 ); // else it won't work in utf-8
396  while ( in->good() )
397  {
398  int c = in->peek();
399  if ( c == character )
400  return true;
401  if ( c <= 0 ) // Silent failure: can't get document at this scope
402  return false;
403 
404  in->get();
405  *tag += (char) c;
406  }
407  return false;
408 }
bool TiXmlBase::StreamWhiteSpace ( std::istream *  in,
std::string *  tag 
)
staticprotected

Definition at line 378 of file tinyxmlparser.cc.

References trackerHits::c, hitfit::char, and IsWhiteSpace().

Referenced by TiXmlElement::StreamIn().

379 {
380  for( ;; )
381  {
382  if ( !in->good() ) return false;
383 
384  int c = in->peek();
385  // At this scope, we can't get to a document. So fail silently.
386  if ( !IsWhiteSpace( c ) || c <= 0 )
387  return true;
388 
389  *tag += (char) in->get();
390  }
391 }
static bool IsWhiteSpace(char c)
Definition: tinyxml.h:294
bool TiXmlBase::StringEqual ( const char *  p,
const char *  endTag,
bool  ignoreCase,
TiXmlEncoding  encoding 
)
staticprotected

Definition at line 546 of file tinyxmlparser.cc.

References AlCaHLTBitMon_ParallelJobs::p, lumiQueryAPI::q, GlobalPosition_Frontier_DevDB_cff::tag, and ToLower().

Referenced by TiXmlNode::Identify(), TiXmlElement::Parse(), TiXmlComment::Parse(), TiXmlText::Parse(), TiXmlDeclaration::Parse(), TiXmlDocument::Parse(), ReadText(), and TiXmlElement::ReadValue().

550 {
551  assert( p );
552  assert( tag );
553  if ( !p || !*p )
554  {
555  assert( 0 );
556  return false;
557  }
558 
559  const char* q = p;
560 
561  if ( ignoreCase )
562  {
563  while ( *q && *tag && ToLower( *q, encoding ) == ToLower( *tag, encoding ) )
564  {
565  ++q;
566  ++tag;
567  }
568 
569  if ( *tag == 0 )
570  return true;
571  }
572  else
573  {
574  while ( *q && *tag && *q == *tag )
575  {
576  ++q;
577  ++tag;
578  }
579 
580  if ( *tag == 0 ) // Have we found the end of the tag, and everything equal?
581  return true;
582  }
583  return false;
584 }
static int ToLower(int v, TiXmlEncoding encoding)
Definition: tinyxml.h:386
static int TiXmlBase::ToLower ( int  v,
TiXmlEncoding  encoding 
)
inlinestaticprotected

Definition at line 386 of file tinyxml.h.

References TIXML_ENCODING_UTF8, and findQualityFiles::v.

Referenced by StringEqual().

387  {
388  if ( encoding == TIXML_ENCODING_UTF8 )
389  {
390  if ( v < 128 ) return tolower( v );
391  return v;
392  }
393  else
394  {
395  return tolower( v );
396  }
397  }

Friends And Related Function Documentation

friend class TiXmlDocument
friend

Definition at line 202 of file tinyxml.h.

friend class TiXmlElement
friend

Definition at line 201 of file tinyxml.h.

friend class TiXmlNode
friend

Definition at line 200 of file tinyxml.h.

Member Data Documentation

bool TiXmlBase::condenseWhiteSpace = true
staticprivate

Definition at line 417 of file tinyxml.h.

Referenced by IsWhiteSpaceCondensed(), ReadText(), and SetCondenseWhiteSpace().

TiXmlBase::Entity TiXmlBase::entity
staticprivate
Initial value:
=
{
{ "&amp;", 5, '&' },
{ "&lt;", 4, '<' },
{ "&gt;", 4, '>' },
{ "&quot;", 6, '\"' },
{ "&apos;", 6, '\'' }
}

Definition at line 416 of file tinyxml.h.

Referenced by EncodeString(), and GetEntity().

const char * TiXmlBase::errorString
staticprotected
Initial value:
=
{
"No error",
"Error",
"Failed to open file",
"Memory allocation failed.",
"Error parsing Element.",
"Failed to read Element name",
"Error reading Element value.",
"Error reading Attributes.",
"Error: empty tag.",
"Error reading end tag.",
"Error parsing Unknown.",
"Error parsing Comment.",
"Error parsing Declaration.",
"Error document empty.",
"Error null (0) or unexpected EOF found in input stream.",
"Error parsing CDATA.",
"Error when TiXmlDocument added to document, because TiXmlDocument can only be at the root.",
}

Definition at line 375 of file tinyxml.h.

Referenced by TiXmlDocument::SetError().

TiXmlCursor TiXmlBase::location
protected
void* TiXmlBase::userData
protected

Field containing a generic user pointer.

Definition at line 380 of file tinyxml.h.

Referenced by TiXmlNode::CopyTo(), GetUserData(), and SetUserData().

const int TiXmlBase::utf8ByteTable
static
Initial value:
=
{
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
}

Definition at line 257 of file tinyxml.h.

Referenced by GetChar(), and TiXmlParsingData::Stamp().