boost changes and header fixes
[shibboleth/cpp-opensaml.git] / saml / saml1 / core / impl / ProtocolsImpl.cpp
index 1ed52c7..b9aa3a7 100644 (file)
@@ -1,47 +1,58 @@
-/*
- *  Copyright 2001-2006 Internet2
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+/**
+ * Licensed to the University Corporation for Advanced Internet
+ * Development, Inc. (UCAID) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for
+ * additional information regarding copyright ownership.
+ *
+ * UCAID licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the
+ * License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
  */
 
 /**
  * ProtocolsImpl.cpp
- * 
- * Implementation classes for SAML 1.x Protocols schema
+ *
+ * Implementation classes for SAML 1.x Protocols schema.
  */
 
 #include "internal.h"
 #include "exceptions.h"
+#include "saml1/core/Assertions.h"
 #include "saml1/core/Protocols.h"
+#include "signature/ContentReference.h"
 
-#include <xmltooling/AbstractChildlessElement.h>
 #include <xmltooling/AbstractComplexElement.h>
-#include <xmltooling/AbstractElementProxy.h>
 #include <xmltooling/AbstractSimpleElement.h>
 #include <xmltooling/impl/AnyElement.h>
 #include <xmltooling/io/AbstractXMLObjectMarshaller.h>
 #include <xmltooling/io/AbstractXMLObjectUnmarshaller.h>
+#include <xmltooling/signature/Signature.h>
+#include <xmltooling/util/DateTime.h>
 #include <xmltooling/util/XMLHelper.h>
 
 #include <ctime>
+#include <boost/lexical_cast.hpp>
 #include <xercesc/util/XMLUniDefs.hpp>
 
 using namespace opensaml::saml1p;
 using namespace opensaml::saml1;
-using namespace opensaml;
 using namespace xmlsignature;
 using namespace xmltooling;
 using namespace std;
+using xmlconstants::XMLSIG_NS;
+using xmlconstants::XML_ONE;
+using samlconstants::SAML1P_NS;
+using samlconstants::SAML1_NS;
+using samlconstants::SAML1P_PREFIX;
 
 #if defined (_MSC_VER)
     #pragma warning( push )
@@ -50,48 +61,64 @@ using namespace std;
 
 namespace opensaml {
     namespace saml1p {
-    
+
         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,AssertionArtifact);
         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,StatusMessage);
 
         class SAML_DLLLOCAL RespondWithImpl : public virtual RespondWith,
-            protected AbstractSimpleElement,
-            public AbstractChildlessElement,
+            public AbstractSimpleElement,
             public AbstractDOMCachingXMLObject,
             public AbstractXMLObjectMarshaller,
             public AbstractXMLObjectUnmarshaller
         {
-            QName* m_qname;
+            mutable xmltooling::QName* m_qname;
         public:
             virtual ~RespondWithImpl() {
                 delete m_qname;
             }
-    
-            RespondWithImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
-                : AbstractXMLObject(nsURI, localName, prefix, schemaType), m_qname(NULL) {
+
+            RespondWithImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType), m_qname(nullptr) {
             }
-                
+
             RespondWithImpl(const RespondWithImpl& src)
-                    : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src), m_qname(NULL) {
+                    : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src), m_qname(nullptr) {
                 setQName(src.getQName());
             }
-            
-            QName* getQName() const {
+
+            xmltooling::QName* getQName() const {
+                if (!m_qname && getDOM() && getDOM()->getTextContent()) {
+                    m_qname = XMLHelper::getNodeValueAsQName(getDOM());
+                }
                 return m_qname;
             }
-            
-            void setQName(const QName* qname) {
+
+            void setQName(const xmltooling::QName* qname) {
                 m_qname=prepareForAssignment(m_qname,qname);
                 if (m_qname) {
                     auto_ptr_XMLCh temp(m_qname->toString().c_str());
                     setTextContent(temp.get());
                 }
-                else
-                    setTextContent(NULL);
+                else {
+                    setTextContent(nullptr);
+                }
             }
-            
+
             IMPL_XMLOBJECT_CLONE(RespondWith);
-            IMPL_XMLOBJECT_CONTENT;
+        };
+
+        class SAML_DLLLOCAL QueryImpl : public virtual Query, public AnyElementImpl
+        {
+        public:
+            virtual ~QueryImpl() {}
+
+            QueryImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+            }
+
+            QueryImpl(const QueryImpl& src) : AbstractXMLObject(src), AnyElementImpl(src) {}
+
+            IMPL_XMLOBJECT_CLONE_EX(Query);
         };
 
         class SAML_DLLLOCAL SubjectQueryImpl : public virtual SubjectQuery,
@@ -101,33 +128,47 @@ namespace opensaml {
             public AbstractXMLObjectUnmarshaller
         {
             void init() {
-                m_Subject=NULL;
-                m_children.push_back(NULL);
+                m_Subject=nullptr;
+                m_children.push_back(nullptr);
                 m_pos_Subject=m_children.begin();
             }
+
         protected:
             SubjectQueryImpl() {
                 init();
             }
+
         public:
             virtual ~SubjectQueryImpl() {}
-    
-            SubjectQueryImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+
+            SubjectQueryImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
                 init();
             }
-                
-            SubjectQueryImpl(const SubjectQueryImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) {
+
+            SubjectQueryImpl(const SubjectQueryImpl& src)
+                    : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
                 init();
+            }
+
+            void _clone(const SubjectQueryImpl& src) {
                 if (src.getSubject())
                     setSubject(src.getSubject()->cloneSubject());
             }
-            
+
+            SubjectQuery* cloneSubjectQuery() const {
+                return dynamic_cast<SubjectQuery*>(clone());
+            }
+
+            Query* cloneQuery() const {
+                return dynamic_cast<Query*>(clone());
+            }
+
             IMPL_TYPED_CHILD(Subject);
-    
+
         protected:
             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
-                PROC_TYPED_CHILD(Subject,SAMLConstants::SAML1_NS,true);
+                PROC_TYPED_CHILD(Subject,SAML1_NS,true);
                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
             }
         };
