本文整理汇总了C++中DOMElement::removeAttributeNode方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMElement::removeAttributeNode方法的具体用法?C++ DOMElement::removeAttributeNode怎么用?C++ DOMElement::removeAttributeNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMElement
的用法示例。
在下文中一共展示了DOMElement::removeAttributeNode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: completeDeletions
void XercesUpdateFactory::completeDeletions(DynamicContext *context)
{
// e. Finally, for each node marked for deletion by one of the update primitives listed above, let $N be the node that is marked
// for deletion, and let $P be its parent node. The following actions are applied:
// i. The parent property of $N is set to empty.
// ii. If $N is an attribute node, the attributes property of $P is modified to remove $N.
// iii. If $N is a non-attribute node, the children property of $P is modified to remove $N.
// iv. If $N is an element, attribute, or text node, and $P is an element node, then upd:removeType($P) is invoked.
for(DOMNodeSet::iterator i = forDeletion_.begin(); i != forDeletion_.end(); ++i) {
DOMNode *domnode = *i;
if(domnode->getNodeType() == DOMNode::ATTRIBUTE_NODE) {
DOMAttr *attr = (DOMAttr*)domnode;
DOMElement *owner = attr->getOwnerElement();
if(owner != 0) {
owner->removeAttributeNode(attr);
removeType(owner);
}
}
else {
DOMNode *parent = domnode->getParentNode();
if(parent != 0) {
parent->removeChild(domnode);
if(domnode->getNodeType() == DOMNode::ELEMENT_NODE ||
domnode->getNodeType() == DOMNode::TEXT_NODE ||
domnode->getNodeType() == DOMNode::CDATA_SECTION_NODE) {
removeType(parent);
}
}
}
}
}
示例2: rename
DOMNode* DOMAttrNSImpl::rename(const XMLCh* namespaceURI, const XMLCh* name)
{
DOMElement* el = getOwnerElement();
if (el)
el->removeAttributeNode(this);
setName(namespaceURI, name);
if (el)
el->setAttributeNodeNS(this);
return this;
}
示例3: rename
DOMNode* DOMAttrImpl::rename(const XMLCh* namespaceURI, const XMLCh* name)
{
DOMElement* el = getOwnerElement();
DOMDocumentImpl* doc = (DOMDocumentImpl*)fParent.fOwnerDocument;
if (el)
el->removeAttributeNode(this);
if (!namespaceURI || !*namespaceURI) {
fName = doc->getPooledString(name);
if (el)
el->setAttributeNode(this);
// and fire user data NODE_RENAMED event
castToNodeImpl(this)->callUserDataHandlers(DOMUserDataHandler::NODE_RENAMED, this, this);
return this;
}
else {
// create a new AttrNS
DOMAttr* newAttr = doc->createAttributeNS(namespaceURI, name);
// transfer the userData
doc->transferUserData(castToNodeImpl(this), castToNodeImpl(newAttr));
// move children to new node
DOMNode* child = getFirstChild();
while (child) {
removeChild(child);
newAttr->appendChild(child);
child = getFirstChild();
}
// reattach attr to element
if (el)
el->setAttributeNodeNS(newAttr);
// and fire user data NODE_RENAMED event
castToNodeImpl(newAttr)->callUserDataHandlers(DOMUserDataHandler::NODE_RENAMED, this, newAttr);
return newAttr;
}
}