当前位置: 首页>>代码示例>>C++>>正文


C++ DOMNode::setPrefix方法代码示例

本文整理汇总了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);
}
开发者ID:xubingyue,项目名称:xqilla,代码行数:31,代码来源:XercesUpdateFactory.cpp

示例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;
}
开发者ID:xubingyue,项目名称:xqilla,代码行数:11,代码来源:XercesUpdateFactory.cpp


注:本文中的DOMNode::setPrefix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。