@@ -135,40 +176,39 @@ namespace opensaml {
         class SAML_DLLLOCAL AuthenticationQueryImpl : public virtual AuthenticationQuery, public SubjectQueryImpl
         {
             void init() {
-                m_AuthenticationMethod=NULL;
+                m_AuthenticationMethod=nullptr;
             }
+
         public:
             virtual ~AuthenticationQueryImpl() {
                 XMLString::release(&m_AuthenticationMethod);
             }
-    
-            AuthenticationQueryImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
-                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+
+            AuthenticationQueryImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
+                    : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
                 init();
             }
-                
+
             AuthenticationQueryImpl(const AuthenticationQueryImpl& src) : AbstractXMLObject(src), SubjectQueryImpl(src) {
                 init();
-                setAuthenticationMethod(src.getAuthenticationMethod());
-            }
-            
-            IMPL_XMLOBJECT_CLONE(AuthenticationQuery);
-            SubjectQuery* cloneSubjectQuery() const {
-                return cloneAuthenticationQuery();
             }
-            Query* cloneQuery() const {
-                return cloneAuthenticationQuery();
+
+            void _clone(const AuthenticationQueryImpl& src) {
+                SubjectQueryImpl::_clone(src);
+                setAuthenticationMethod(src.getAuthenticationMethod());
             }
+
+            IMPL_XMLOBJECT_CLONE_EX(AuthenticationQuery);
             IMPL_STRING_ATTRIB(AuthenticationMethod);
-    
+
         protected:
             void marshallAttributes(DOMElement* domElement) const {
-                MARSHALL_STRING_ATTRIB(AuthenticationMethod,AUTHENTICATIONMETHOD,NULL);
+                MARSHALL_STRING_ATTRIB(AuthenticationMethod,AUTHENTICATIONMETHOD,nullptr);
                 SubjectQueryImpl::marshallAttributes(domElement);
             }
-    
+
             void processAttribute(const DOMAttr* attribute) {
-                PROC_STRING_ATTRIB(AuthenticationMethod,AUTHENTICATIONMETHOD,NULL);
+                PROC_STRING_ATTRIB(AuthenticationMethod,AUTHENTICATIONMETHOD,nullptr);
                 SubjectQueryImpl::processAttribute(attribute);
             }
         };
@@ -176,52 +216,50 @@ namespace opensaml {
         class SAML_DLLLOCAL AttributeQueryImpl : public virtual AttributeQuery, public SubjectQueryImpl
         {
             void init() {
-                m_Resource=NULL;
+                m_Resource=nullptr;
             }
+
         public:
             virtual ~AttributeQueryImpl() {
                 XMLString::release(&m_Resource);
             }
-    
-            AttributeQueryImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
-                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+
+            AttributeQueryImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
+                    : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
                 init();
             }
-                
+
             AttributeQueryImpl(const AttributeQueryImpl& src) : AbstractXMLObject(src), SubjectQueryImpl(src) {
                 init();
+            }
+
+            void _clone(const AttributeQueryImpl& src) {
+                SubjectQueryImpl::_clone(src);
                 setResource(src.getResource());
-                VectorOf(AttributeDesignator) v=getAttributeDesignators();
                 for (vector<AttributeDesignator*>::const_iterator i=src.m_AttributeDesignators.begin(); i!=src.m_AttributeDesignators.end(); i++) {
                     if (*i) {
-                        v.push_back((*i)->cloneAttributeDesignator());
+                        getAttributeDesignators().push_back((*i)->cloneAttributeDesignator());
                     }
                 }
             }
-            
-            IMPL_XMLOBJECT_CLONE(AttributeQuery);
-            SubjectQuery* cloneSubjectQuery() const {
-                return cloneAttributeQuery();
-            }
-            Query* cloneQuery() const {
-                return cloneAttributeQuery();
-            }
+
+            IMPL_XMLOBJECT_CLONE_EX(AttributeQuery);
             IMPL_STRING_ATTRIB(Resource);
             IMPL_TYPED_CHILDREN(AttributeDesignator,m_children.end());
-    
+
         protected:
             void marshallAttributes(DOMElement* domElement) const {
-                MARSHALL_STRING_ATTRIB(Resource,RESOURCE,NULL);
+                MARSHALL_STRING_ATTRIB(Resource,RESOURCE,nullptr);
                 SubjectQueryImpl::marshallAttributes(domElement);
             }
-    
+
             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
-                PROC_TYPED_CHILDREN(AttributeDesignator,SAMLConstants::SAML1_NS,true);
+                PROC_TYPED_CHILDREN(AttributeDesignator,SAML1_NS,true);
                 SubjectQueryImpl::processChildElement(childXMLObject,root);
             }
-    
+
             void processAttribute(const DOMAttr* attribute) {
-                PROC_STRING_ATTRIB(Resource,RESOURCE,NULL);
+                PROC_STRING_ATTRIB(Resource,RESOURCE,nullptr);
                 SubjectQueryImpl::processAttribute(attribute);
             }
         };
