本文整理汇总了C++中XMLAttribute::ParseDeep方法的典型用法代码示例。如果您正苦于以下问题:C++ XMLAttribute::ParseDeep方法的具体用法?C++ XMLAttribute::ParseDeep怎么用?C++ XMLAttribute::ParseDeep使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLAttribute
的用法示例。
在下文中一共展示了XMLAttribute::ParseDeep方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseAttributes
char* XMLElement::ParseAttributes( char* p )
{
const char* start = p;
XMLAttribute* prevAttribute = 0;
// Read the attributes.
while( p ) {
p = XMLUtil::SkipWhiteSpace( p );
if ( !p || !(*p) ) {
_document->SetError( XML_ERROR_PARSING_ELEMENT, start, Name() );
return 0;
}
// attribute.
if (XMLUtil::IsNameStartChar( *p ) ) {
XMLAttribute* attrib = new (_document->_attributePool.Alloc() ) XMLAttribute();
attrib->_memPool = &_document->_attributePool;
attrib->_memPool->SetTracked();
p = attrib->ParseDeep( p, _document->ProcessEntities() );
if ( !p || Attribute( attrib->Name() ) ) {
DELETE_ATTRIBUTE( attrib );
_document->SetError( XML_ERROR_PARSING_ATTRIBUTE, start, p );
return 0;
}
// There is a minor bug here: if the attribute in the source xml
// document is duplicated, it will not be detected and the
// attribute will be doubly added. However, tracking the 'prevAttribute'
// avoids re-scanning the attribute list. Preferring performance for
// now, may reconsider in the future.
if ( prevAttribute ) {
prevAttribute->_next = attrib;
}
else {
_rootAttribute = attrib;
}
prevAttribute = attrib;
}
// end of the tag
else if ( *p == '/' && *(p+1) == '>' ) {
_closingType = CLOSED;
return p+2; // done; sealed element.
}
// end of the tag
else if ( *p == '>' ) {
++p;
break;
}
else {
_document->SetError( XML_ERROR_PARSING_ELEMENT, start, p );
return 0;
}
}
return p;
}
示例2: ParseAttributes
char* XMLElement::ParseAttributes( char* p )
{
const char* start = p;
// Read the attributes.
while( p ) {
p = XMLUtil::SkipWhiteSpace( p );
if ( !p || !(*p) ) {
document->SetError( XML_ERROR_PARSING_ELEMENT, start, Name() );
return 0;
}
// attribute.
if ( XMLUtil::IsAlpha( *p ) ) {
XMLAttribute* attrib = new (document->attributePool.Alloc() ) XMLAttribute();
attrib->memPool = &document->attributePool;
p = attrib->ParseDeep( p, document->ProcessEntities() );
if ( !p || Attribute( attrib->Name() ) ) {
DELETE_ATTRIBUTE( attrib );
document->SetError( XML_ERROR_PARSING_ATTRIBUTE, start, p );
return 0;
}
LinkAttribute( attrib );
}
// end of the tag
else if ( *p == '/' && *(p+1) == '>' ) {
closingType = CLOSED;
return p+2; // done; sealed element.
}
// end of the tag
else if ( *p == '>' ) {
++p;
break;
}
else {
document->SetError( XML_ERROR_PARSING_ELEMENT, start, p );
return 0;
}
}
return p;
}