Multi-line svn commit, see body.
[shibboleth/cpp-xmltooling.git] / xmltooling / soap / impl / SOAPImpl.cpp
index 1f4ec07..eefa5a6 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "internal.h"
 #include "AbstractAttributeExtensibleXMLObject.h"
-#include "AbstractChildlessElement.h"
+#include "AbstractSimpleElement.h"
 #include "AbstractElementProxy.h"
 #include "exceptions.h"
 #include "io/AbstractXMLObjectMarshaller.h"
@@ -47,8 +47,7 @@ namespace {
     DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,Faultactor);
 
     class XMLTOOL_DLLLOCAL FaultcodeImpl : public virtual Faultcode,
-        protected AbstractSimpleElement,
-        public AbstractChildlessElement,
+        public AbstractSimpleElement,
         public AbstractDOMCachingXMLObject,
         public AbstractXMLObjectMarshaller,
         public AbstractXMLObjectUnmarshaller
@@ -83,7 +82,6 @@ namespace {
         }
         
         IMPL_XMLOBJECT_CLONE(Faultcode);
-        IMPL_XMLOBJECT_CONTENT;
     };
 
     class XMLTOOL_DLLLOCAL DetailImpl : public virtual Detail,
@@ -116,14 +114,7 @@ namespace {
 
     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) {
@@ -131,8 +122,7 @@ namespace {
         }
 
         void processAttribute(const DOMAttr* attribute) {
-            QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix()); 
-            setAttribute(q,attribute->getNodeValue());
+            unmarshallExtensionAttribute(attribute);
         }
     };
 
@@ -172,7 +162,8 @@ namespace {
             init();
         }
             
-        FaultImpl(const FaultImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) {
+        FaultImpl(const FaultImpl& src)
+                : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
             init();
             if (src.getFaultcode())
                 setFaultcode(src.getFaultcode()->cloneFaultcode());
@@ -250,15 +241,7 @@ namespace {
     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) {
@@ -266,8 +249,7 @@ namespace {
         }
 
         void processAttribute(const DOMAttr* attribute) {
-            QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix()); 
-            setAttribute(q,attribute->getNodeValue());
+            unmarshallExtensionAttribute(attribute);
         }
     };
 
@@ -329,15 +311,7 @@ namespace {
         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) {
@@ -345,8 +319,7 @@ namespace {
         }
 
         void processAttribute(const DOMAttr* attribute) {
-            QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix()); 
-            setAttribute(q,attribute->getNodeValue());
+            unmarshallExtensionAttribute(attribute);
         }
     };
 
@@ -375,7 +348,8 @@ namespace {
         }
             
         EnvelopeImpl(const EnvelopeImpl& src)
-                : AbstractXMLObject(src), AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
+                : AbstractXMLObject(src), AbstractComplexElement(src),
+                    AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
             init();
             if (src.getHeader())
                 setHeader(src.getHeader()->cloneHeader());
@@ -389,14 +363,7 @@ namespace {
 
     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) {
@@ -406,8 +373,7 @@ namespace {
         }
 
         void processAttribute(const DOMAttr* attribute) {
-            QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix()); 
-            setAttribute(q,attribute->getNodeValue());
+            unmarshallExtensionAttribute(attribute);
         }
     };
 };