@@ -229,60 +267,58 @@ namespace opensaml {
         class SAML_DLLLOCAL AuthorizationDecisionQueryImpl : public virtual AuthorizationDecisionQuery, public SubjectQueryImpl
         {
             void init() {
-                m_Resource=NULL;
-                m_Evidence=NULL;
-                m_children.push_back(NULL);
+                m_Resource=nullptr;
+                m_Evidence=nullptr;
+                m_children.push_back(nullptr);
                 m_pos_Evidence=m_pos_Subject;
                 ++m_pos_Evidence;
             }
+
         public:
             virtual ~AuthorizationDecisionQueryImpl() {
                 XMLString::release(&m_Resource);
             }
-    
-            AuthorizationDecisionQueryImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
-                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+
+            AuthorizationDecisionQueryImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
+                    : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
                 init();
             }
-                
+
             AuthorizationDecisionQueryImpl(const AuthorizationDecisionQueryImpl& src) : AbstractXMLObject(src), SubjectQueryImpl(src) {
                 init();
+            }
+
+            void _clone(const AuthorizationDecisionQueryImpl& src) {
+                SubjectQueryImpl::_clone(src);
                 setResource(src.getResource());
                 if (src.getEvidence())
                     setEvidence(src.getEvidence()->cloneEvidence());
-                VectorOf(Action) v=getActions();
                 for (vector<Action*>::const_iterator i=src.m_Actions.begin(); i!=src.m_Actions.end(); i++) {
                     if (*i) {
-                        v.push_back((*i)->cloneAction());
+                        getActions().push_back((*i)->cloneAction());
                     }
                 }
             }
-            
-            IMPL_XMLOBJECT_CLONE(AuthorizationDecisionQuery);
-            SubjectQuery* cloneSubjectQuery() const {
-                return cloneAuthorizationDecisionQuery();
-            }
-            Query* cloneQuery() const {
-                return cloneAuthorizationDecisionQuery();
-            }
+
+            IMPL_XMLOBJECT_CLONE_EX(AuthorizationDecisionQuery);
             IMPL_STRING_ATTRIB(Resource);
             IMPL_TYPED_CHILD(Evidence);
             IMPL_TYPED_CHILDREN(Action, m_pos_Evidence);
-    
+
         protected:
             void marshallAttributes(DOMElement* domElement) const {
-                MARSHALL_STRING_ATTRIB(Resource,RESOURCE,NULL);
+                MARSHALL_STRING_ATTRIB(Resource,RESOURCE,nullptr);
                 SubjectQueryImpl::marshallAttributes(domElement);
             }
-    
+
             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
-                PROC_TYPED_CHILD(Evidence,SAMLConstants::SAML1_NS,false);
-                PROC_TYPED_CHILDREN(Action,SAMLConstants::SAML1_NS,false);
+                PROC_TYPED_CHILD(Evidence,SAML1_NS,false);
+                PROC_TYPED_CHILDREN(Action,SAML1_NS,false);
                 SubjectQueryImpl::processChildElement(childXMLObject,root);
             }
-    
+
             void processAttribute(const DOMAttr* attribute) {
-                PROC_STRING_ATTRIB(Resource,RESOURCE,NULL);
+                PROC_STRING_ATTRIB(Resource,RESOURCE,nullptr);
                 SubjectQueryImpl::processAttribute(attribute);
             }
         };
