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); } }
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; } }
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; } }