XMLObject* xmlObject = buildXMLObject(element);\r
\r
if (element->hasAttributes()) {\r
- unmarshallAttributes(element, xmlObject);\r
+ unmarshallAttributes(element, *xmlObject);\r
}\r
\r
if (element->getTextContent()) {\r
- processElementContent(xmlObject, element->getTextContent());\r
+ processElementContent(*xmlObject, element->getTextContent());\r
}\r
\r
- unmarshallChildElements(element, xmlObject);\r
+ unmarshallChildElements(element, *xmlObject);\r
\r
/* TODO: Signing\r
if (xmlObject instanceof SignableXMLObject) {\r
throw UnmarshallingException("Failed to locate XMLObjectBuilder for element.");\r
}\r
\r
-void AbstractXMLObjectUnmarshaller::unmarshallAttributes(const DOMElement* domElement, XMLObject* xmlObject) const\r
+void AbstractXMLObjectUnmarshaller::unmarshallAttributes(const DOMElement* domElement, XMLObject& xmlObject) const\r
{\r
#ifdef _DEBUG\r
xmltooling::NDC ndc("unmarshallAttributes");\r
attribute = static_cast<DOMAttr*>(childNode);\r
\r
const XMLCh* nsuri=attribute->getNamespaceURI();\r
- if (!XMLString::compareString(nsuri,XMLConstants::XMLNS_NS)) {\r
+ if (XMLString::equals(nsuri,XMLConstants::XMLNS_NS)) {\r
XT_log.debug("found namespace declaration, adding it to the list of namespaces on the XMLObject");\r
- xmlObject->addNamespace(Namespace(attribute->getValue(), attribute->getLocalName()));\r
+ xmlObject.addNamespace(Namespace(attribute->getValue(), attribute->getLocalName(), true));\r
continue;\r
}\r
- else if (!XMLString::compareString(nsuri,XMLConstants::XSI_NS) &&\r
- !XMLString::compareString(attribute->getLocalName(),type)) {\r
+ else if (XMLString::equals(nsuri,XMLConstants::XSI_NS) && XMLString::equals(attribute->getLocalName(),type)) {\r
XT_log.debug("found xsi:type declaration, setting the schema type of the XMLObject");\r
auto_ptr<QName> xsitype(XMLHelper::getAttributeValueAsQName(attribute));\r
- xmlObject->setSchemaType(xsitype.get());\r
+ xmlObject.setSchemaType(xsitype.get());\r
continue;\r
}\r
+ else if (nsuri) {\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
\r
XT_log.debug("processing generic attribute");\r
processAttribute(xmlObject, attribute);\r
}\r
}\r
\r
-void AbstractXMLObjectUnmarshaller::unmarshallChildElements(const DOMElement* domElement, XMLObject* xmlObject) const\r
+void AbstractXMLObjectUnmarshaller::unmarshallChildElements(const DOMElement* domElement, XMLObject& xmlObject) const\r
{\r
#ifdef _DEBUG\r
xmltooling::NDC ndc("unmarshallChildElements");\r
if (childNode->getNodeType() == DOMNode::ELEMENT_NODE) {\r
unmarshaller = Unmarshaller::getUnmarshaller(static_cast<DOMElement*>(childNode));\r
if (!unmarshaller) {\r
- if (config.ignoreUnknownElements) {\r
- unmarshaller=Unmarshaller::getDefaultUnmarshaller();\r
- if (!unmarshaller) {\r
- auto_ptr<QName> cname(XMLHelper::getNodeQName(childNode));\r
- XT_log.error(\r
- "no default unmarshaller installed, found unknown child element %s",\r
- cname->toString().c_str()\r
- );\r
- throw UnmarshallingException(\r
- "Unmarshaller found unknown child element, but no default unmarshaller was found."\r
- );\r
- }\r
- else {\r
- XT_log.debug("using default unmarshaller");\r
- }\r
- }\r
- else {\r
- auto_ptr<QName> cname(XMLHelper::getNodeQName(childNode));\r
- XT_log.error("detected unknown child element %s", cname->toString().c_str());\r
- throw UnknownElementException("Unmarshaller found unknown child element.");\r
- }\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
+ );\r
+ throw UnmarshallingException("Unmarshaller found unknown child element, but no default unmarshaller was found.");\r
}\r
\r
if (XT_log.isDebugEnabled()) {\r