@@ -294,13 +330,14 @@ namespace opensaml {
             public AbstractXMLObjectUnmarshaller
         {
             void init() {
-                m_MinorVersion=NULL;
-                m_RequestID=NULL;
-                m_IssueInstant=NULL;
-                m_children.push_back(NULL);
-                m_Signature=NULL;
+                m_MinorVersion=nullptr;
+                m_RequestID=nullptr;
+                m_IssueInstant=nullptr;
+                m_children.push_back(nullptr);
+                m_Signature=nullptr;
                 m_pos_Signature=m_children.begin();
             }
+
         protected:
             RequestAbstractTypeImpl() {
                 init();
@@ -311,37 +348,42 @@ namespace opensaml {
                 XMLString::release(&m_RequestID);
                 delete m_IssueInstant;
             }
-    
-            RequestAbstractTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+
+            RequestAbstractTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
                 init();
             }
-                
-            RequestAbstractTypeImpl(const RequestAbstractTypeImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) {
+
+            RequestAbstractTypeImpl(const RequestAbstractTypeImpl& src)
+                    : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
                 init();
+            }
+
+            //IMPL_TYPED_CHILD(Signature);
+            // Need customized setter.
+
+        protected:
+            void _clone(const RequestAbstractTypeImpl& src) {
                 setMinorVersion(src.m_MinorVersion);
                 setRequestID(src.getRequestID());
                 setIssueInstant(src.getIssueInstant());
                 if (src.getSignature())
                     setSignature(src.getSignature()->cloneSignature());
-                VectorOf(RespondWith) v=getRespondWiths();
                 for (vector<RespondWith*>::const_iterator i=src.m_RespondWiths.begin(); i!=src.m_RespondWiths.end(); i++) {
                     if (*i) {
-                        v.push_back((*i)->cloneRespondWith());
+                        getRespondWiths().push_back((*i)->cloneRespondWith());
                     }
                 }
             }
-            
-            //IMPL_TYPED_CHILD(Signature);
-            // Need customized setter.
-        protected:
+
             Signature* m_Signature;
             list<XMLObject*>::iterator m_pos_Signature;
+
         public:
             Signature* getSignature() const {
                 return m_Signature;
             }
-            
+
             void setSignature(Signature* sig) {
                 prepareForAssignment(m_Signature,sig);
                 *m_pos_Signature=m_Signature=sig;
@@ -350,86 +392,126 @@ namespace opensaml {
                     m_Signature->setContentReference(new opensaml::ContentReference(*this));
             }
 
+            RequestAbstractType* cloneRequestAbstractType() const {
+                return dynamic_cast<RequestAbstractType*>(clone());
+            }
+
             IMPL_INTEGER_ATTRIB(MinorVersion);
-            IMPL_ID_ATTRIB(RequestID);
+            IMPL_STRING_ATTRIB(RequestID);    // have to special-case getXMLID
+            const XMLCh* getXMLID() const {
+                pair<bool,int> v = getMinorVersion();
+                return (!v.first || v.second > 0) ? m_RequestID : nullptr;
+            }
+            const XMLCh* getID() const {
+                return getRequestID();
+            }
+            void releaseDOM() const {
+                if (getDOM())
+                    getDOM()->removeAttributeNS(nullptr, REQUESTID_ATTRIB_NAME);
+                AbstractDOMCachingXMLObject::releaseDOM();
+            }
             IMPL_DATETIME_ATTRIB(IssueInstant,0);
             IMPL_TYPED_CHILDREN(RespondWith,m_pos_Signature);
-    
+
         protected:
+            void prepareForMarshalling() const {
+                if (m_Signature)
+                    declareNonVisibleNamespaces();
+            }
+
             void marshallAttributes(DOMElement* domElement) const {
                 static const XMLCh MAJORVERSION[] = UNICODE_LITERAL_12(M,a,j,o,r,V,e,r,s,i,o,n);
-                domElement->setAttributeNS(NULL,MAJORVERSION,XMLConstants::XML_ONE);
+                domElement->setAttributeNS(nullptr,MAJORVERSION,XML_ONE);
                 if (!m_MinorVersion)
-                    const_cast<RequestAbstractTypeImpl*>(this)->m_MinorVersion=XMLString::replicate(XMLConstants::XML_ONE);
-                MARSHALL_INTEGER_ATTRIB(MinorVersion,MINORVERSION,NULL);
+                    const_cast<RequestAbstractTypeImpl*>(this)->m_MinorVersion=XMLString::replicate(XML_ONE);
+                MARSHALL_INTEGER_ATTRIB(MinorVersion,MINORVERSION,nullptr);
                 if (!m_RequestID)
                     const_cast<RequestAbstractTypeImpl*>(this)->m_RequestID=SAMLConfig::getConfig().generateIdentifier();
-                MARSHALL_ID_ATTRIB(RequestID,REQUESTID,NULL);
+                domElement->setAttributeNS(nullptr, REQUESTID_ATTRIB_NAME, m_RequestID);
+                if (*m_MinorVersion!=chDigit_0) {
+#ifdef XMLTOOLING_XERCESC_BOOLSETIDATTRIBUTE
+                    domElement->setIdAttributeNS(nullptr, REQUESTID_ATTRIB_NAME, true);
+#else
+                    domElement->setIdAttributeNS(nullptr, REQUESTID_ATTRIB_NAME);
+#endif
+                }
                 if (!m_IssueInstant) {
-                    const_cast<RequestAbstractTypeImpl*>(this)->m_IssueInstantEpoch=time(NULL);
+                    const_cast<RequestAbstractTypeImpl*>(this)->m_IssueInstantEpoch=time(nullptr);
                     const_cast<RequestAbstractTypeImpl*>(this)->m_IssueInstant=new DateTime(m_IssueInstantEpoch);
                 }
-                MARSHALL_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,NULL);
+                MARSHALL_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,nullptr);
             }
 
             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
-                PROC_TYPED_CHILDREN(RespondWith,SAMLConstants::SAML1P_NS,false);
-                PROC_TYPED_CHILD(Signature,XMLConstants::XMLSIG_NS,false);
+                PROC_TYPED_CHILDREN(RespondWith,SAML1P_NS,false);
+                PROC_TYPED_CHILD(Signature,XMLSIG_NS,false);
                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
             }
 
+            void unmarshallAttributes(const DOMElement* domElement) {
+                // Standard processing, but then we check IDness.
+                AbstractXMLObjectUnmarshaller::unmarshallAttributes(domElement);
+                if (m_RequestID && (!m_MinorVersion || *m_MinorVersion!=chDigit_0)) {
+#ifdef XMLTOOLING_XERCESC_BOOLSETIDATTRIBUTE
+                    const_cast<DOMElement*>(domElement)->setIdAttributeNS(nullptr, REQUESTID_ATTRIB_NAME, true);
+#else
+                    const_cast<DOMElement*>(domElement)->setIdAttributeNS(nullptr, REQUESTID_ATTRIB_NAME);
+#endif
+                }
+            }
+
             void processAttribute(const DOMAttr* attribute) {
                 static const XMLCh MAJORVERSION[] = UNICODE_LITERAL_12(M,a,j,o,r,V,e,r,s,i,o,n);
-                if (XMLHelper::isNodeNamed(attribute,NULL,MAJORVERSION)) {
-                    if (!XMLString::equals(attribute->getValue(),XMLConstants::XML_ONE))
+                if (XMLHelper::isNodeNamed(attribute,nullptr,MAJORVERSION)) {
+                    if (!XMLString::equals(attribute->getValue(),XML_ONE))
                         throw UnmarshallingException("Request has invalid major version.");
                 }
-                PROC_INTEGER_ATTRIB(MinorVersion,MINORVERSION,NULL);
-                PROC_ID_ATTRIB(RequestID,REQUESTID,NULL);
-                PROC_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,NULL);
+                PROC_INTEGER_ATTRIB(MinorVersion,MINORVERSION,nullptr);
+                PROC_STRING_ATTRIB(RequestID,REQUESTID,nullptr);
+                PROC_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,nullptr);
             }
         };
 
         class SAML_DLLLOCAL RequestImpl : public virtual Request, public RequestAbstractTypeImpl
         {
             void init() {
-                m_children.push_back(NULL);
-                m_Query=NULL;
+                m_children.push_back(nullptr);
+                m_Query=nullptr;
                 m_pos_Query=m_pos_Signature;
                 ++m_pos_Query;
             }
+
         public:
             virtual ~RequestImpl() {}
-    
-            RequestImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+
+            RequestImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
                 init();
             }
