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


C++ XmlDocument::SetError方法代码示例

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


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

示例1: ReplaceChild

XmlNode* XmlNode::ReplaceChild( XmlNode* replaceThis, const XmlNode& withThis )
{
	if ( !replaceThis )
		return 0;

	if ( replaceThis->parent != this )
		return 0;

	if ( withThis.ToDocument() ) {
		// A document can never be a child.	Thanks to Noam.
		XmlDocument* document = GetDocument();
		if ( document ) 
			document->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
		return 0;
	}

	XmlNode* node = withThis.Clone();
	if ( !node )
		return 0;

	node->next = replaceThis->next;
	node->prev = replaceThis->prev;

	if ( replaceThis->next )
		replaceThis->next->prev = node;
	else
		lastChild = node;

	if ( replaceThis->prev )
		replaceThis->prev->next = node;
	else
		firstChild = node;

	delete replaceThis;
	node->parent = this;
	return node;
}
开发者ID:oksangman,项目名称:Ant,代码行数:37,代码来源:tinyxml.cpp

示例2: SkipWhiteSpace

/**
*  @brief
*    Reads the "value" of the element -- another element, or text
*/
const char *XmlElement::ReadValue(const char *pszData, XmlParsingData *pData, EEncoding nEncoding)
{
	// Read in text and elements in any order
	const char *pWithWhiteSpace = pszData;
	pszData = SkipWhiteSpace(pszData, nEncoding);

	while (pszData && *pszData) {
		if (*pszData != '<') {
			// Take what we have, make a text element
			XmlText *pTextNode = new XmlText("");

			if (IsWhiteSpaceCondensed())
				pszData = pTextNode->Parse(pszData, pData, nEncoding);
			else {
				// Special case: we want to keep the white space so that leading spaces aren't removed
				pszData = pTextNode->Parse(pWithWhiteSpace, pData, nEncoding);
			}

			// Does the text value only contain white spaces?
			bool bIsBlank = true;
			{
				const String sValue = pTextNode->GetValue();
				for (uint32 i=0; i<sValue.GetLength(); i++) {
					if (!IsWhiteSpace(sValue[i])) {
						bIsBlank = false;
						break;
					}
				}
			}
			if (bIsBlank)
				delete pTextNode;
			else
				LinkEndChild(*pTextNode);
		} else {
			// We hit a '<'
			// Have we hit a new element or an end tag? This could also be a XmlText in the "CDATA" style
			if (StringEqual(pszData, "</", false, nEncoding))
				return pszData;
			else {
				XmlNode *pNode = Identify(pszData, nEncoding);
				if (pNode) {
					pszData = pNode->Parse(pszData, pData, nEncoding);
					LinkEndChild(*pNode);
				} else {
					return nullptr;
				}
			}
		}
		pWithWhiteSpace = pszData;
		pszData = SkipWhiteSpace(pszData, nEncoding);
	}

	if (!pszData) {
		// Set error code
		XmlDocument *pDocument = GetDocument();
		if (pDocument)
			pDocument->SetError(ErrorReadingElementValue, 0, 0, nEncoding);
	}

	// Done
	return pszData;
}
开发者ID:ByeDream,项目名称:pixellight,代码行数:66,代码来源:XmlElement.cpp


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