本文整理汇总了C++中DOM_Node::removeChild方法的典型用法代码示例。如果您正苦于以下问题:C++ DOM_Node::removeChild方法的具体用法?C++ DOM_Node::removeChild怎么用?C++ DOM_Node::removeChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOM_Node
的用法示例。
在下文中一共展示了DOM_Node::removeChild方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeChild
DOM_Node RangeImpl::removeChild(DOM_Node& parent, DOM_Node& child)
{
fRemoveChild = child; //only a precaution measure not to update this range data before removal
DOM_Node n = parent.removeChild(child);
fRemoveChild = null;
return n;
}
示例2: setAttributeList
//======================================================================
// CJM 4/17/03 ..Needed to update an attribute list... for ContentGuard
//======================================================================
bool XMLDocument::setAttributeList(char* path, DataTypeAttribute** dtAttributes)
{
if (mDoc == NULL)
return false;
if (path == NULL)
return false;
DOM_Node child = getNode(mRootNode, path, NULL);
char* value = getString(path);
if (child == NULL)
return false;
short nType = child.getNodeType();
DOM_Node parent = child.getParentNode();
if (parent == NULL)
return false;
char* childName = child.getNodeName().transcode();
DOM_NamedNodeMap nnodeMap = child.getAttributes();
parent.removeChild(child);
DOM_Element childElement = mDoc.createElement(childName);
delete[] childName;
int a = 0;
DataTypeAttribute* dtAttribute;
while ((dtAttribute = (DataTypeAttribute*)dtAttributes[a++]) != (DataTypeAttribute*)NULL)
{
childElement.setAttribute(dtAttribute->getName(), dtAttribute->getValue());
}
if (nType == DOM_Node::TEXT_NODE)
{
DOM_Text childText = mDoc.createTextNode((value == NULL)?"":value);
childElement.appendChild(childText);
}
else
{
if (nType == DOM_Node::CDATA_SECTION_NODE)
{
DOM_CDATASection childCData = mDoc.createCDATASection((value == NULL)?"":value);
childElement.appendChild(childCData);
}
}
parent.appendChild(childElement);
return true;
}
示例3: setValue
//======================================================================
//======================================================================
bool XMLDocument::setValue(DOM_Node currNode, char* path, DataTypeAttribute** dtAttributes, char* value)
{
if (mDoc == NULL)
return false;
if (path == NULL)
return false;
DOM_Node child = getNode(currNode, path, dtAttributes);
if (child == NULL)
return false;
DOM_Node parent = child.getParentNode();
if (parent == NULL)
return false;
DOM_Node grandChild = child.getFirstChild();
short nType = DOM_Node::TEXT_NODE;
if (grandChild != NULL)
{
nType = grandChild.getNodeType();
if (nType != DOM_Node::TEXT_NODE && nType != DOM_Node::CDATA_SECTION_NODE)
return false;
}
char* childName = child.getNodeName().transcode();
DOM_NamedNodeMap nnodeMap = child.getAttributes();
parent.removeChild(child);
DOM_Element childElement = mDoc.createElement(childName);
delete[] childName;
for (unsigned int i = 0; i < nnodeMap.getLength(); i++)
{
DOM_Node attNode = nnodeMap.item(i);
childElement.setAttribute(attNode.getNodeName(), attNode.getNodeValue());
}
if (nType == DOM_Node::TEXT_NODE)
{
DOM_Text childText = mDoc.createTextNode((value == NULL)?"":value);
childElement.appendChild(childText);
}
else
{
DOM_CDATASection childCData = mDoc.createCDATASection((value == NULL)?"":value);
childElement.appendChild(childCData);
}
parent.appendChild(childElement);
return true;
}