-                
+
             RequestImpl(const RequestImpl& src) : AbstractXMLObject(src), RequestAbstractTypeImpl(src) {
                 init();
+            }
+
+            void _clone(const RequestImpl& src) {
+                RequestAbstractTypeImpl::_clone(src);
                 if (src.getQuery())
                     setQuery(src.getQuery()->cloneQuery());
-                VectorOf(AssertionIDReference) v=getAssertionIDReferences();
                 for (vector<AssertionIDReference*>::const_iterator i=src.m_AssertionIDReferences.begin(); i!=src.m_AssertionIDReferences.end(); i++) {
                     if (*i) {
-                        v.push_back((*i)->cloneAssertionIDReference());
+                        getAssertionIDReferences().push_back((*i)->cloneAssertionIDReference());
                     }
                 }
-                VectorOf(AssertionArtifact) v2=getAssertionArtifacts();
                 for (vector<AssertionArtifact*>::const_iterator i=src.m_AssertionArtifacts.begin(); i!=src.m_AssertionArtifacts.end(); i++) {
                     if (*i) {
-                        v2.push_back((*i)->cloneAssertionArtifact());
+                        getAssertionArtifacts().push_back((*i)->cloneAssertionArtifact());
                     }
                 }
             }
-            
-            IMPL_XMLOBJECT_CLONE(Request);
-            RequestAbstractType* cloneRequestAbstractType() const {
-                return cloneRequest();
-            }
+
+            IMPL_XMLOBJECT_CLONE_EX(Request);
             IMPL_TYPED_CHILD(Query);
-            
+
             SubjectQuery* getSubjectQuery() const {
                 return dynamic_cast<SubjectQuery*>(getQuery());
             }
@@ -455,15 +537,15 @@ namespace opensaml {
             void setAuthorizationDecisionQuery(AuthorizationDecisionQuery* q) {
                 setQuery(q);
             }
-            
+
             IMPL_TYPED_CHILDREN(AssertionIDReference, m_children.end());
             IMPL_TYPED_CHILDREN(AssertionArtifact, m_children.end());
-    
+
         protected:
             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
-                PROC_TYPED_CHILD(Query,SAMLConstants::SAML1P_NS,true);
-                PROC_TYPED_CHILDREN(AssertionIDReference,SAMLConstants::SAML1_NS,false);
-                PROC_TYPED_CHILDREN(AssertionArtifact,SAMLConstants::SAML1P_NS,false);
+                PROC_TYPED_CHILD(Query,SAML1P_NS,true);
+                PROC_TYPED_CHILDREN(AssertionIDReference,SAML1_NS,false);
+                PROC_TYPED_CHILDREN(AssertionArtifact,SAML1P_NS,false);
                 RequestAbstractTypeImpl::processChildElement(childXMLObject,root);
             }
         };
@@ -475,44 +557,46 @@ namespace opensaml {
             public AbstractXMLObjectUnmarshaller
         {
             void init() {
-                m_Value=NULL;
-                m_children.push_back(NULL);
-                m_StatusCode=NULL;
+                m_Value=nullptr;
+                m_children.push_back(nullptr);
+                m_StatusCode=nullptr;
                 m_pos_StatusCode=m_children.begin();
             }
+
         public:
             virtual ~StatusCodeImpl() {
                 delete m_Value;
             }
-    
-            StatusCodeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+
+            StatusCodeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
                 init();
             }
-                
-            StatusCodeImpl(const StatusCodeImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) {
+
+            StatusCodeImpl(const StatusCodeImpl& src)
+                    : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
                 init();
                 setValue(src.getValue());
                 if (src.getStatusCode())
                     setStatusCode(src.getStatusCode()->cloneStatusCode());
             }
-            
+
             IMPL_XMLOBJECT_CLONE(StatusCode);
-            IMPL_XMLOBJECT_ATTRIB(Value,QName);
+            IMPL_XMLOBJECT_ATTRIB(Value,xmltooling::QName);
             IMPL_TYPED_CHILD(StatusCode);
-    
+
         protected:
             void marshallAttributes(DOMElement* domElement) const {
-                MARSHALL_QNAME_ATTRIB(Value,VALUE,NULL);
+                MARSHALL_QNAME_ATTRIB(Value,VALUE,nullptr);
             }
 
             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
-                PROC_TYPED_CHILD(StatusCode,SAMLConstants::SAML1P_NS,true);
+                PROC_TYPED_CHILD(StatusCode,SAML1P_NS,true);
                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
             }
 
             void processAttribute(const DOMAttr* attribute) {
-                PROC_QNAME_ATTRIB(Value,VALUE,NULL);
+                PROC_QNAME_ATTRIB(Value,VALUE,nullptr);
             }
         };
 
