本文整理汇总了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;
}
示例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;
}