本文整理汇总了C++中TiXmlDocumentA::SetError方法的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlDocumentA::SetError方法的具体用法?C++ TiXmlDocumentA::SetError怎么用?C++ TiXmlDocumentA::SetError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiXmlDocumentA
的用法示例。
在下文中一共展示了TiXmlDocumentA::SetError方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Parse
const char* TiXmlUnknownA::Parse( const char* p, TiXmlParsingDataA* data )
{
TiXmlDocumentA* document = GetDocument();
p = SkipWhiteSpace( p );
// TiXmlParsingDataA data( p, prevData );
if ( data )
{
data->Stamp( p );
location = data->Cursor();
}
if ( !p || !*p || *p != '<' )
{
if ( document ) document->SetError( TIXMLA_ERROR_PARSING_UNKNOWN, p, data );
return 0;
}
++p;
value = "";
while ( p && *p && *p != '>' )
{
value += *p;
++p;
}
if ( !p )
{
if ( document ) document->SetError( TIXMLA_ERROR_PARSING_UNKNOWN, 0, 0 );
}
if ( *p == '>' )
return p+1;
return p;
}
示例2: ReadValue
const char* TiXmlElementA::ReadValue( const char* p, TiXmlParsingDataA* data )
{
TiXmlDocumentA* document = GetDocument();
// Read in text and elements in any order.
p = SkipWhiteSpace( p );
while ( p && *p )
{
if ( *p != '<' )
{
// Take what we have, make a text element.
TiXmlTextA* textNode = new TiXmlTextA( "" );
if ( !textNode )
{
if ( document )
{
document->SetError( TIXMLA_ERROR_OUT_OF_MEMORY, 0, 0 );
}
return 0;
}
p = textNode->Parse( p, data );
if ( !textNode->Blank() )
LinkEndChild( textNode );
else
delete textNode;
}
else
{
// We hit a '<'
// Have we hit a new element or an end tag?
if ( StringEqual( p, "</", false ) )
{
return p;
}
else
{
TiXmlNodeA* node = Identify( p );
if ( node )
{
p = node->Parse( p, data );
LinkEndChild( node );
}
else
{
return 0;
}
}
}
p = SkipWhiteSpace( p );
}
if ( !p )
{
if ( document ) document->SetError( TIXMLA_ERROR_READING_ELEMENT_VALUE, 0, 0 );
}
return p;
}
示例3: SetAttribute
void TiXmlElementA::SetAttribute( const char * name, const char * _value )
{
TiXmlAttributeA* node = attributeSet.Find( name );
if ( node )
{
node->SetValue( _value );
return;
}
TiXmlAttributeA* attrib = new TiXmlAttributeA( name, _value );
if ( attrib )
{
attributeSet.Add( attrib );
}
else
{
TiXmlDocumentA* document = GetDocument();
if ( document ) document->SetError( TIXMLA_ERROR_OUT_OF_MEMORY, 0, 0 );
}
}
示例4: Identify
TiXmlNodeA* TiXmlNodeA::Identify( const char* p )
{
TiXmlNodeA* returnNode = 0;
p = SkipWhiteSpace( p );
if( !p || !*p || *p != '<' )
{
return 0;
}
TiXmlDocumentA* doc = GetDocument();
p = SkipWhiteSpace( p );
if ( !p || !*p )
{
return 0;
}
// What is this thing?
// - Elements start with a letter or underscore, but xml is reserved.
// - Comments: <!--
// - Decleration: <?xml
// - Everthing else is unknown to tinyxml.
//
const char* xmlHeader = { "<?xml" };
const char* commentHeader = { "<!--" };
if ( StringEqual( p, xmlHeader, true ) )
{
#ifdef DEBUG_PARSER
TIXMLA_LOG( "XML parsing Declaration\n" );
#endif
returnNode = new TiXmlDeclarationA();
}
else if ( isalpha( *(p+1) )
|| *(p+1) == '_' )
{
#ifdef DEBUG_PARSER
TIXMLA_LOG( "XML parsing Element\n" );
#endif
returnNode = new TiXmlElementA( "" );
}
else if ( StringEqual( p, commentHeader, false ) )
{
#ifdef DEBUG_PARSER
TIXMLA_LOG( "XML parsing Comment\n" );
#endif
returnNode = new TiXmlCommentA();
}
else
{
#ifdef DEBUG_PARSER
TIXMLA_LOG( "XML parsing Unknown\n" );
#endif
returnNode = new TiXmlUnknownA();
}
if ( returnNode )
{
// Set the parent, so it can report errors
returnNode->parent = this;
}
else
{
if ( doc )
doc->SetError( TIXMLA_ERROR_OUT_OF_MEMORY, 0, 0 );
}
return returnNode;
}