本文整理汇总了C++中DOMAttr::setPrefix方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMAttr::setPrefix方法的具体用法?C++ DOMAttr::setPrefix怎么用?C++ DOMAttr::setPrefix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMAttr
的用法示例。
在下文中一共展示了DOMAttr::setPrefix方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: attributeEvent
virtual void attributeEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname, const XMLCh *value,
const XMLCh *typeURI, const XMLCh *typeName)
{
assert(node_ && node_->getNodeType() == DOMNode::ELEMENT_NODE);
DOMNamedNodeMap *attrs = node_->getAttributes();
DOMAttr *at = (DOMAttr*)attrs->getNamedItemNS(uri, localname);
// Add the attribute
if(!at) {
at = node_->getOwnerDocument()->createAttributeNS(uri, localname);
if(prefix && *prefix)
at->setPrefix(prefix);
attrs->setNamedItemNS(at);
}
// Copy the schema normalized value
at->setNodeValue(value);
// Copy the attribute's type
const XMLCh *oldTypeURI, *oldTypeName;
XercesNodeImpl::typeUriAndName(at, oldTypeURI, oldTypeName);
if(!XPath2Utils::equals(oldTypeName, typeName) ||
!XPath2Utils::equals(oldTypeURI, typeURI)) {
XercesSequenceBuilder::setAttributeTypeInfo(at, typeURI, typeName);
}
}
示例2: namespaceEvent
void XercesSequenceBuilder::namespaceEvent(const XMLCh *prefix, const XMLCh *uri)
{
if(currentParent_ != 0) {
DOMAttr *attr = document_->createAttributeNS(XMLUni::fgXMLNSURIName, prefix == 0 ? XMLUni::fgXMLNSString : prefix);
if(prefix != 0) attr->setPrefix(XMLUni::fgXMLNSString);
attr->setValue(uri);
currentParent_->getAttributes()->setNamedItemNS(attr);
currentNode_ = attr;
} else {
document_ = new (context_->getMemoryManager()) XPathDocumentImpl(XQillaImplementation::getDOMImplementationImpl(), context_->getMemoryManager());
DOMXPathNamespace *ns = new (document_, (DOMDocumentImpl::NodeObjectType)XPathNamespaceImpl::XPATH_NAMESPACE_OBJECT)
XPathNamespaceImpl(prefix, uri, 0, document_);
seq_.addItem(new XercesNodeImpl(ns, (XercesURIResolver*)context_->getDefaultURIResolver()));
document_ = 0;
currentNode_ = 0;
}
}
示例3: attributeEvent
void XercesSequenceBuilder::attributeEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname, const XMLCh *value,
const XMLCh *typeURI, const XMLCh *typeName)
{
if(document_ == 0) {
document_ = new (context_->getMemoryManager()) XPathDocumentImpl(XQillaImplementation::getDOMImplementationImpl(), context_->getMemoryManager());
}
DOMAttr *attr = document_->createAttributeNS(uri, localname);
if(prefix != 0)
attr->setPrefix(prefix);
attr->setValue(value);
setAttributeTypeInfo(attr, typeURI, typeName);
if(currentParent_ != 0)
currentParent_->getAttributes()->setNamedItemNS(attr);
currentNode_ = attr;
if(currentParent_ == 0) {
seq_.addItem(new XercesNodeImpl(currentNode_, (XercesURIResolver*)context_->getDefaultURIResolver()));
document_ = 0;
currentNode_ = 0;
}
}