Bug fixes and API changes from second unit test.
[shibboleth/cpp-xmltooling.git] / xmltooling / io / AbstractXMLObjectMarshaller.cpp
index 0b09c3e..2c0d537 100644 (file)
@@ -92,7 +92,7 @@ DOMElement* AbstractXMLObjectMarshaller::marshall(XMLObject* xmlObject, DOMDocum
             xmlObject->getElementQName().getNamespaceURI(), xmlObject->getElementQName().getLocalPart()\r
             );\r
         setDocumentElement(document, domElement);\r
-        marshallInto(xmlObject, domElement);\r
+        marshallInto(*xmlObject, domElement);\r
 \r
         //Recache the DOM.\r
         if (dc) {\r
@@ -151,7 +151,7 @@ DOMElement* AbstractXMLObjectMarshaller::marshall(XMLObject* xmlObject, DOMEleme
         xmlObject->getElementQName().getNamespaceURI(), xmlObject->getElementQName().getLocalPart()\r
         );\r
     parentElement->appendChild(domElement);\r
-    marshallInto(xmlObject, domElement);\r
+    marshallInto(*xmlObject, domElement);\r
 \r
     //Recache the DOM.\r
     if (dc) {\r
@@ -163,9 +163,9 @@ DOMElement* AbstractXMLObjectMarshaller::marshall(XMLObject* xmlObject, DOMEleme
     return domElement;\r
 }\r
         \r
-void AbstractXMLObjectMarshaller::marshallInto(XMLObject* xmlObject, DOMElement* targetElement) const\r
+void AbstractXMLObjectMarshaller::marshallInto(XMLObject& xmlObject, DOMElement* targetElement) const\r
 {\r
-    targetElement->setPrefix(xmlObject->getElementQName().getPrefix());\r
+    targetElement->setPrefix(xmlObject.getElementQName().getPrefix());\r
     marshallElementType(xmlObject, targetElement);\r
     marshallNamespaces(xmlObject, targetElement);\r
     marshallAttributes(xmlObject, targetElement);\r
@@ -183,9 +183,9 @@ void AbstractXMLObjectMarshaller::marshallInto(XMLObject* xmlObject, DOMElement*
     */\r
 }\r
 \r
-void AbstractXMLObjectMarshaller::marshallElementType(XMLObject* xmlObject, DOMElement* domElement) const\r
+void AbstractXMLObjectMarshaller::marshallElementType(XMLObject& xmlObject, DOMElement* domElement) const\r
 {\r
-    const QName* type = xmlObject->getSchemaType();\r
+    const QName* type = xmlObject.getSchemaType();\r
     if (type) {\r
         XT_log.debug("setting xsi:type attribute for XMLObject");\r
         \r
@@ -213,7 +213,7 @@ void AbstractXMLObjectMarshaller::marshallElementType(XMLObject* xmlObject, DOME
             XMLString::release(&xsivalue);\r
 \r
         XT_log.debug("Adding XSI namespace to list of namespaces used by XMLObject");\r
-        xmlObject->addNamespace(Namespace(XMLConstants::XSI_NS, XMLConstants::XSI_PREFIX));\r
+        xmlObject.addNamespace(Namespace(XMLConstants::XSI_NS, XMLConstants::XSI_PREFIX));\r
     }\r
 }\r
 \r
@@ -243,10 +243,10 @@ public:
     }\r
 };\r
 \r
-void AbstractXMLObjectMarshaller::marshallNamespaces(const XMLObject* xmlObject, DOMElement* domElement) const\r
+void AbstractXMLObjectMarshaller::marshallNamespaces(const XMLObject& xmlObject, DOMElement* domElement) const\r
 {\r
     XT_log.debug("marshalling namespace attributes for XMLObject");\r
-    const set<Namespace>& namespaces = xmlObject->getNamespaces();\r
+    const set<Namespace>& namespaces = xmlObject.getNamespaces();\r
     for_each(namespaces.begin(),namespaces.end(),bind1st(_addns(),domElement));\r
 }\r
 \r
@@ -271,12 +271,12 @@ public:
     }\r
 };\r
 \r
-void AbstractXMLObjectMarshaller::marshallChildElements(const XMLObject* xmlObject, DOMElement* domElement) const\r
+void AbstractXMLObjectMarshaller::marshallChildElements(const XMLObject& xmlObject, DOMElement* domElement) const\r
 {\r
     XT_log.debug("marshalling child elements for XMLObject");\r
 \r
     vector<XMLObject*> children;\r
-    if (xmlObject->getOrderedChildren(children)) {\r
+    if (xmlObject.getOrderedChildren(children)) {\r
         for_each(children.begin(),children.end(),bind2nd(_marshallchild(m_log),domElement));\r
     }\r
 }\r