#include <tinyxml.h>
Inheritance diagram for TiXmlDeclaration:

Public Member Functions | |
| TiXmlDeclaration () | |
| Construct an empty declaration. | |
| TiXmlDeclaration (const std::string &_version, const std::string &_encoding, const std::string &_standalone) | |
| Constructor. | |
| TiXmlDeclaration (const char *_version, const char *_encoding, const char *_standalone) | |
| Construct. | |
| TiXmlDeclaration (const TiXmlDeclaration ©) | |
| void | operator= (const TiXmlDeclaration ©) |
| virtual | ~TiXmlDeclaration () |
| const char * | Version () const |
| Version. Will return an empty string if none was found. | |
| const char * | Encoding () const |
| Encoding. Will return an empty string if none was found. | |
| const char * | Standalone () const |
| Is this a standalone document? | |
| virtual TiXmlNode * | Clone () const |
| Creates a copy of this Declaration and returns it. | |
| virtual void | Print (FILE *cfile, int depth, TIXML_STRING *str) const |
| virtual void | Print (FILE *cfile, int depth) const |
| virtual const char * | Parse (const char *p, TiXmlParsingData *data, TiXmlEncoding encoding) |
| virtual const TiXmlDeclaration * | ToDeclaration () const |
| Cast to a more defined type. Will return null not of the requested type. | |
| virtual TiXmlDeclaration * | ToDeclaration () |
| Cast to a more defined type. Will return null not of the requested type. | |
| virtual bool | Accept (TiXmlVisitor *visitor) const |
Protected Member Functions | |
| void | CopyTo (TiXmlDeclaration *target) const |
| virtual void | StreamIn (std::istream *in, TIXML_STRING *tag) |
Private Attributes | |
| TIXML_STRING | version |
| TIXML_STRING | encoding |
| TIXML_STRING | standalone |
<?xml version="1.0" standalone="yes"?>
TinyXml will happily read or write files without a declaration, however. There are 3 possible attributes to the declaration: version, encoding, and standalone.
Note: In this version of the code, the attributes are handled as special cases, not generic attributes, simply because there can only be at most 3 and they are always the same.
Definition at line 1256 of file tinyxml.h.
|
|
Construct an empty declaration.
Definition at line 1260 of file tinyxml.h. Referenced by Clone(). 01260 : TiXmlNode( TiXmlNode::DECLARATION ) {}
|
|
||||||||||||||||
|
Constructor.
Definition at line 1376 of file tinyxml.cpp. References encoding, standalone, and version. 01379 : TiXmlNode( TiXmlNode::DECLARATION ) 01380 { 01381 version = _version; 01382 encoding = _encoding; 01383 standalone = _standalone; 01384 }
|
|
||||||||||||||||
|
Construct.
Definition at line 1364 of file tinyxml.cpp. References encoding, standalone, and version. 01367 : TiXmlNode( TiXmlNode::DECLARATION ) 01368 { 01369 version = _version; 01370 encoding = _encoding; 01371 standalone = _standalone; 01372 }
|
|
|
Definition at line 1388 of file tinyxml.cpp. References CopyTo().
|
|
|
Definition at line 1277 of file tinyxml.h. 01277 {}
|
|
|
Walk the XML tree visiting this node and all of its children. Implements TiXmlNode. Definition at line 1434 of file tinyxml.cpp. References TiXmlVisitor::Visit(). 01435 {
01436 return visitor->Visit( *this );
01437 }
|
|
|
Creates a copy of this Declaration and returns it.
Implements TiXmlNode. Definition at line 1440 of file tinyxml.cpp. References CopyTo(), and TiXmlDeclaration(). 01441 {
01442 TiXmlDeclaration* clone = new TiXmlDeclaration();
01443
01444 if ( !clone )
01445 return 0;
01446
01447 CopyTo( clone );
01448 return clone;
01449 }
|
|
|
Definition at line 1424 of file tinyxml.cpp. References TiXmlNode::CopyTo(), encoding, standalone, and version. Referenced by Clone(), operator=(), and TiXmlDeclaration(). 01425 {
01426 TiXmlNode::CopyTo( target );
01427
01428 target->version = version;
01429 target->encoding = encoding;
01430 target->standalone = standalone;
01431 }
|
|
|
Encoding. Will return an empty string if none was found.
Definition at line 1282 of file tinyxml.h. References encoding. Referenced by TiXmlDocument::Parse(). 01282 { return encoding.c_str (); }
|
|
|
Definition at line 1395 of file tinyxml.cpp. References TiXmlNode::Clear(), and CopyTo().
|
|
||||||||||||||||
|
Implements TiXmlBase. Definition at line 1540 of file tinyxmlparser.cpp. References TiXmlParsingData::Cursor(), encoding, TiXmlNode::GetDocument(), TiXmlBase::IsWhiteSpace(), TiXmlAttribute::Parse(), TiXmlDocument::SetError(), TiXmlBase::SkipWhiteSpace(), TiXmlParsingData::Stamp(), standalone, TiXmlBase::StringEqual(), TiXmlAttribute::Value(), and version. 01541 {
01542 p = SkipWhiteSpace( p, _encoding );
01543 // Find the beginning, find the end, and look for
01544 // the stuff in-between.
01545 TiXmlDocument* document = GetDocument();
01546 if ( !p || !*p || !StringEqual( p, "<?xml", true, _encoding ) )
01547 {
01548 if ( document ) document->SetError( TIXML_ERROR_PARSING_DECLARATION, 0, 0, _encoding );
01549 return 0;
01550 }
01551 if ( data )
01552 {
01553 data->Stamp( p, _encoding );
01554 location = data->Cursor();
01555 }
01556 p += 5;
01557
01558 version = "";
01559 encoding = "";
01560 standalone = "";
01561
01562 while ( p && *p )
01563 {
01564 if ( *p == '>' )
01565 {
01566 ++p;
01567 return p;
01568 }
01569
01570 p = SkipWhiteSpace( p, _encoding );
01571 if ( StringEqual( p, "version", true, _encoding ) )
01572 {
01573 TiXmlAttribute attrib;
01574 p = attrib.Parse( p, data, _encoding );
01575 version = attrib.Value();
01576 }
01577 else if ( StringEqual( p, "encoding", true, _encoding ) )
01578 {
01579 TiXmlAttribute attrib;
01580 p = attrib.Parse( p, data, _encoding );
01581 encoding = attrib.Value();
01582 }
01583 else if ( StringEqual( p, "standalone", true, _encoding ) )
01584 {
01585 TiXmlAttribute attrib;
01586 p = attrib.Parse( p, data, _encoding );
01587 standalone = attrib.Value();
01588 }
01589 else
01590 {
01591 // Read over whatever it is.
01592 while( p && *p && *p != '>' && !IsWhiteSpace( *p ) )
01593 ++p;
01594 }
01595 }
01596 return 0;
01597 }
|
|
||||||||||||
|
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.) Implements TiXmlBase. Definition at line 1290 of file tinyxml.h. References Print(). 01290 {
01291 Print( cfile, depth, 0 );
01292 }
|
|
||||||||||||||||
|
Definition at line 1402 of file tinyxml.cpp. References encoding, standalone, and version. Referenced by Print(), and TiXmlPrinter::Visit(). 01403 {
01404 if ( cfile ) fprintf( cfile, "<?xml " );
01405 if ( str ) (*str) += "<?xml ";
01406
01407 if ( !version.empty() ) {
01408 if ( cfile ) fprintf (cfile, "version=\"%s\" ", version.c_str ());
01409 if ( str ) { (*str) += "version=\""; (*str) += version; (*str) += "\" "; }
01410 }
01411 if ( !encoding.empty() ) {
01412 if ( cfile ) fprintf (cfile, "encoding=\"%s\" ", encoding.c_str ());
01413 if ( str ) { (*str) += "encoding=\""; (*str) += encoding; (*str) += "\" "; }
01414 }
01415 if ( !standalone.empty() ) {
01416 if ( cfile ) fprintf (cfile, "standalone=\"%s\" ", standalone.c_str ());
01417 if ( str ) { (*str) += "standalone=\""; (*str) += standalone; (*str) += "\" "; }
01418 }
01419 if ( cfile ) fprintf( cfile, "?>" );
01420 if ( str ) (*str) += "?>";
01421 }
|
|
|
Is this a standalone document?
Definition at line 1284 of file tinyxml.h. References standalone. 01284 { return standalone.c_str (); }
|
|
||||||||||||
|
Implements TiXmlNode. Definition at line 1517 of file tinyxmlparser.cpp. References TiXmlNode::GetDocument(), TiXmlDocument::SetError(), and TIXML_ENCODING_UNKNOWN. 01518 {
01519 while ( in->good() )
01520 {
01521 int c = in->get();
01522 if ( c <= 0 )
01523 {
01524 TiXmlDocument* document = GetDocument();
01525 if ( document )
01526 document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
01527 return;
01528 }
01529 (*tag) += (char) c;
01530
01531 if ( c == '>' )
01532 {
01533 // All is well.
01534 return;
01535 }
01536 }
01537 }
|
|
|
Cast to a more defined type. Will return null not of the requested type.
Reimplemented from TiXmlNode. |
|
|
Cast to a more defined type. Will return null not of the requested type.
Reimplemented from TiXmlNode. |
|
|
Version. Will return an empty string if none was found.
Definition at line 1280 of file tinyxml.h. References version. 01280 { return version.c_str (); }
|
|
|
Definition at line 1313 of file tinyxml.h. Referenced by CopyTo(), Encoding(), Parse(), Print(), and TiXmlDeclaration(). |
|
|
Definition at line 1314 of file tinyxml.h. Referenced by CopyTo(), Parse(), Print(), Standalone(), and TiXmlDeclaration(). |
|
|
Definition at line 1312 of file tinyxml.h. Referenced by CopyTo(), Parse(), Print(), TiXmlDeclaration(), and Version(). |
1.3.9.1