本文整理汇总了C++中TiXmlAttributeA::Name方法的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlAttributeA::Name方法的具体用法?C++ TiXmlAttributeA::Name怎么用?C++ TiXmlAttributeA::Name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiXmlAttributeA
的用法示例。
在下文中一共展示了TiXmlAttributeA::Name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Clone
TiXmlNodeA* TiXmlElementA::Clone() const
{
TiXmlElementA* clone = new TiXmlElementA( Value() );
if ( !clone )
return 0;
CopyToClone( clone );
// Clone the attributes, then clone the children.
for(TiXmlAttributeA* attribute = attributeSet.First();
attribute;
attribute = attribute->Next() )
{
clone->SetAttribute( attribute->Name(), attribute->Value() );
}
for ( TiXmlNodeA* node = firstChild; node; node = node->NextSibling() )
{
clone->LinkEndChild( node->Clone() );
}
return clone;
}
示例2: Parse
const char* TiXmlElementA::Parse( const char* p, TiXmlParsingDataA* data )
{
p = SkipWhiteSpace( p );
TiXmlDocumentA* document = GetDocument();
if ( !p || !*p )
{
if ( document ) document->SetError( TIXMLA_ERROR_PARSING_ELEMENT, 0, 0 );
return 0;
}
// TiXmlParsingDataA data( p, prevData );
if ( data )
{
data->Stamp( p );
location = data->Cursor();
}
if ( *p != '<' )
{
if ( document ) document->SetError( TIXMLA_ERROR_PARSING_ELEMENT, p, data );
return 0;
}
p = SkipWhiteSpace( p+1 );
// Read the name.
const char* pErr = p;
p = ReadName( p, &value );
if ( !p || !*p )
{
if ( document ) document->SetError( TIXMLA_ERROR_FAILED_TO_READ_ELEMENT_NAME, pErr, data );
return 0;
}
TIXMLA_STRING endTag ("</");
endTag += value;
endTag += ">";
// Check for and read attributes. Also look for an empty
// tag or an end tag.
while ( p && *p )
{
pErr = p;
p = SkipWhiteSpace( p );
if ( !p || !*p )
{
if ( document ) document->SetError( TIXMLA_ERROR_READING_ATTRIBUTES, pErr, data );
return 0;
}
if ( *p == '/' )
{
++p;
// Empty tag.
if ( *p != '>' )
{
if ( document ) document->SetError( TIXMLA_ERROR_PARSING_EMPTY, p, data );
return 0;
}
return (p+1);
}
else if ( *p == '>' )
{
// Done with attributes (if there were any.)
// Read the value -- which can include other
// elements -- read the end tag, and return.
++p;
p = ReadValue( p, data ); // Note this is an Element method, and will set the error if one happens.
if ( !p || !*p )
return 0;
// We should find the end tag now
if ( StringEqual( p, endTag.c_str(), false ) )
{
p += endTag.length();
return p;
}
else
{
if ( document ) document->SetError( TIXMLA_ERROR_READING_END_TAG, p, data );
return 0;
}
}
else
{
// Try to read an attribute:
TiXmlAttributeA* attrib = new TiXmlAttributeA();
if ( !attrib )
{
if ( document ) document->SetError( TIXMLA_ERROR_OUT_OF_MEMORY, pErr, data );
return 0;
}
attrib->SetDocument( document );
const char* pErr = p;
p = attrib->Parse( p, data );
if ( !p || !*p )
{
//.........这里部分代码省略.........