@@ -524,26 +608,26 @@ namespace opensaml {
         {
         public:
             virtual ~StatusDetailImpl() {}
-    
-            StatusDetailImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+
+            StatusDetailImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
             }
-                
-            StatusDetailImpl(const StatusDetailImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) {
-                VectorOf(XMLObject) v=getDetails();
-                for (vector<XMLObject*>::const_iterator i=src.m_Details.begin(); i!=src.m_Details.end(); i++) {
+
+            StatusDetailImpl(const StatusDetailImpl& src)
+                    : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
+                for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) {
                     if (*i) {
-                        v.push_back((*i)->clone());
+                        getUnknownXMLObjects().push_back((*i)->clone());
                     }
                 }
             }
-            
+
             IMPL_XMLOBJECT_CLONE(StatusDetail);
-            IMPL_XMLOBJECT_CHILDREN(Detail,m_children.end());
-    
+            IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
+
         protected:
             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
-                getDetails().push_back(childXMLObject);
+                getUnknownXMLObjects().push_back(childXMLObject);
             }
         };
 
@@ -554,27 +638,29 @@ namespace opensaml {
             public AbstractXMLObjectUnmarshaller
         {
             void init() {
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
-                m_StatusCode=NULL;
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
+                m_StatusCode=nullptr;
                 m_pos_StatusCode=m_children.begin();
-                m_StatusMessage=NULL;
+                m_StatusMessage=nullptr;
                 m_pos_StatusMessage=m_pos_StatusCode;
                 ++m_pos_StatusMessage;
-                m_StatusDetail=NULL;
+                m_StatusDetail=nullptr;
                 m_pos_StatusDetail=m_pos_StatusMessage;
                 ++m_pos_StatusDetail;
             }
+
         public:
             virtual ~StatusImpl() {}
-    
-            StatusImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+
+            StatusImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
                 init();
             }
-                
-            StatusImpl(const StatusImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) {
+
+            StatusImpl(const StatusImpl& src)
+                    : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
                 init();
                 if (src.getStatusCode())
                     setStatusCode(src.getStatusCode()->cloneStatusCode());
@@ -583,17 +669,17 @@ namespace opensaml {
                 if (src.getStatusDetail())
                     setStatusDetail(src.getStatusDetail()->cloneStatusDetail());
             }
-            
+
             IMPL_XMLOBJECT_CLONE(Status);
             IMPL_TYPED_CHILD(StatusCode);
             IMPL_TYPED_CHILD(StatusMessage);
             IMPL_TYPED_CHILD(StatusDetail);
-    
+
         protected:
             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
-                PROC_TYPED_CHILD(StatusCode,SAMLConstants::SAML1P_NS,false);
-                PROC_TYPED_CHILD(StatusMessage,SAMLConstants::SAML1P_NS,false);
-                PROC_TYPED_CHILD(StatusDetail,SAMLConstants::SAML1P_NS,false);
+                PROC_TYPED_CHILD(StatusCode,SAML1P_NS,false);
+                PROC_TYPED_CHILD(StatusMessage,SAML1P_NS,false);
+                PROC_TYPED_CHILD(StatusDetail,SAML1P_NS,false);
                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
             }
         };
