} \r
}\r
}\r
+\r
+void AbstractAttributeExtensibleXMLObject::unmarshallExtensionAttribute(const DOMAttr* attribute)\r
+{\r
+ QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix());\r
+ bool ID = isRegisteredIDAttribute(q); \r
+ setAttribute(q,attribute->getNodeValue(),ID);\r
+ if (ID) {\r
+ attribute->getOwnerElement()->setIdAttributeNode(attribute);\r
+ }\r
+}\r
+\r
+void AbstractAttributeExtensibleXMLObject::marshallExtensionAttributes(DOMElement* domElement) const\r
+{\r
+ for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {\r
+ DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());\r
+ if (i->first.hasPrefix())\r
+ attr->setPrefix(i->first.getPrefix());\r
+ attr->setNodeValue(i->second);\r
+ domElement->setAttributeNode(attr);\r
+ if (m_idAttribute==i)\r
+ domElement->setIdAttributeNode(attr);\r
+ }\r
+}\r
/** Copy constructor. */\r
AbstractAttributeExtensibleXMLObject(const AbstractAttributeExtensibleXMLObject& src);\r
\r
+ /**\r
+ * Assists in the unmarshalling of extension attributes.\r
+ * \r
+ * @param attribute the DOM attribute node being unmarshalled\r
+ */\r
+ void unmarshallExtensionAttribute(const DOMAttr* attribute);\r
+\r
+ /**\r
+ * Assists in the marshalling of extension attributes.\r
+ * \r
+ * @param domElement the DOM element against which to marshall the attributes\r
+ */\r
+ void marshallExtensionAttributes(DOMElement* domElement) const;\r
+ \r
+ private:\r
/** Map of arbitrary attributes. */\r
std::map<QName,XMLCh*> m_attributeMap;\r
\r
static const std::set<QName>& getRegisteredIDAttributes() {\r
return m_idAttributeSet;\r
}\r
+ \r
+ /**\r
+ * Tests whether an XML attribute is registered as an XML ID.\r
+ * \r
+ * @return true iff the attribute name matches a registered XML ID attribute \r
+ */\r
+ static bool isRegisteredIDAttribute(const QName& name) {\r
+ return m_idAttributeSet.find(name)!=m_idAttributeSet.end();\r
+ }\r
\r
/**\r
* Registers a new attribute as being of XML ID type.\r
}
IMPL_XMLOBJECT_CLONE(EncryptionProperty);
- IMPL_STRING_ATTRIB(Id);
+ IMPL_ID_ATTRIB(Id);
IMPL_STRING_ATTRIB(Target);
void setAttribute(QName& qualifiedName, const XMLCh* value) {
void marshallAttributes(DOMElement* domElement) const {
MARSHALL_ID_ATTRIB(Id,ID,NULL);
MARSHALL_STRING_ATTRIB(Target,TARGET,NULL);
-
- // Take care of wildcard.
- for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
- DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
- if (i->first.hasPrefix())
- attr->setPrefix(i->first.getPrefix());
- attr->setNodeValue(i->second);
- domElement->setAttributeNode(attr);
- }
+ marshallExtensionAttributes(domElement);
}
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
void processAttribute(const DOMAttr* attribute) {
PROC_ID_ATTRIB(Id,ID,NULL);
- QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix());
- setAttribute(q,attribute->getNodeValue());
+ unmarshallExtensionAttribute(attribute);
}
};
}
IMPL_XMLOBJECT_CLONE(EncryptionProperties);
- IMPL_STRING_ATTRIB(Id);
+ IMPL_ID_ATTRIB(Id);
IMPL_TYPED_CHILDREN(EncryptionProperty,m_children.end());
protected:
}
IMPL_XMLOBJECT_CLONE(EncryptedType);
- IMPL_STRING_ATTRIB(Id);
+ IMPL_ID_ATTRIB(Id);
IMPL_STRING_ATTRIB(Type);
IMPL_STRING_ATTRIB(MimeType);
IMPL_STRING_ATTRIB(Encoding);
}
void AnyElementImpl::marshallAttributes(DOMElement* domElement) const {
- for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
- DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
- if (i->first.hasPrefix())
- attr->setPrefix(i->first.getPrefix());
- attr->setNodeValue(i->second);
- domElement->setAttributeNode(attr);
- }
+ marshallExtensionAttributes(domElement);
}
void AnyElementImpl::marshallElementContent(DOMElement* domElement) const {
}
void AnyElementImpl::processAttribute(const DOMAttr* attribute) {
- QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix());
- setAttribute(q,attribute->getNodeValue());
+ unmarshallExtensionAttribute(attribute);
}
void AnyElementImpl::processElementContent(const XMLCh* elementContent) {
protected:
void marshallAttributes(DOMElement* domElement) const {
- // Take care of wildcard.
- for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
- DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
- if (i->first.hasPrefix())
- attr->setPrefix(i->first.getPrefix());
- attr->setNodeValue(i->second);
- domElement->setAttributeNode(attr);
- }
+ marshallExtensionAttributes(domElement);
}
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
}
void processAttribute(const DOMAttr* attribute) {
- QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix());
- setAttribute(q,attribute->getNodeValue());
+ unmarshallExtensionAttribute(attribute);
}
};
protected:
void marshallAttributes(DOMElement* domElement) const {
MARSHALL_STRING_ATTRIB(EncodingStyle,ENCODINGSTYLE,XMLConstants::SOAP11ENV_NS);
-
- // Take care of wildcard.
- for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
- DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
- if (i->first.hasPrefix())
- attr->setPrefix(i->first.getPrefix());
- attr->setNodeValue(i->second);
- domElement->setAttributeNode(attr);
- }
+ marshallExtensionAttributes(domElement);
}
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
}
void processAttribute(const DOMAttr* attribute) {
- QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix());
- setAttribute(q,attribute->getNodeValue());
+ unmarshallExtensionAttribute(attribute);
}
};
void marshallAttributes(DOMElement* domElement) const {
MARSHALL_STRING_ATTRIB(Actor,ACTOR,XMLConstants::SOAP11ENV_NS);
MARSHALL_BOOLEAN_ATTRIB(MustUnderstand,MUSTUNDERSTAND,XMLConstants::SOAP11ENV_NS);
-
- // Take care of wildcard.
- for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
- DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
- if (i->first.hasPrefix())
- attr->setPrefix(i->first.getPrefix());
- attr->setNodeValue(i->second);
- domElement->setAttributeNode(attr);
- }
+ marshallExtensionAttributes(domElement);
}
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
}
void processAttribute(const DOMAttr* attribute) {
- QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix());
- setAttribute(q,attribute->getNodeValue());
+ unmarshallExtensionAttribute(attribute);
}
};
protected:
void marshallAttributes(DOMElement* domElement) const {
- // Take care of wildcard.
- for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
- DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
- if (i->first.hasPrefix())
- attr->setPrefix(i->first.getPrefix());
- attr->setNodeValue(i->second);
- domElement->setAttributeNode(attr);
- }
+ marshallExtensionAttributes(domElement);
}
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
}
void processAttribute(const DOMAttr* attribute) {
- QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix());
- setAttribute(q,attribute->getNodeValue());
+ unmarshallExtensionAttribute(attribute);
}
};
};