当前位置: 首页>>代码示例>>C++>>正文


C++ XMLToken::GetAttributeRange方法代码示例

本文整理汇总了C++中XMLToken::GetAttributeRange方法的典型用法代码示例。如果您正苦于以下问题:C++ XMLToken::GetAttributeRange方法的具体用法?C++ XMLToken::GetAttributeRange怎么用?C++ XMLToken::GetAttributeRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XMLToken的用法示例。


在下文中一共展示了XMLToken::GetAttributeRange方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if


//.........这里部分代码省略.........
				status = parser->StartEntity(xmlparser->GetCurrentEntityUrl(), xmlparser->GetDocumentInformation(), xmlparser->GetCurrentEntityDepth() > 1);
				entity_signalled = TRUE;
			}

			current_entity_url = xmlparser->GetCurrentEntityUrl();
			current_entity_depth = xmlparser->GetCurrentEntityDepth();

			if (token.GetType() != XMLToken::TYPE_ETag)
			{
				if (OpStatus::IsSuccess(status))
				{
					BOOL fragment_start = FALSE;

					if (!fragment_found)
					{
						if (!fragment_id)
							fragment_start = TRUE;
						else
						{
							XMLToken::Attribute *attributes = token.GetAttributes();
							unsigned attributes_count = token.GetAttributesCount();
							unsigned fragment_id_length = uni_strlen(fragment_id);

							for (unsigned index = 0; index < attributes_count; ++index)
								if (attributes[index].GetId())
									if (attributes[index].GetValueLength() == fragment_id_length && uni_strncmp(attributes[index].GetValue(), fragment_id, fragment_id_length) == 0)
									{
										fragment_start = TRUE;
										break;
									}
						}

						if (fragment_start)
							fragment_found = TRUE;
					}

#ifdef XML_ERRORS
					token.GetTokenRange(location);
					parser->SetLocation(location);
#endif // XML_ERRORS

					BOOL ignore_element = FALSE;
					status = parser->StartElement(token.GetName(), fragment_start, ignore_element);

					if (ignore_element)
					{
						if (token.GetType() == XMLToken::TYPE_STag)
							ignore_element_depth = 1;
					}
					else
					{
						XMLToken::Attribute *attributes = token.GetAttributes();
						unsigned attributes_count = token.GetAttributesCount();

						for (unsigned index = 0; OpStatus::IsSuccess(status) && index < attributes_count; ++index)
						{
#ifdef XML_ERRORS
							token.GetAttributeRange(location, index);
							parser->SetLocation(location);
#endif // XML_ERRORS

							XMLToken::Attribute &attribute = attributes[index];
							status = parser->AddAttribute(attribute.GetName(), attribute.GetValue(), attribute.GetValueLength(), attribute.GetSpecified(), attribute.GetId());
						}

						if (OpStatus::IsSuccess(status))
							status = parser->StartContent();
					}
				}
			}

			if (OpStatus::IsSuccess(status) && token.GetType() != XMLToken::TYPE_STag)
			{
#ifdef XML_ERRORS
				token.GetTokenRange(location);
				parser->SetLocation(location);
#endif // XML_ERRORS

				status = parser->EndElement(block, finished);

				if (OpStatus::IsSuccess(status) && block)
					parser->SetSourceCallback(&sourcecallbackimpl);
			}
			break;

		case XMLToken::TYPE_Finished:
			status = parser->EndEntity();
		}
	}

	if (OpStatus::IsSuccess(status))
		if (block)
			return RESULT_BLOCK;
		else
			return RESULT_OK;
	else if (OpStatus::IsMemoryError(status))
		return RESULT_OOM;
	else
		return RESULT_ERROR;
}
开发者ID:prestocore,项目名称:browser,代码行数:101,代码来源:xmltokenhandlerimpl.cpp


注:本文中的XMLToken::GetAttributeRange方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。