本文整理汇总了C++中TiXmlDocumentA类的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlDocumentA类的具体用法?C++ TiXmlDocumentA怎么用?C++ TiXmlDocumentA使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TiXmlDocumentA类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDocument
const char* TiXmlCommentA::Parse( const char* p, TiXmlParsingDataA* data )
{
TiXmlDocumentA* document = GetDocument();
value = "";
p = SkipWhiteSpace( p );
// TiXmlParsingDataA data( p, prevData );
if ( data )
{
data->Stamp( p );
location = data->Cursor();
}
const char* startTag = "<!--";
const char* endTag = "-->";
if ( !StringEqual( p, startTag, false ) )
{
document->SetError( TIXMLA_ERROR_PARSING_COMMENT, p, data );
return 0;
}
p += strlen( startTag );
p = ReadText( p, &value, false, endTag, false );
return p;
}
示例2: GetDocument
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: SkipWhiteSpace
const char* TiXmlDeclarationA::Parse( const char* p, TiXmlParsingDataA* data )
{
p = SkipWhiteSpace( p );
// Find the beginning, find the end, and look for
// the stuff in-between.
TiXmlDocumentA* document = GetDocument();
if ( !p || !*p || !StringEqual( p, "<?xml", true ) )
{
if ( document ) document->SetError( TIXMLA_ERROR_PARSING_DECLARATION, 0, 0 );
return 0;
}
// TiXmlParsingDataA data( p, prevData );
if ( data )
{
data->Stamp( p );
location = data->Cursor();
}
p += 5;
version = "";
encoding = "";
standalone = "";
while ( p && *p )
{
if ( *p == '>' )
{
++p;
return p;
}
p = SkipWhiteSpace( p );
if ( StringEqual( p, "version", true ) )
{
TiXmlAttributeA attrib;
p = attrib.Parse( p, data );
version = attrib.Value();
}
else if ( StringEqual( p, "encoding", true ) )
{
TiXmlAttributeA attrib;
p = attrib.Parse( p, data );
encoding = attrib.Value();
}
else if ( StringEqual( p, "standalone", true ) )
{
TiXmlAttributeA attrib;
p = attrib.Parse( p, data );
standalone = attrib.Value();
}
else
{
// Read over whatever it is.
while( p && *p && *p != '>' && !isspace( *p ) )
++p;
}
}
return 0;
}
示例4: TiXmlDocumentA
TiXmlNodeA* TiXmlDocumentA::Clone() const
{
TiXmlDocumentA* clone = new TiXmlDocumentA();
if ( !clone )
return 0;
CopyToClone( clone );
clone->error = error;
clone->errorDesc = errorDesc.c_str ();
for ( TiXmlNodeA* node = firstChild; node; node = node->NextSibling() )
{
clone->LinkEndChild( node->Clone() );
}
return clone;
}
示例5: TiXmlAttributeA
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 );
}
}