From: scantor Date: Thu, 12 May 2011 21:51:47 +0000 (+0000) Subject: https://bugs.internet2.edu/jira/browse/CPPXT-75 X-Git-Tag: 1.5.1~125 X-Git-Url: http://www.project-moonshot.org/gitweb/?a=commitdiff_plain;h=390cc2ea18b342c81fc058df7fe219fe1f4813ad;p=shibboleth%2Fxmltooling.git https://bugs.internet2.edu/jira/browse/CPPXT-75 git-svn-id: https://svn.shibboleth.net/cpp-xmltooling/branches/REL_1@851 de75baf8-a10c-0410-a50a-987c0e22f00f --- diff --git a/xmltooling/soap/impl/SOAPImpl.cpp b/xmltooling/soap/impl/SOAPImpl.cpp index 4549d90..d272fd2 100644 --- a/xmltooling/soap/impl/SOAPImpl.cpp +++ b/xmltooling/soap/impl/SOAPImpl.cpp @@ -55,7 +55,7 @@ namespace { public AbstractXMLObjectMarshaller, public AbstractXMLObjectUnmarshaller { - xmltooling::QName* m_qname; + mutable xmltooling::QName* m_qname; public: virtual ~FaultcodeImpl() { delete m_qname; @@ -71,6 +71,9 @@ namespace { } const xmltooling::QName* getCode() const { + if (!m_qname && getDOM() && getDOM()->getTextContent()) { + m_qname = XMLHelper::getNodeValueAsQName(getDOM()); + } return m_qname; } @@ -80,8 +83,9 @@ namespace { auto_ptr_XMLCh temp(m_qname->toString().c_str()); setTextContent(temp.get()); } - else + else { setTextContent(nullptr); + } } IMPL_XMLOBJECT_CLONE(Faultcode); @@ -358,9 +362,9 @@ const XMLCh Envelope::LOCAL_NAME[] = UNICODE_LITERAL_8(E,n,v, const XMLCh Envelope::TYPE_NAME[] = UNICODE_LITERAL_8(E,n,v,e,l,o,p,e); const XMLCh Fault::LOCAL_NAME[] = UNICODE_LITERAL_5(F,a,u,l,t); const XMLCh Fault::TYPE_NAME[] = UNICODE_LITERAL_5(F,a,u,l,t); -const XMLCh Faultactor::LOCAL_NAME[] = UNICODE_LITERAL_10(F,a,u,l,t,a,c,t,o,r); -const XMLCh Faultcode::LOCAL_NAME[] = UNICODE_LITERAL_9(F,a,u,l,t,c,o,d,e); -const XMLCh Faultstring::LOCAL_NAME[] = UNICODE_LITERAL_11(F,a,u,l,t,s,t,r,i,n,g); +const XMLCh Faultactor::LOCAL_NAME[] = UNICODE_LITERAL_10(f,a,u,l,t,a,c,t,o,r); +const XMLCh Faultcode::LOCAL_NAME[] = UNICODE_LITERAL_9(f,a,u,l,t,c,o,d,e); +const XMLCh Faultstring::LOCAL_NAME[] = UNICODE_LITERAL_11(f,a,u,l,t,s,t,r,i,n,g); const XMLCh Header::LOCAL_NAME[] = UNICODE_LITERAL_6(H,e,a,d,e,r); const XMLCh Header::TYPE_NAME[] = UNICODE_LITERAL_6(H,e,a,d,e,r); const XMLCh Header::ACTOR_ATTRIB_NAME[] = UNICODE_LITERAL_5(a,c,t,o,r); diff --git a/xmltooling/util/XMLHelper.cpp b/xmltooling/util/XMLHelper.cpp index 7bc43ba..4d4b8e2 100644 --- a/xmltooling/util/XMLHelper.cpp +++ b/xmltooling/util/XMLHelper.cpp @@ -176,9 +176,12 @@ xmltooling::QName* XMLHelper::getNodeValueAsQName(const DOMNode* domNode) if (!domNode) return nullptr; - int i; const XMLCh* value=domNode->getTextContent(); - if (value && (i=XMLString::indexOf(value,chColon))>0) { + if (!value || !*value) + return nullptr; + + int i; + if ((i=XMLString::indexOf(value,chColon))>0) { XMLCh* prefix=new XMLCh[i+1]; XMLString::subString(prefix,value,0,i); prefix[i]=chNull;