@@ -605,19 +691,21 @@ namespace opensaml {
             public AbstractXMLObjectUnmarshaller
         {
             void init() {
-                m_MinorVersion=NULL;
-                m_ResponseID=NULL;
-                m_InResponseTo=NULL;
-                m_IssueInstant=NULL;
-                m_Recipient=NULL;
-                m_children.push_back(NULL);
-                m_Signature=NULL;
+                m_MinorVersion=nullptr;
+                m_ResponseID=nullptr;
+                m_InResponseTo=nullptr;
+                m_IssueInstant=nullptr;
+                m_Recipient=nullptr;
+                m_children.push_back(nullptr);
+                m_Signature=nullptr;
                 m_pos_Signature=m_children.begin();
             }
+
         protected:
             ResponseAbstractTypeImpl() {
                 init();
             }
+
         public:
             virtual ~ResponseAbstractTypeImpl() {
                 XMLString::release(&m_MinorVersion);
@@ -626,14 +714,21 @@ namespace opensaml {
                 XMLString::release(&m_Recipient);
                 delete m_IssueInstant;
             }
-    
-            ResponseAbstractTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
-                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+
+            ResponseAbstractTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
+                    : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
                 init();
             }
-                
-            ResponseAbstractTypeImpl(const ResponseAbstractTypeImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) {
+
+            ResponseAbstractTypeImpl(const ResponseAbstractTypeImpl& src)
+                    : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
                 init();
+            }
+
+            //IMPL_TYPED_CHILD(Signature);
+            // Need customized setter.
+        protected:
+            void _clone(const ResponseAbstractTypeImpl& src) {
                 setMinorVersion(src.m_MinorVersion);
                 setResponseID(src.getResponseID());
                 setInResponseTo(src.getInResponseTo());
@@ -643,16 +738,13 @@ namespace opensaml {
                     setSignature(src.getSignature()->cloneSignature());
             }
 
-            //IMPL_TYPED_CHILD(Signature);
-            // Need customized setter.
-        protected:
             Signature* m_Signature;
             list<XMLObject*>::iterator m_pos_Signature;
         public:
             Signature* getSignature() const {
                 return m_Signature;
             }
-            
+
             void setSignature(Signature* sig) {
                 prepareForAssignment(m_Signature,sig);
                 *m_pos_Signature=m_Signature=sig;
@@ -661,89 +753,130 @@ namespace opensaml {
                     m_Signature->setContentReference(new opensaml::ContentReference(*this));
             }
 
+            ResponseAbstractType* cloneResponseAbstractType() const {
+                return dynamic_cast<ResponseAbstractType*>(clone());
+            }
+
             IMPL_INTEGER_ATTRIB(MinorVersion);
-            IMPL_ID_ATTRIB(ResponseID);
+            IMPL_STRING_ATTRIB(ResponseID);    // have to special-case getXMLID
+            const XMLCh* getXMLID() const {
+                pair<bool,int> v = getMinorVersion();
+                return (!v.first || v.second > 0) ? m_ResponseID : nullptr;
+            }
+            const XMLCh* getID() const {
+                return getResponseID();
+            }
+            void releaseDOM() const {
+                if (getDOM())
+                    getDOM()->removeAttributeNS(nullptr, RESPONSEID_ATTRIB_NAME);
+                AbstractDOMCachingXMLObject::releaseDOM();
+            }
             IMPL_STRING_ATTRIB(InResponseTo);
             IMPL_DATETIME_ATTRIB(IssueInstant,0);
             IMPL_STRING_ATTRIB(Recipient);
-    
+
         protected:
+            void prepareForMarshalling() const {
+                if (m_Signature)
+                    declareNonVisibleNamespaces();
+            }
+
             void marshallAttributes(DOMElement* domElement) const {
                 static const XMLCh MAJORVERSION[] = UNICODE_LITERAL_12(M,a,j,o,r,V,e,r,s,i,o,n);
-                domElement->setAttributeNS(NULL,MAJORVERSION,XMLConstants::XML_ONE);
+                domElement->setAttributeNS(nullptr,MAJORVERSION,XML_ONE);
                 if (!m_MinorVersion)
-                    const_cast<ResponseAbstractTypeImpl*>(this)->m_MinorVersion=XMLString::replicate(XMLConstants::XML_ONE);
-                MARSHALL_INTEGER_ATTRIB(MinorVersion,MINORVERSION,NULL);
+                    const_cast<ResponseAbstractTypeImpl*>(this)->m_MinorVersion=XMLString::replicate(XML_ONE);
+                MARSHALL_INTEGER_ATTRIB(MinorVersion,MINORVERSION,nullptr);
                 if (!m_ResponseID)
                     const_cast<ResponseAbstractTypeImpl*>(this)->m_ResponseID=SAMLConfig::getConfig().generateIdentifier();
-                MARSHALL_ID_ATTRIB(ResponseID,RESPONSEID,NULL);
-                MARSHALL_STRING_ATTRIB(InResponseTo,INRESPONSETO,NULL);
+                domElement->setAttributeNS(nullptr, RESPONSEID_ATTRIB_NAME, m_ResponseID);
+                if (*m_MinorVersion!=chDigit_0) {
+#ifdef XMLTOOLING_XERCESC_BOOLSETIDATTRIBUTE
+                    domElement->setIdAttributeNS(nullptr, RESPONSEID_ATTRIB_NAME, true);
+#else
+                    domElement->setIdAttributeNS(nullptr, RESPONSEID_ATTRIB_NAME);
+#endif
+                }
+                MARSHALL_STRING_ATTRIB(InResponseTo,INRESPONSETO,nullptr);
                 if (!m_IssueInstant) {
-                    const_cast<ResponseAbstractTypeImpl*>(this)->m_IssueInstantEpoch=time(NULL);
+                    const_cast<ResponseAbstractTypeImpl*>(this)->m_IssueInstantEpoch=time(nullptr);
                     const_cast<ResponseAbstractTypeImpl*>(this)->m_IssueInstant=new DateTime(m_IssueInstantEpoch);
                 }
-                MARSHALL_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,NULL);
-                MARSHALL_STRING_ATTRIB(Recipient,RECIPIENT,NULL);
+                MARSHALL_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,nullptr);
+                MARSHALL_STRING_ATTRIB(Recipient,RECIPIENT,nullptr);
             }
 
             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
-                PROC_TYPED_CHILD(Signature,XMLConstants::XMLSIG_NS,false);
+                PROC_TYPED_CHILD(Signature,XMLSIG_NS,false);
                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
             }
 
+            void unmarshallAttributes(const DOMElement* domElement) {
+                // Standard processing, but then we check IDness.
+                AbstractXMLObjectUnmarshaller::unmarshallAttributes(domElement);
+                if (m_ResponseID && (!m_MinorVersion || *m_MinorVersion!=chDigit_0)) {
+#ifdef XMLTOOLING_XERCESC_BOOLSETIDATTRIBUTE
+                    const_cast<DOMElement*>(domElement)->setIdAttributeNS(nullptr, RESPONSEID_ATTRIB_NAME, true);
+#else
+                    const_cast<DOMElement*>(domElement)->setIdAttributeNS(nullptr, RESPONSEID_ATTRIB_NAME);
+#endif
+                }
+            }
+
             void processAttribute(const DOMAttr* attribute) {
                 static const XMLCh MAJORVERSION[] = UNICODE_LITERAL_12(M,a,j,o,r,V,e,r,s,i,o,n);
-                if (XMLHelper::isNodeNamed(attribute,NULL,MAJORVERSION)) {
-                    if (!XMLString::equals(attribute->getValue(),XMLConstants::XML_ONE))
+                if (XMLHelper::isNodeNamed(attribute,nullptr,MAJORVERSION)) {
+                    if (!XMLString::equals(attribute->getValue(),XML_ONE))
                         throw UnmarshallingException("Response has invalid major version.");
                 }
-                PROC_INTEGER_ATTRIB(MinorVersion,MINORVERSION,NULL);
-                PROC_ID_ATTRIB(ResponseID,RESPONSEID,NULL);
-                PROC_STRING_ATTRIB(InResponseTo,INRESPONSETO,NULL);
-                PROC_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,NULL);
-                PROC_STRING_ATTRIB(Recipient,RECIPIENT,NULL);
+                PROC_INTEGER_ATTRIB(MinorVersion,MINORVERSION,nullptr);
+                PROC_STRING_ATTRIB(ResponseID,RESPONSEID,nullptr);
+                PROC_STRING_ATTRIB(InResponseTo,INRESPONSETO,nullptr);
+                PROC_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,nullptr);
+                PROC_STRING_ATTRIB(Recipient,RECIPIENT,nullptr);
             }
         };
 
         class SAML_DLLLOCAL ResponseImpl : public virtual Response, public ResponseAbstractTypeImpl
         {
             void init() {
-                m_children.push_back(NULL);
-                m_Status=NULL;
+                m_children.push_back(nullptr);
+                m_Status=nullptr;
                 m_pos_Status=m_pos_Signature;
                 ++m_pos_Status;
             }
+
         public:
             virtual ~ResponseImpl() {}
-    
-            ResponseImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
-                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+
+            ResponseImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
+                    : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
                 init();
             }
