本文整理汇总了C++中DOMNode::setPrefix方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMNode::setPrefix方法的具体用法?C++ DOMNode::setPrefix怎么用?C++ DOMNode::setPrefix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMNode
的用法示例。
在下文中一共展示了DOMNode::setPrefix方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: applyRename
void XercesUpdateFactory::applyRename(const PendingUpdate &update, DynamicContext *context)
{
const XercesNodeImpl *nodeImpl = (const XercesNodeImpl*)update.getTarget()->getInterface(Item::gXQilla);
DOMNode *domnode = const_cast<DOMNode*>(nodeImpl->getDOMNode());
ATQNameOrDerived *qname = (ATQNameOrDerived*)update.getValue().first().get();
if(domnode->getNodeType() == DOMNode::PROCESSING_INSTRUCTION_NODE) {
DOMProcessingInstruction *newPI = domnode->getOwnerDocument()->
createProcessingInstruction(qname->getName(), domnode->getNodeValue());
domnode->getParentNode()->replaceChild(newPI, domnode);
domnode = newPI;
}
else {
// If $newName has an implied namespace binding that conflicts with an existing namespace binding
// in the namespaces property of $target, a dynamic error is raised [err:XUDY0024].
// If $target has a parent, and $newName has an implied namespace binding that conflicts with a
// namespace binding in the namespaces property of parent($target), a dynamic error is raised [err:XUDY0024].
domnode->getOwnerDocument()->renameNode(domnode, qname->getURI(), qname->getName());
if(qname->getURI() != 0 && *qname->getURI() != 0)
domnode->setPrefix(qname->getPrefix());
removeType(domnode);
}
// Deliberately create a new XercesNodeImpl, since the PI is actually
// replaced, not just renamed, meaning it is no longer attached to the tree
addToPutSet(nodeImpl, &update, context);
}
示例2:
static DOMNode *importNodeFix(DOMDocument *doc, DOMNode *node, bool deep)
{
DOMNode *newNode = doc->importNode(node, deep);
// Xerces-C has a bug that doesn't copy the prefix correctly - jpcs
if((node->getNodeType() == DOMNode::ELEMENT_NODE ||
node->getNodeType() == DOMNode::ATTRIBUTE_NODE) &&
node->getNamespaceURI() != 0 && *node->getNamespaceURI() != 0 &&
node->getPrefix() != 0 && *node->getPrefix() != 0)
newNode->setPrefix(node->getPrefix());
return newNode;
}