Cleaned up conditional in setDOM method.
[shibboleth/cpp-xmltooling.git] / xmltooling / AbstractDOMCachingXMLObject.cpp
index 38c25cc..684b466 100644 (file)
@@ -56,18 +56,14 @@ DOMElement* AbstractDOMCachingXMLObject::getDOM() const
 void AbstractDOMCachingXMLObject::setDOM(DOMElement* dom, bool bindDocument) const
 {
     m_dom = dom;
-    if (dom) {
-        if (bindDocument) {
-            DOMDocument* doc = dom->getOwnerDocument();
-            setDocument(doc);
-            if (dom) {
-                DOMElement* documentRoot = doc->getDocumentElement();
-                if (!documentRoot)
-                    doc->appendChild(dom);
-                else if (documentRoot != dom)
-                    doc->replaceChild(dom, documentRoot);
-            }
-        }
+    if (dom && bindDocument) {
+        DOMDocument* doc = dom->getOwnerDocument();
+        setDocument(doc);
+        DOMElement* documentRoot = doc->getDocumentElement();
+        if (!documentRoot)
+            doc->appendChild(dom);
+        else if (documentRoot != dom)
+            doc->replaceChild(dom, documentRoot);
     }
 }