mirror of https://github.com/AxioDL/tinyxml2.git
type XMLError. fix some comments
This commit is contained in:
parent
67abded7f7
commit
2fa8172236
34
tinyxml2.cpp
34
tinyxml2.cpp
|
@ -1072,7 +1072,7 @@ void XMLAttribute::SetName( const char* n )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int XMLAttribute::QueryIntValue( int* value ) const
|
XMLError XMLAttribute::QueryIntValue( int* value ) const
|
||||||
{
|
{
|
||||||
if ( XMLUtil::ToInt( Value(), value )) {
|
if ( XMLUtil::ToInt( Value(), value )) {
|
||||||
return XML_NO_ERROR;
|
return XML_NO_ERROR;
|
||||||
|
@ -1081,7 +1081,7 @@ int XMLAttribute::QueryIntValue( int* value ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int XMLAttribute::QueryUnsignedValue( unsigned int* value ) const
|
XMLError XMLAttribute::QueryUnsignedValue( unsigned int* value ) const
|
||||||
{
|
{
|
||||||
if ( XMLUtil::ToUnsigned( Value(), value )) {
|
if ( XMLUtil::ToUnsigned( Value(), value )) {
|
||||||
return XML_NO_ERROR;
|
return XML_NO_ERROR;
|
||||||
|
@ -1090,7 +1090,7 @@ int XMLAttribute::QueryUnsignedValue( unsigned int* value ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int XMLAttribute::QueryBoolValue( bool* value ) const
|
XMLError XMLAttribute::QueryBoolValue( bool* value ) const
|
||||||
{
|
{
|
||||||
if ( XMLUtil::ToBool( Value(), value )) {
|
if ( XMLUtil::ToBool( Value(), value )) {
|
||||||
return XML_NO_ERROR;
|
return XML_NO_ERROR;
|
||||||
|
@ -1099,7 +1099,7 @@ int XMLAttribute::QueryBoolValue( bool* value ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int XMLAttribute::QueryFloatValue( float* value ) const
|
XMLError XMLAttribute::QueryFloatValue( float* value ) const
|
||||||
{
|
{
|
||||||
if ( XMLUtil::ToFloat( Value(), value )) {
|
if ( XMLUtil::ToFloat( Value(), value )) {
|
||||||
return XML_NO_ERROR;
|
return XML_NO_ERROR;
|
||||||
|
@ -1108,7 +1108,7 @@ int XMLAttribute::QueryFloatValue( float* value ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int XMLAttribute::QueryDoubleValue( double* value ) const
|
XMLError XMLAttribute::QueryDoubleValue( double* value ) const
|
||||||
{
|
{
|
||||||
if ( XMLUtil::ToDouble( Value(), value )) {
|
if ( XMLUtil::ToDouble( Value(), value )) {
|
||||||
return XML_NO_ERROR;
|
return XML_NO_ERROR;
|
||||||
|
@ -1225,7 +1225,7 @@ const char* XMLElement::GetText() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int XMLElement::QueryIntText( int* _value ) const
|
XMLError XMLElement::QueryIntText( int* _value ) const
|
||||||
{
|
{
|
||||||
if ( FirstChild() && FirstChild()->ToText() ) {
|
if ( FirstChild() && FirstChild()->ToText() ) {
|
||||||
const char* t = FirstChild()->ToText()->Value();
|
const char* t = FirstChild()->ToText()->Value();
|
||||||
|
@ -1238,7 +1238,7 @@ int XMLElement::QueryIntText( int* _value ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int XMLElement::QueryUnsignedText( unsigned* _value ) const
|
XMLError XMLElement::QueryUnsignedText( unsigned* _value ) const
|
||||||
{
|
{
|
||||||
if ( FirstChild() && FirstChild()->ToText() ) {
|
if ( FirstChild() && FirstChild()->ToText() ) {
|
||||||
const char* t = FirstChild()->ToText()->Value();
|
const char* t = FirstChild()->ToText()->Value();
|
||||||
|
@ -1251,7 +1251,7 @@ int XMLElement::QueryUnsignedText( unsigned* _value ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int XMLElement::QueryBoolText( bool* _value ) const
|
XMLError XMLElement::QueryBoolText( bool* _value ) const
|
||||||
{
|
{
|
||||||
if ( FirstChild() && FirstChild()->ToText() ) {
|
if ( FirstChild() && FirstChild()->ToText() ) {
|
||||||
const char* t = FirstChild()->ToText()->Value();
|
const char* t = FirstChild()->ToText()->Value();
|
||||||
|
@ -1264,7 +1264,7 @@ int XMLElement::QueryBoolText( bool* _value ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int XMLElement::QueryDoubleText( double* _value ) const
|
XMLError XMLElement::QueryDoubleText( double* _value ) const
|
||||||
{
|
{
|
||||||
if ( FirstChild() && FirstChild()->ToText() ) {
|
if ( FirstChild() && FirstChild()->ToText() ) {
|
||||||
const char* t = FirstChild()->ToText()->Value();
|
const char* t = FirstChild()->ToText()->Value();
|
||||||
|
@ -1277,7 +1277,7 @@ int XMLElement::QueryDoubleText( double* _value ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int XMLElement::QueryFloatText( float* _value ) const
|
XMLError XMLElement::QueryFloatText( float* _value ) const
|
||||||
{
|
{
|
||||||
if ( FirstChild() && FirstChild()->ToText() ) {
|
if ( FirstChild() && FirstChild()->ToText() ) {
|
||||||
const char* t = FirstChild()->ToText()->Value();
|
const char* t = FirstChild()->ToText()->Value();
|
||||||
|
@ -1484,7 +1484,7 @@ XMLDocument::XMLDocument( bool processEntities, Whitespace whitespace ) :
|
||||||
XMLNode( 0 ),
|
XMLNode( 0 ),
|
||||||
_writeBOM( false ),
|
_writeBOM( false ),
|
||||||
_processEntities( processEntities ),
|
_processEntities( processEntities ),
|
||||||
_errorID( 0 ),
|
_errorID( XML_NO_ERROR ),
|
||||||
_whitespace( whitespace ),
|
_whitespace( whitespace ),
|
||||||
_errorStr1( 0 ),
|
_errorStr1( 0 ),
|
||||||
_errorStr2( 0 ),
|
_errorStr2( 0 ),
|
||||||
|
@ -1569,7 +1569,7 @@ XMLUnknown* XMLDocument::NewUnknown( const char* str )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int XMLDocument::LoadFile( const char* filename )
|
XMLError XMLDocument::LoadFile( const char* filename )
|
||||||
{
|
{
|
||||||
DeleteChildren();
|
DeleteChildren();
|
||||||
InitDocument();
|
InitDocument();
|
||||||
|
@ -1591,7 +1591,7 @@ int XMLDocument::LoadFile( const char* filename )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int XMLDocument::LoadFile( FILE* fp )
|
XMLError XMLDocument::LoadFile( FILE* fp )
|
||||||
{
|
{
|
||||||
DeleteChildren();
|
DeleteChildren();
|
||||||
InitDocument();
|
InitDocument();
|
||||||
|
@ -1626,7 +1626,7 @@ int XMLDocument::LoadFile( FILE* fp )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int XMLDocument::SaveFile( const char* filename, bool compact )
|
XMLError XMLDocument::SaveFile( const char* filename, bool compact )
|
||||||
{
|
{
|
||||||
FILE* fp = 0;
|
FILE* fp = 0;
|
||||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
|
#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
|
||||||
|
@ -1645,7 +1645,7 @@ int XMLDocument::SaveFile( const char* filename, bool compact )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int XMLDocument::SaveFile( FILE* fp, bool compact )
|
XMLError XMLDocument::SaveFile( FILE* fp, bool compact )
|
||||||
{
|
{
|
||||||
XMLPrinter stream( fp, compact );
|
XMLPrinter stream( fp, compact );
|
||||||
Print( &stream );
|
Print( &stream );
|
||||||
|
@ -1653,7 +1653,7 @@ int XMLDocument::SaveFile( FILE* fp, bool compact )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int XMLDocument::Parse( const char* p, size_t len )
|
XMLError XMLDocument::Parse( const char* p, size_t len )
|
||||||
{
|
{
|
||||||
DeleteChildren();
|
DeleteChildren();
|
||||||
InitDocument();
|
InitDocument();
|
||||||
|
@ -1691,7 +1691,7 @@ void XMLDocument::Print( XMLPrinter* streamer )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void XMLDocument::SetError( int error, const char* str1, const char* str2 )
|
void XMLDocument::SetError( XMLError error, const char* str1, const char* str2 )
|
||||||
{
|
{
|
||||||
_errorID = error;
|
_errorID = error;
|
||||||
_errorStr1 = str1;
|
_errorStr1 = str1;
|
||||||
|
|
83
tinyxml2.h
83
tinyxml2.h
|
@ -541,23 +541,29 @@ public:
|
||||||
return _document;
|
return _document;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Safely cast to an Element, or null.
|
||||||
virtual XMLElement* ToElement() {
|
virtual XMLElement* ToElement() {
|
||||||
return 0; ///< Safely cast to an Element, or null.
|
return 0;
|
||||||
}
|
}
|
||||||
|
/// Safely cast to Text, or null.
|
||||||
virtual XMLText* ToText() {
|
virtual XMLText* ToText() {
|
||||||
return 0; ///< Safely cast to Text, or null.
|
return 0;
|
||||||
}
|
}
|
||||||
|
/// Safely cast to a Comment, or null.
|
||||||
virtual XMLComment* ToComment() {
|
virtual XMLComment* ToComment() {
|
||||||
return 0; ///< Safely cast to a Comment, or null.
|
return 0;
|
||||||
}
|
}
|
||||||
|
/// Safely cast to a Document, or null.
|
||||||
virtual XMLDocument* ToDocument() {
|
virtual XMLDocument* ToDocument() {
|
||||||
return 0; ///< Safely cast to a Document, or null.
|
return 0;
|
||||||
}
|
}
|
||||||
|
/// Safely cast to a Declaration, or null.
|
||||||
virtual XMLDeclaration* ToDeclaration() {
|
virtual XMLDeclaration* ToDeclaration() {
|
||||||
return 0; ///< Safely cast to a Declaration, or null.
|
return 0;
|
||||||
}
|
}
|
||||||
|
/// Safely cast to an Unknown, or null.
|
||||||
virtual XMLUnknown* ToUnknown() {
|
virtual XMLUnknown* ToUnknown() {
|
||||||
return 0; ///< Safely cast to an Unknown, or null.
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual const XMLElement* ToElement() const {
|
virtual const XMLElement* ToElement() const {
|
||||||
|
@ -920,7 +926,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
enum {
|
enum XMLError {
|
||||||
XML_NO_ERROR = 0,
|
XML_NO_ERROR = 0,
|
||||||
XML_SUCCESS = 0,
|
XML_SUCCESS = 0,
|
||||||
|
|
||||||
|
@ -958,14 +964,17 @@ class XMLAttribute
|
||||||
{
|
{
|
||||||
friend class XMLElement;
|
friend class XMLElement;
|
||||||
public:
|
public:
|
||||||
|
/// The name of the attribute.
|
||||||
const char* Name() const {
|
const char* Name() const {
|
||||||
return _name.GetStr(); ///< The name of the attribute.
|
return _name.GetStr();
|
||||||
}
|
}
|
||||||
|
/// The value of the attribute.
|
||||||
const char* Value() const {
|
const char* Value() const {
|
||||||
return _value.GetStr(); ///< The value of the attribute.
|
return _value.GetStr();
|
||||||
}
|
}
|
||||||
|
/// The next attribute in the list.
|
||||||
const XMLAttribute* Next() const {
|
const XMLAttribute* Next() const {
|
||||||
return _next; ///< The next attribute in the list.
|
return _next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** IntAttribute interprets the attribute as an integer, and returns the value.
|
/** IntAttribute interprets the attribute as an integer, and returns the value.
|
||||||
|
@ -1006,15 +1015,15 @@ public:
|
||||||
in the provided paremeter. The function will return XML_NO_ERROR on success,
|
in the provided paremeter. The function will return XML_NO_ERROR on success,
|
||||||
and XML_WRONG_ATTRIBUTE_TYPE if the conversion is not successful.
|
and XML_WRONG_ATTRIBUTE_TYPE if the conversion is not successful.
|
||||||
*/
|
*/
|
||||||
int QueryIntValue( int* value ) const;
|
XMLError QueryIntValue( int* value ) const;
|
||||||
/// See QueryIntAttribute
|
/// See QueryIntAttribute
|
||||||
int QueryUnsignedValue( unsigned int* value ) const;
|
XMLError QueryUnsignedValue( unsigned int* value ) const;
|
||||||
/// See QueryIntAttribute
|
/// See QueryIntAttribute
|
||||||
int QueryBoolValue( bool* value ) const;
|
XMLError QueryBoolValue( bool* value ) const;
|
||||||
/// See QueryIntAttribute
|
/// See QueryIntAttribute
|
||||||
int QueryDoubleValue( double* value ) const;
|
XMLError QueryDoubleValue( double* value ) const;
|
||||||
/// See QueryIntAttribute
|
/// See QueryIntAttribute
|
||||||
int QueryFloatValue( float* value ) const;
|
XMLError QueryFloatValue( float* value ) const;
|
||||||
|
|
||||||
/// Set the attribute to a string value.
|
/// Set the attribute to a string value.
|
||||||
void SetAttribute( const char* value );
|
void SetAttribute( const char* value );
|
||||||
|
@ -1147,7 +1156,7 @@ public:
|
||||||
QueryIntAttribute( "foo", &value ); // if "foo" isn't found, value will still be 10
|
QueryIntAttribute( "foo", &value ); // if "foo" isn't found, value will still be 10
|
||||||
@endverbatim
|
@endverbatim
|
||||||
*/
|
*/
|
||||||
int QueryIntAttribute( const char* name, int* value ) const {
|
XMLError QueryIntAttribute( const char* name, int* value ) const {
|
||||||
const XMLAttribute* a = FindAttribute( name );
|
const XMLAttribute* a = FindAttribute( name );
|
||||||
if ( !a ) {
|
if ( !a ) {
|
||||||
return XML_NO_ATTRIBUTE;
|
return XML_NO_ATTRIBUTE;
|
||||||
|
@ -1155,7 +1164,7 @@ public:
|
||||||
return a->QueryIntValue( value );
|
return a->QueryIntValue( value );
|
||||||
}
|
}
|
||||||
/// See QueryIntAttribute()
|
/// See QueryIntAttribute()
|
||||||
int QueryUnsignedAttribute( const char* name, unsigned int* value ) const {
|
XMLError QueryUnsignedAttribute( const char* name, unsigned int* value ) const {
|
||||||
const XMLAttribute* a = FindAttribute( name );
|
const XMLAttribute* a = FindAttribute( name );
|
||||||
if ( !a ) {
|
if ( !a ) {
|
||||||
return XML_NO_ATTRIBUTE;
|
return XML_NO_ATTRIBUTE;
|
||||||
|
@ -1163,7 +1172,7 @@ public:
|
||||||
return a->QueryUnsignedValue( value );
|
return a->QueryUnsignedValue( value );
|
||||||
}
|
}
|
||||||
/// See QueryIntAttribute()
|
/// See QueryIntAttribute()
|
||||||
int QueryBoolAttribute( const char* name, bool* value ) const {
|
XMLError QueryBoolAttribute( const char* name, bool* value ) const {
|
||||||
const XMLAttribute* a = FindAttribute( name );
|
const XMLAttribute* a = FindAttribute( name );
|
||||||
if ( !a ) {
|
if ( !a ) {
|
||||||
return XML_NO_ATTRIBUTE;
|
return XML_NO_ATTRIBUTE;
|
||||||
|
@ -1171,7 +1180,7 @@ public:
|
||||||
return a->QueryBoolValue( value );
|
return a->QueryBoolValue( value );
|
||||||
}
|
}
|
||||||
/// See QueryIntAttribute()
|
/// See QueryIntAttribute()
|
||||||
int QueryDoubleAttribute( const char* name, double* value ) const {
|
XMLError QueryDoubleAttribute( const char* name, double* value ) const {
|
||||||
const XMLAttribute* a = FindAttribute( name );
|
const XMLAttribute* a = FindAttribute( name );
|
||||||
if ( !a ) {
|
if ( !a ) {
|
||||||
return XML_NO_ATTRIBUTE;
|
return XML_NO_ATTRIBUTE;
|
||||||
|
@ -1179,7 +1188,7 @@ public:
|
||||||
return a->QueryDoubleValue( value );
|
return a->QueryDoubleValue( value );
|
||||||
}
|
}
|
||||||
/// See QueryIntAttribute()
|
/// See QueryIntAttribute()
|
||||||
int QueryFloatAttribute( const char* name, float* value ) const {
|
XMLError QueryFloatAttribute( const char* name, float* value ) const {
|
||||||
const XMLAttribute* a = FindAttribute( name );
|
const XMLAttribute* a = FindAttribute( name );
|
||||||
if ( !a ) {
|
if ( !a ) {
|
||||||
return XML_NO_ATTRIBUTE;
|
return XML_NO_ATTRIBUTE;
|
||||||
|
@ -1281,15 +1290,15 @@ public:
|
||||||
to the requested type, and XML_NO_TEXT_NODE if there is no child text to query.
|
to the requested type, and XML_NO_TEXT_NODE if there is no child text to query.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
int QueryIntText( int* _value ) const;
|
XMLError QueryIntText( int* _value ) const;
|
||||||
/// See QueryIntText()
|
/// See QueryIntText()
|
||||||
int QueryUnsignedText( unsigned* _value ) const;
|
XMLError QueryUnsignedText( unsigned* _value ) const;
|
||||||
/// See QueryIntText()
|
/// See QueryIntText()
|
||||||
int QueryBoolText( bool* _value ) const;
|
XMLError QueryBoolText( bool* _value ) const;
|
||||||
/// See QueryIntText()
|
/// See QueryIntText()
|
||||||
int QueryDoubleText( double* _value ) const;
|
XMLError QueryDoubleText( double* _value ) const;
|
||||||
/// See QueryIntText()
|
/// See QueryIntText()
|
||||||
int QueryFloatText( float* _value ) const;
|
XMLError QueryFloatText( float* _value ) const;
|
||||||
|
|
||||||
// internal:
|
// internal:
|
||||||
enum {
|
enum {
|
||||||
|
@ -1359,14 +1368,14 @@ public:
|
||||||
specified, TinyXML will assume 'xml' points to a
|
specified, TinyXML will assume 'xml' points to a
|
||||||
null terminated string.
|
null terminated string.
|
||||||
*/
|
*/
|
||||||
int Parse( const char* xml, size_t nBytes=(size_t)(-1) );
|
XMLError Parse( const char* xml, size_t nBytes=(size_t)(-1) );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Load an XML file from disk.
|
Load an XML file from disk.
|
||||||
Returns XML_NO_ERROR (0) on success, or
|
Returns XML_NO_ERROR (0) on success, or
|
||||||
an errorID.
|
an errorID.
|
||||||
*/
|
*/
|
||||||
int LoadFile( const char* filename );
|
XMLError LoadFile( const char* filename );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Load an XML file from disk. You are responsible
|
Load an XML file from disk. You are responsible
|
||||||
|
@ -1375,14 +1384,14 @@ public:
|
||||||
Returns XML_NO_ERROR (0) on success, or
|
Returns XML_NO_ERROR (0) on success, or
|
||||||
an errorID.
|
an errorID.
|
||||||
*/
|
*/
|
||||||
int LoadFile( std::FILE* );
|
XMLError LoadFile( std::FILE* );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Save the XML file to disk.
|
Save the XML file to disk.
|
||||||
Returns XML_NO_ERROR (0) on success, or
|
Returns XML_NO_ERROR (0) on success, or
|
||||||
an errorID.
|
an errorID.
|
||||||
*/
|
*/
|
||||||
int SaveFile( const char* filename, bool compact = false );
|
XMLError SaveFile( const char* filename, bool compact = false );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Save the XML file to disk. You are responsible
|
Save the XML file to disk. You are responsible
|
||||||
|
@ -1391,7 +1400,7 @@ public:
|
||||||
Returns XML_NO_ERROR (0) on success, or
|
Returns XML_NO_ERROR (0) on success, or
|
||||||
an errorID.
|
an errorID.
|
||||||
*/
|
*/
|
||||||
int SaveFile( std::FILE* fp, bool compact = false );
|
XMLError SaveFile( std::FILE* fp, bool compact = false );
|
||||||
|
|
||||||
bool ProcessEntities() const {
|
bool ProcessEntities() const {
|
||||||
return _processEntities;
|
return _processEntities;
|
||||||
|
@ -1484,14 +1493,14 @@ public:
|
||||||
node->_parent->DeleteChild( node );
|
node->_parent->DeleteChild( node );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetError( int error, const char* str1, const char* str2 );
|
void SetError( XMLError error, const char* str1, const char* str2 );
|
||||||
|
|
||||||
/// Return true if there was an error parsing the document.
|
/// Return true if there was an error parsing the document.
|
||||||
bool Error() const {
|
bool Error() const {
|
||||||
return _errorID != XML_NO_ERROR;
|
return _errorID != XML_NO_ERROR;
|
||||||
}
|
}
|
||||||
/// Return the errorID.
|
/// Return the errorID.
|
||||||
int ErrorID() const {
|
XMLError ErrorID() const {
|
||||||
return _errorID;
|
return _errorID;
|
||||||
}
|
}
|
||||||
/// Return a possibly helpful diagnostic location or string.
|
/// Return a possibly helpful diagnostic location or string.
|
||||||
|
@ -1520,13 +1529,13 @@ private:
|
||||||
void operator=( const XMLDocument& ); // not supported
|
void operator=( const XMLDocument& ); // not supported
|
||||||
void InitDocument();
|
void InitDocument();
|
||||||
|
|
||||||
bool _writeBOM;
|
bool _writeBOM;
|
||||||
bool _processEntities;
|
bool _processEntities;
|
||||||
int _errorID;
|
XMLError _errorID;
|
||||||
Whitespace _whitespace;
|
Whitespace _whitespace;
|
||||||
const char* _errorStr1;
|
const char* _errorStr1;
|
||||||
const char* _errorStr2;
|
const char* _errorStr2;
|
||||||
char* _charBuffer;
|
char* _charBuffer;
|
||||||
|
|
||||||
MemPoolT< sizeof(XMLElement) > _elementPool;
|
MemPoolT< sizeof(XMLElement) > _elementPool;
|
||||||
MemPoolT< sizeof(XMLAttribute) > _attributePool;
|
MemPoolT< sizeof(XMLAttribute) > _attributePool;
|
||||||
|
|
|
@ -334,7 +334,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
||||||
|
|
||||||
XMLDocument doc;
|
XMLDocument doc;
|
||||||
doc.Parse( error );
|
doc.Parse( error );
|
||||||
XMLTest( "Bad XML", doc.ErrorID(), (int)XML_ERROR_PARSING_ATTRIBUTE );
|
XMLTest( "Bad XML", doc.ErrorID(), XML_ERROR_PARSING_ATTRIBUTE );
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -633,7 +633,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
||||||
XMLDocument doc;
|
XMLDocument doc;
|
||||||
doc.Parse( doctype );
|
doc.Parse( doctype );
|
||||||
|
|
||||||
XMLTest( "Parsing repeated attributes.", (int)XML_ERROR_PARSING_ATTRIBUTE, doc.ErrorID() ); // is an error to tinyxml (didn't use to be, but caused issues)
|
XMLTest( "Parsing repeated attributes.", XML_ERROR_PARSING_ATTRIBUTE, doc.ErrorID() ); // is an error to tinyxml (didn't use to be, but caused issues)
|
||||||
doc.PrintError();
|
doc.PrintError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -651,7 +651,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
||||||
const char* str = " ";
|
const char* str = " ";
|
||||||
XMLDocument doc;
|
XMLDocument doc;
|
||||||
doc.Parse( str );
|
doc.Parse( str );
|
||||||
XMLTest( "Empty document error", (int)XML_ERROR_EMPTY_DOCUMENT, doc.ErrorID() );
|
XMLTest( "Empty document error", XML_ERROR_EMPTY_DOCUMENT, doc.ErrorID() );
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -678,7 +678,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
||||||
xml.Parse("<x> ");
|
xml.Parse("<x> ");
|
||||||
XMLTest("Missing end tag with trailing whitespace", xml.Error(), true);
|
XMLTest("Missing end tag with trailing whitespace", xml.Error(), true);
|
||||||
xml.Parse("<x></y>");
|
xml.Parse("<x></y>");
|
||||||
XMLTest("Mismatched tags", xml.ErrorID(), (int)XML_ERROR_MISMATCHED_ELEMENT);
|
XMLTest("Mismatched tags", xml.ErrorID(), XML_ERROR_MISMATCHED_ELEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue