Namespace handling fixes
[shibboleth/xmltooling.git] / xmltooling / io / AbstractXMLObjectUnmarshaller.cpp
index 03c7293..eeb05fa 100644 (file)
@@ -48,8 +48,8 @@ XMLObject* AbstractXMLObjectUnmarshaller::unmarshall(DOMElement* element, bool b
 #endif\r
 \r
     if (XT_log.isDebugEnabled()) {\r
-        auto_ptr_char dname(element->getLocalName());\r
-        XT_log.debug("unmarshalling DOM element %s", dname.get());\r
+        auto_ptr_char dname(element->getNodeName());\r
+        XT_log.debug("unmarshalling DOM element (%s)", dname.get());\r
     }\r
 \r
     auto_ptr<XMLObject> xmlObject(buildXMLObject(element));\r
@@ -91,8 +91,8 @@ void AbstractXMLObjectUnmarshaller::unmarshallAttributes(const DOMElement* domEl
     static const XMLCh type[]={chLatin_t, chLatin_y, chLatin_p, chLatin_e, chNull};\r
 \r
     if (XT_log.isDebugEnabled()) {\r
-        auto_ptr_char dname(domElement->getLocalName());\r
-        XT_log.debug("unmarshalling attributes for DOM element %s", dname.get());\r
+        auto_ptr_char dname(domElement->getNodeName());\r
+        XT_log.debug("unmarshalling attributes for DOM element (%s)", dname.get());\r
     }\r
 \r
     DOMNamedNodeMap* attributes = domElement->getAttributes();\r
@@ -133,7 +133,7 @@ void AbstractXMLObjectUnmarshaller::unmarshallAttributes(const DOMElement* domEl
             xmlObject.setSchemaType(xsitype.get());\r
             continue;\r
         }\r
-        else if (nsuri) {\r
+        else if (nsuri && !XMLString::equals(nsuri,XMLConstants::XML_NS)) {\r
             XT_log.debug("found namespace-qualified attribute, adding prefix to the list of namespaces on the XMLObject");\r
             xmlObject.addNamespace(Namespace(nsuri, attribute->getPrefix()));\r
         }\r
@@ -150,8 +150,8 @@ void AbstractXMLObjectUnmarshaller::unmarshallChildElements(const DOMElement* do
 #endif\r
 \r
     if (XT_log.isDebugEnabled()) {\r
-        auto_ptr_char dname(domElement->getLocalName());\r
-        XT_log.debug("unmarshalling child elements of DOM element %s", dname.get());\r
+        auto_ptr_char dname(domElement->getNodeName());\r
+        XT_log.debug("unmarshalling child elements of DOM element (%s)", dname.get());\r
     }\r
 \r
     DOMNodeList* childNodes = domElement->getChildNodes();\r
@@ -170,14 +170,14 @@ void AbstractXMLObjectUnmarshaller::unmarshallChildElements(const DOMElement* do
             if (!unmarshaller) {\r
                 auto_ptr<QName> cname(XMLHelper::getNodeQName(childNode));\r
                 XT_log.error(\r
-                    "no default unmarshaller installed, found unknown child element %s", cname->toString().c_str()\r
+                    "no default unmarshaller installed, found unknown child element (%s)", cname->toString().c_str()\r
                     );\r
                 throw UnmarshallingException("Unmarshaller found unknown child element, but no default unmarshaller was found.");\r
             }\r
 \r
             if (XT_log.isDebugEnabled()) {\r
                 auto_ptr<QName> cname(XMLHelper::getNodeQName(childNode));\r
-                XT_log.debug("unmarshalling child element %s", cname->toString().c_str());\r
+                XT_log.debug("unmarshalling child element (%s)", cname->toString().c_str());\r
             }\r
 \r
             // Retain ownership of the unmarshalled child until it's processed by the parent.\r