本文整理汇总了C++中TiXmlNodeA::Parse方法的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlNodeA::Parse方法的具体用法?C++ TiXmlNodeA::Parse怎么用?C++ TiXmlNodeA::Parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiXmlNodeA
的用法示例。
在下文中一共展示了TiXmlNodeA::Parse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: Parse
const char* TiXmlDocumentA::Parse( const char* p, TiXmlParsingDataA* prevData )
{
ClearError();
// Parse away, at the document level. Since a document
// contains nothing but other tags, most of what happens
// here is skipping white space.
if ( !p || !*p )
{
SetError( TIXMLA_ERROR_DOCUMENT_EMPTY, 0, 0 );
return 0;
}
// Note that, for a document, this needs to come
// before the while space skip, so that parsing
// starts from the pointer we are given.
location.Clear();
if ( prevData )
{
location.row = prevData->cursor.row;
location.col = prevData->cursor.col;
}
else
{
location.row = 0;
location.col = 0;
}
TiXmlParsingDataA data( p, TabSize(), location.row, location.col );
location = data.Cursor();
p = SkipWhiteSpace( p );
if ( !p )
{
SetError( TIXMLA_ERROR_DOCUMENT_EMPTY, 0, 0 );
return 0;
}
while ( p && *p )
{
TiXmlNodeA* node = Identify( p );
if ( node )
{
p = node->Parse( p, &data );
LinkEndChild( node );
}
else
{
break;
}
p = SkipWhiteSpace( p );
}
// All is well.
return p;
}