-                
+
             ResponseImpl(const ResponseImpl& src) : AbstractXMLObject(src), ResponseAbstractTypeImpl(src) {
                 init();
+            }
+
+            void _clone(const ResponseImpl& src) {
+                ResponseAbstractTypeImpl::_clone(src);
                 if (src.getStatus())
                     setStatus(src.getStatus()->cloneStatus());
-                VectorOf(Assertion) v=getAssertions();
-                for (vector<Assertion*>::const_iterator i=src.m_Assertions.begin(); i!=src.m_Assertions.end(); i++) {
+                for (vector<saml1::Assertion*>::const_iterator i=src.m_Assertions.begin(); i!=src.m_Assertions.end(); i++) {
                     if (*i) {
-                        v.push_back((*i)->cloneAssertion());
+                        getAssertions().push_back((*i)->cloneAssertion());
                     }
                 }
             }
-            
-            IMPL_XMLOBJECT_CLONE(Response);
-            ResponseAbstractType* cloneResponseAbstractType() const {
-                return cloneResponse();
-            }
+
+            IMPL_XMLOBJECT_CLONE_EX(Response);
             IMPL_TYPED_CHILD(Status);
-            IMPL_TYPED_CHILDREN(Assertion, m_children.end());
-    
+            IMPL_TYPED_FOREIGN_CHILDREN(Assertion,saml1,m_children.end());
+
         protected:
             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
-                PROC_TYPED_CHILD(Status,SAMLConstants::SAML1P_NS,false);
-                PROC_TYPED_CHILDREN(Assertion,SAMLConstants::SAML1_NS,true);
+                PROC_TYPED_CHILD(Status,SAML1P_NS,false);
+                PROC_TYPED_FOREIGN_CHILDREN(Assertion,saml1,SAML1_NS,true);
                 ResponseAbstractTypeImpl::processChildElement(childXMLObject,root);
             }
         };
@@ -761,6 +894,7 @@ IMPL_XMLOBJECTBUILDER(AssertionArtifact);
 IMPL_XMLOBJECTBUILDER(AttributeQuery);
 IMPL_XMLOBJECTBUILDER(AuthenticationQuery);
 IMPL_XMLOBJECTBUILDER(AuthorizationDecisionQuery);
+IMPL_XMLOBJECTBUILDER(Query);
 IMPL_XMLOBJECTBUILDER(Request);
 IMPL_XMLOBJECTBUILDER(RespondWith);
 IMPL_XMLOBJECTBUILDER(Response);
@@ -815,8 +949,8 @@ const XMLCh _SUCCESS[] =                                    UNICODE_LITERAL_7(S,
 const XMLCh _REQUESTER[] =                                  UNICODE_LITERAL_9(R,e,q,u,e,s,t,e,r);
 const XMLCh _RESPONDER[] =                                  UNICODE_LITERAL_9(R,e,s,p,o,n,d,e,r);
 const XMLCh _VERSIONMISMATCH[] =                            UNICODE_LITERAL_15(V,e,r,s,i,o,n,M,i,s,m,a,t,c,h);
-QName StatusCode::SUCCESS(SAMLConstants::SAML1P_NS,_SUCCESS,SAMLConstants::SAML1P_PREFIX);
-QName StatusCode::REQUESTER(SAMLConstants::SAML1P_NS,_REQUESTER,SAMLConstants::SAML1P_PREFIX);
-QName StatusCode::RESPONDER(SAMLConstants::SAML1P_NS,_RESPONDER,SAMLConstants::SAML1P_PREFIX);
-QName StatusCode::VERSIONMISMATCH(SAMLConstants::SAML1P_NS,_VERSIONMISMATCH,SAMLConstants::SAML1P_PREFIX);
+
+xmltooling::QName StatusCode::SUCCESS(SAML1P_NS,_SUCCESS,SAML1P_PREFIX);
+xmltooling::QName StatusCode::REQUESTER(SAML1P_NS,_REQUESTER,SAML1P_PREFIX);
+xmltooling::QName StatusCode::RESPONDER(SAML1P_NS,_RESPONDER,SAML1P_PREFIX);
+xmltooling::QName StatusCode::VERSIONMISMATCH(SAML1P_NS,_VERSIONMISMATCH,SAML1P_PREFIX);