本文整理汇总了C++中DOMNode::cloneNode方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMNode::cloneNode方法的具体用法?C++ DOMNode::cloneNode怎么用?C++ DOMNode::cloneNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMNode
的用法示例。
在下文中一共展示了DOMNode::cloneNode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cloneContent
void DOMAttrMapImpl::cloneContent(const DOMAttrMapImpl *srcmap)
{
if ((srcmap != 0) && (srcmap->fNodes != 0))
{
if (fNodes != 0)
fNodes->reset();
else
{
XMLSize_t size = srcmap->fNodes->size();
if(size > 0) {
DOMDocument *doc = fOwnerNode->getOwnerDocument();
fNodes = new (doc) DOMNodeVector(doc, size);
}
}
for (XMLSize_t i = 0; i < srcmap->fNodes->size(); i++)
{
DOMNode *n = srcmap->fNodes->elementAt(i);
DOMNode *clone = n->cloneNode(true);
castToNodeImpl(clone)->isSpecified(castToNodeImpl(n)->isSpecified());
castToNodeImpl(clone)->fOwnerNode = fOwnerNode;
castToNodeImpl(clone)->isOwned(true);
fNodes->addElement(clone);
}
}
}
示例2: cloneChildren
void DOMParentNode::cloneChildren(const DOMNode *other) {
// for (DOMNode *mykid = other.getFirstChild();
for (DOMNode *mykid = other->getFirstChild();
mykid != 0;
mykid = mykid->getNextSibling())
{
appendChild(mykid->cloneNode(true));
}
}
示例3: new
DOMNamedNodeMapImpl *DOMNamedNodeMapImpl::cloneMap(DOMNode *ownerNod)
{
DOMDocumentImpl *doc = (DOMDocumentImpl *)(castToNodeImpl(ownerNod)->getOwnerDocument());
DOMNamedNodeMapImpl *newmap = new (doc) DOMNamedNodeMapImpl(ownerNod);
for(int index=0;index<MAP_SIZE;index++)
if (fBuckets[index] != 0) {
XMLSize_t size=fBuckets[index]->size();
newmap->fBuckets[index] = new (doc) DOMNodeVector(doc, size);
for (XMLSize_t i = 0; i < size; ++i) {
DOMNode *s = fBuckets[index]->elementAt(i);
DOMNode *n = s->cloneNode(true);
castToNodeImpl(n)->isSpecified(castToNodeImpl(s)->isSpecified());
castToNodeImpl(n)->fOwnerNode = ownerNod;
castToNodeImpl(n)->isOwned(true);
newmap->fBuckets[index]->addElement(n);
}
}
return newmap;
}