https://issues.shibboleth.net/jira/browse/CPPOST-71
[shibboleth/cpp-opensaml.git] / saml / saml2 / metadata / impl / MetadataImpl.cpp
index aad9bf3..be7815e 100644 (file)
@@ -1,43 +1,55 @@
-/*
- *  Copyright 2001-2007 Internet2
+/**
+ * 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.
  *
- * 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
+ * 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.
  */
 
 /**
  * MetadataImpl.cpp
  *
- * Implementation classes for SAML 2.0 Assertions schema
+ * Implementation classes for SAML 2.0 Metadata schema.
  */
 
 #include "internal.h"
 #include "exceptions.h"
 #include "saml2/metadata/Metadata.h"
+#include "signature/ContentReference.h"
 
 #include <xmltooling/AbstractComplexElement.h>
 #include <xmltooling/AbstractSimpleElement.h>
+#include <xmltooling/XMLToolingConfig.h>
+#include <xmltooling/encryption/Encryption.h>
 #include <xmltooling/impl/AnyElement.h>
 #include <xmltooling/io/AbstractXMLObjectMarshaller.h>
 #include <xmltooling/io/AbstractXMLObjectUnmarshaller.h>
+#include <xmltooling/security/CredentialCriteria.h>
+#include <xmltooling/security/CredentialResolver.h>
+#include <xmltooling/signature/KeyInfo.h>
+#include <xmltooling/signature/Signature.h>
+#include <xmltooling/util/DateTime.h>
 #include <xmltooling/util/XMLHelper.h>
 
 #include <ctime>
 #include <xercesc/util/XMLUniDefs.hpp>
+#include <xsec/framework/XSECDefs.hpp>
 
 using namespace samlconstants;
 using namespace opensaml::saml2md;
 using namespace opensaml::saml2;
-using namespace opensaml;
 using namespace xmlencryption;
 using namespace xmlsignature;
 using namespace xmltooling;
@@ -64,6 +76,9 @@ namespace opensaml {
 
         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,ActionNamespace);
         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,SourceID);
+        DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,IPHint);
+        DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,DomainHint);
+        DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,GeolocationHint);
 
         class SAML_DLLLOCAL localizedNameTypeImpl : public virtual localizedNameType,
             public AbstractSimpleElement,
@@ -72,8 +87,8 @@ namespace opensaml {
             public AbstractXMLObjectUnmarshaller
         {
             void init() {
-                m_Lang=NULL;
-                m_LangPrefix=NULL;
+                m_Lang=nullptr;
+                m_LangPrefix=nullptr;
             }
 
         protected:
@@ -95,20 +110,25 @@ namespace opensaml {
             localizedNameTypeImpl(const localizedNameTypeImpl& src)
                     : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
                 init();
+            }
+
+            void _clone(const localizedNameTypeImpl& src) {
                 setLang(src.getLang());
                 if (src.m_LangPrefix)
                     m_LangPrefix = XMLString::replicate(src.m_LangPrefix);
             }
 
-            IMPL_XMLOBJECT_CLONE(localizedNameType);
+            IMPL_XMLOBJECT_CLONE_EX(localizedNameType);
             IMPL_XMLOBJECT_FOREIGN_ATTRIB(Lang,XMLCh);
 
         protected:
             void marshallAttributes(DOMElement* domElement) const {
                 if (m_Lang && *m_Lang) {
-                    DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(xmlconstants::XML_NS,LANG_ATTRIB_NAME);
+                    DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(xmlconstants::XML_NS, LANG_ATTRIB_NAME);
                     if (m_LangPrefix && *m_LangPrefix)
                         attr->setPrefix(m_LangPrefix);
+                    else
+                        attr->setPrefix(xmlconstants::XML_PREFIX);
                     attr->setNodeValue(m_Lang);
                     domElement->setAttributeNodeNS(attr);
                 }
@@ -133,8 +153,8 @@ namespace opensaml {
             public AbstractXMLObjectUnmarshaller
         {
             void init() {
-                m_Lang=NULL;
-                m_LangPrefix=NULL;
+                m_Lang=nullptr;
+                m_LangPrefix=nullptr;
             }
 
         protected:
@@ -156,20 +176,25 @@ namespace opensaml {
             localizedURITypeImpl(const localizedURITypeImpl& src)
                     : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
                 init();
+            }
+
+            void _clone(const localizedURITypeImpl& src) {
                 setLang(src.getLang());
                 if (src.m_LangPrefix)
                     m_LangPrefix = XMLString::replicate(src.m_LangPrefix);
             }
 
-            IMPL_XMLOBJECT_CLONE(localizedURIType);
+            IMPL_XMLOBJECT_CLONE_EX(localizedURIType);
             IMPL_XMLOBJECT_FOREIGN_ATTRIB(Lang,XMLCh);
 
         protected:
             void marshallAttributes(DOMElement* domElement) const {
                 if (m_Lang && *m_Lang) {
-                    DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(xmlconstants::XML_NS,LANG_ATTRIB_NAME);
+                    DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(xmlconstants::XML_NS, LANG_ATTRIB_NAME);
                     if (m_LangPrefix && *m_LangPrefix)
                         attr->setPrefix(m_LangPrefix);
+                    else
+                        attr->setPrefix(xmlconstants::XML_PREFIX);
                     attr->setNodeValue(m_Lang);
                     domElement->setAttributeNodeNS(attr);
                 }
@@ -197,10 +222,7 @@ namespace opensaml {
 
             OrganizationNameImpl(const OrganizationNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
 
-            IMPL_XMLOBJECT_CLONE(OrganizationName);
-            localizedNameType* clonelocalizedNameType() const {
-                return new OrganizationNameImpl(*this);
-            }
+            IMPL_XMLOBJECT_CLONE_EX(OrganizationName);
         };
 
         class SAML_DLLLOCAL OrganizationDisplayNameImpl : public virtual OrganizationDisplayName, public localizedNameTypeImpl
@@ -213,10 +235,7 @@ namespace opensaml {
 
             OrganizationDisplayNameImpl(const OrganizationDisplayNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
 
-            IMPL_XMLOBJECT_CLONE(OrganizationDisplayName);
-            localizedNameType* clonelocalizedNameType() const {
-                return new OrganizationDisplayNameImpl(*this);
-            }
+            IMPL_XMLOBJECT_CLONE_EX(OrganizationDisplayName);
         };
 
         class SAML_DLLLOCAL OrganizationURLImpl : public virtual OrganizationURL, public localizedURITypeImpl
@@ -229,10 +248,7 @@ namespace opensaml {
 
             OrganizationURLImpl(const OrganizationURLImpl& src) : AbstractXMLObject(src), localizedURITypeImpl(src) {}
 
-            IMPL_XMLOBJECT_CLONE(OrganizationURL);
-            localizedURIType* clonelocalizedURIType() const {
-                return new OrganizationURLImpl(*this);
-            }
+            IMPL_XMLOBJECT_CLONE_EX(OrganizationURL);
         };
 
         class SAML_DLLLOCAL ServiceNameImpl : public virtual ServiceName, public localizedNameTypeImpl
@@ -245,10 +261,7 @@ namespace opensaml {
 
             ServiceNameImpl(const ServiceNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
 
-            IMPL_XMLOBJECT_CLONE(ServiceName);
-            localizedNameType* clonelocalizedNameType() const {
-                return new ServiceNameImpl(*this);
-            }
+            IMPL_XMLOBJECT_CLONE_EX(ServiceName);
         };
 
         class SAML_DLLLOCAL ServiceDescriptionImpl : public virtual ServiceDescription, public localizedNameTypeImpl
@@ -261,10 +274,7 @@ namespace opensaml {
 
             ServiceDescriptionImpl(const ServiceDescriptionImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
 
-            IMPL_XMLOBJECT_CLONE(ServiceDescription);
-            localizedNameType* clonelocalizedNameType() const {
-                return new ServiceDescriptionImpl(*this);
-            }
+            IMPL_XMLOBJECT_CLONE_EX(ServiceDescription);
         };
 
         class SAML_DLLLOCAL ExtensionsImpl : public virtual Extensions,
@@ -282,9 +292,11 @@ namespace opensaml {
 
             ExtensionsImpl(const ExtensionsImpl& src)
                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
-                VectorOf(XMLObject) v=getUnknownXMLObjects();
-                for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
-                    v.push_back((*i)->clone());
+                for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) {
+                    if (*i) {
+                        getUnknownXMLObjects().push_back((*i)->clone());
+                    }
+                }
             }
 
             IMPL_XMLOBJECT_CLONE(Extensions);
@@ -314,16 +326,17 @@ namespace opensaml {
             list<XMLObject*>::iterator m_pos_OrganizationURL;
 
             void init() {
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
-                m_Extensions=NULL;
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
+                m_Extensions=nullptr;
                 m_pos_Extensions=m_children.begin();
                 m_pos_OrganizationDisplayName=m_pos_Extensions;
                 ++m_pos_OrganizationDisplayName;
                 m_pos_OrganizationURL=m_pos_OrganizationDisplayName;
                 ++m_pos_OrganizationURL;
             }
+
         public:
             virtual ~OrganizationImpl() {}
 
@@ -338,22 +351,19 @@ namespace opensaml {
                 init();
                 if (src.getExtensions())
                     setExtensions(src.getExtensions()->cloneExtensions());
-                VectorOf(OrganizationName) v=getOrganizationNames();
                 for (vector<OrganizationName*>::const_iterator i=src.m_OrganizationNames.begin(); i!=src.m_OrganizationNames.end(); i++) {
                     if (*i) {
-                        v.push_back((*i)->cloneOrganizationName());
+                        getOrganizationNames().push_back((*i)->cloneOrganizationName());
                     }
                 }
-                VectorOf(OrganizationDisplayName) w=getOrganizationDisplayNames();
                 for (vector<OrganizationDisplayName*>::const_iterator j=src.m_OrganizationDisplayNames.begin(); j!=src.m_OrganizationDisplayNames.end(); j++) {
                     if (*j) {
-                        w.push_back((*j)->cloneOrganizationDisplayName());
+                        getOrganizationDisplayNames().push_back((*j)->cloneOrganizationDisplayName());
                     }
                 }
-                VectorOf(OrganizationURL) x=getOrganizationURLs();
                 for (vector<OrganizationURL*>::const_iterator k=src.m_OrganizationURLs.begin(); k!=src.m_OrganizationURLs.end(); k++) {
                     if (*k) {
-                        x.push_back((*k)->cloneOrganizationURL());
+                        getOrganizationURLs().push_back((*k)->cloneOrganizationURL());
                     }
                 }
             }
@@ -392,16 +402,16 @@ namespace opensaml {
             list<XMLObject*>::iterator m_pos_TelephoneNumber;
 
             void init() {
-                m_ContactType=NULL;
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
-                m_Extensions=NULL;
-                m_Company=NULL;
-                m_GivenName=NULL;
-                m_SurName=NULL;
+                m_ContactType=nullptr;
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
+                m_Extensions=nullptr;
+                m_Company=nullptr;
+                m_GivenName=nullptr;
+                m_SurName=nullptr;
                 m_pos_Extensions=m_children.begin();
                 m_pos_Company=m_pos_Extensions;
                 ++m_pos_Company;
@@ -412,6 +422,7 @@ namespace opensaml {
                 m_pos_TelephoneNumber=m_pos_SurName;
                 ++m_pos_TelephoneNumber;
             }
+
         public:
             virtual ~ContactPersonImpl() {
                 XMLString::release(&m_ContactType);
@@ -435,16 +446,14 @@ namespace opensaml {
                 if (src.getSurName())
                     setSurName(src.getSurName()->cloneSurName());
 
-                VectorOf(EmailAddress) v=getEmailAddresss();
                 for (vector<EmailAddress*>::const_iterator i=src.m_EmailAddresss.begin(); i!=src.m_EmailAddresss.end(); i++) {
                     if (*i) {
-                        v.push_back((*i)->cloneEmailAddress());
+                        getEmailAddresss().push_back((*i)->cloneEmailAddress());
                     }
                 }
-                VectorOf(TelephoneNumber) w=getTelephoneNumbers();
                 for (vector<TelephoneNumber*>::const_iterator j=src.m_TelephoneNumbers.begin(); j!=src.m_TelephoneNumbers.end(); j++) {
                     if (*j) {
-                        w.push_back((*j)->cloneTelephoneNumber());
+                        getTelephoneNumbers().push_back((*j)->cloneTelephoneNumber());
                     }
                 }
             }
@@ -470,7 +479,7 @@ namespace opensaml {
 
         protected:
             void marshallAttributes(DOMElement* domElement) const {
-                MARSHALL_STRING_ATTRIB(ContactType,CONTACTTYPE,NULL);
+                MARSHALL_STRING_ATTRIB(ContactType,CONTACTTYPE,nullptr);
                 marshallExtensionAttributes(domElement);
             }
 
@@ -496,7 +505,7 @@ namespace opensaml {
             public AbstractXMLObjectUnmarshaller
         {
             void init() {
-                m_Namespace=NULL;
+                m_Namespace=nullptr;
             }
 
         public:
@@ -512,6 +521,7 @@ namespace opensaml {
             AdditionalMetadataLocationImpl(const AdditionalMetadataLocationImpl& src)
                     : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
                 init();
+                setNamespace(src.getNamespace());
             }
 
             IMPL_XMLOBJECT_CLONE(AdditionalMetadataLocation);
@@ -519,11 +529,11 @@ namespace opensaml {
 
         protected:
             void marshallAttributes(DOMElement* domElement) const {
-                MARSHALL_STRING_ATTRIB(Namespace,NAMESPACE,NULL);
+                MARSHALL_STRING_ATTRIB(Namespace,NAMESPACE,nullptr);
             }
 
             void processAttribute(const DOMAttr* attribute) {
-                PROC_STRING_ATTRIB(Namespace,NAMESPACE,NULL);
+                PROC_STRING_ATTRIB(Namespace,NAMESPACE,nullptr);
                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
             }
         };
@@ -535,11 +545,12 @@ namespace opensaml {
             public AbstractXMLObjectUnmarshaller
         {
                void init() {
-                m_Use=NULL;
-                m_KeyInfo=NULL;
-                m_children.push_back(NULL);
+                m_Use=nullptr;
+                m_KeyInfo=nullptr;
+                m_children.push_back(nullptr);
                 m_pos_KeyInfo=m_children.begin();
            }
+
         public:
             virtual ~KeyDescriptorImpl() {
                 XMLString::release(&m_Use);
@@ -556,10 +567,9 @@ namespace opensaml {
                 setUse(src.getUse());
                 if (src.getKeyInfo())
                     setKeyInfo(src.getKeyInfo()->cloneKeyInfo());
-                VectorOf(EncryptionMethod) v=getEncryptionMethods();
                 for (vector<EncryptionMethod*>::const_iterator i=src.m_EncryptionMethods.begin(); i!=src.m_EncryptionMethods.end(); i++) {
                     if (*i) {
-                        v.push_back((*i)->cloneEncryptionMethod());
+                        getEncryptionMethods().push_back((*i)->cloneEncryptionMethod());
                     }
                 }
             }
@@ -571,7 +581,7 @@ namespace opensaml {
 
         protected:
             void marshallAttributes(DOMElement* domElement) const {
-                MARSHALL_STRING_ATTRIB(Use,USE,NULL);
+                MARSHALL_STRING_ATTRIB(Use,USE,nullptr);
             }
 
             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
@@ -581,7 +591,7 @@ namespace opensaml {
             }
 
             void processAttribute(const DOMAttr* attribute) {
-                PROC_STRING_ATTRIB(Use,USE,NULL);
+                PROC_STRING_ATTRIB(Use,USE,nullptr);
                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
             }
         };
@@ -594,7 +604,7 @@ namespace opensaml {
             public AbstractXMLObjectUnmarshaller
         {
             void init() {
-                m_Binding=m_Location=m_ResponseLocation=NULL;
+                m_Binding=m_Location=m_ResponseLocation=nullptr;
             }
 
         protected:
@@ -610,7 +620,8 @@ namespace opensaml {
             }
 
             EndpointTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
-                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+                    : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+                init();
             }
 
             EndpointTypeImpl(const EndpointTypeImpl& src)
@@ -618,15 +629,21 @@ namespace opensaml {
                         AbstractAttributeExtensibleXMLObject(src),
                         AbstractComplexElement(src),
                         AbstractDOMCachingXMLObject(src) {
+                init();
+            }
+
+            void _clone(const EndpointTypeImpl& src) {
                 setBinding(src.getBinding());
                 setLocation(src.getLocation());
                 setResponseLocation(src.getResponseLocation());
-                VectorOf(XMLObject) v=getUnknownXMLObjects();
-                for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
-                    v.push_back((*i)->clone());
+                for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) {
+                    if (*i) {
+                        getUnknownXMLObjects().push_back((*i)->clone());
+                    }
+                }
             }
 
-            IMPL_XMLOBJECT_CLONE(EndpointType);
+            IMPL_XMLOBJECT_CLONE_EX(EndpointType);
             IMPL_STRING_ATTRIB(Binding);
             IMPL_STRING_ATTRIB(Location);
             IMPL_STRING_ATTRIB(ResponseLocation);
@@ -651,9 +668,9 @@ namespace opensaml {
             }
         protected:
             void marshallAttributes(DOMElement* domElement) const {
-                MARSHALL_STRING_ATTRIB(Binding,BINDING,NULL);
-                MARSHALL_STRING_ATTRIB(Location,LOCATION,NULL);
-                MARSHALL_STRING_ATTRIB(ResponseLocation,RESPONSELOCATION,NULL);
+                MARSHALL_STRING_ATTRIB(Binding,BINDING,nullptr);
+                MARSHALL_STRING_ATTRIB(Location,LOCATION,nullptr);
+                MARSHALL_STRING_ATTRIB(ResponseLocation,RESPONSELOCATION,nullptr);
                 marshallExtensionAttributes(domElement);
             }
 
@@ -675,7 +692,7 @@ namespace opensaml {
         class SAML_DLLLOCAL IndexedEndpointTypeImpl : public virtual IndexedEndpointType, public EndpointTypeImpl
         {
             void init() {
-                m_Index=NULL;
+                m_Index=nullptr;
                 m_isDefault=XML_BOOL_NULL;
             }
 
@@ -689,18 +706,21 @@ namespace opensaml {
             }
 
             IndexedEndpointTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
-                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
+                    : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+                init();
+            }
 
             IndexedEndpointTypeImpl(const IndexedEndpointTypeImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {
-                setIndex(src.m_Index);
-                isDefault(src.m_isDefault);
+                init();
             }
 
-            IMPL_XMLOBJECT_CLONE(IndexedEndpointType);
-            EndpointType* cloneEndpointType() const {
-                return new IndexedEndpointTypeImpl(*this);
+            void _clone(const IndexedEndpointTypeImpl& src) {
+                EndpointTypeImpl::_clone(src);
+                setIndex(src.m_Index);
+                isDefault(src.m_isDefault);
             }
 
+            IMPL_XMLOBJECT_CLONE_EX(IndexedEndpointType);
             IMPL_INTEGER_ATTRIB(Index);
             IMPL_BOOLEAN_ATTRIB(isDefault);
 
@@ -720,8 +740,8 @@ namespace opensaml {
 
         protected:
             void marshallAttributes(DOMElement* domElement) const {
-                MARSHALL_INTEGER_ATTRIB(Index,INDEX,NULL);
-                MARSHALL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,NULL);
+                MARSHALL_INTEGER_ATTRIB(Index,INDEX,nullptr);
+                MARSHALL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,nullptr);
                 EndpointTypeImpl::marshallAttributes(domElement);
             }
         };
@@ -736,13 +756,7 @@ namespace opensaml {
 
             ArtifactResolutionServiceImpl(const ArtifactResolutionServiceImpl& src) : AbstractXMLObject(src), IndexedEndpointTypeImpl(src) {}
 
-            IMPL_XMLOBJECT_CLONE(ArtifactResolutionService);
-            IndexedEndpointType* cloneIndexedEndpointType() const {
-                return new ArtifactResolutionServiceImpl(*this);
-            }
-            EndpointType* cloneEndpointType() const {
-                return new ArtifactResolutionServiceImpl(*this);
-            }
+            IMPL_XMLOBJECT_CLONE_EX(ArtifactResolutionService);
         };
 
         class SAML_DLLLOCAL SingleLogoutServiceImpl : public virtual SingleLogoutService, public EndpointTypeImpl
@@ -755,10 +769,7 @@ namespace opensaml {
 
             SingleLogoutServiceImpl(const SingleLogoutServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
 
-            IMPL_XMLOBJECT_CLONE(SingleLogoutService);
-            EndpointType* cloneEndpointType() const {
-                return new SingleLogoutServiceImpl(*this);
-            }
+            IMPL_XMLOBJECT_CLONE_EX(SingleLogoutService);
         };
 
         class SAML_DLLLOCAL ManageNameIDServiceImpl : public virtual ManageNameIDService, public EndpointTypeImpl
@@ -771,10 +782,7 @@ namespace opensaml {
 
             ManageNameIDServiceImpl(const ManageNameIDServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
 
-            IMPL_XMLOBJECT_CLONE(ManageNameIDService);
-            EndpointType* cloneEndpointType() const {
-                return new ManageNameIDServiceImpl(*this);
-            }
+            IMPL_XMLOBJECT_CLONE_EX(ManageNameIDService);
         };
 
         class SAML_DLLLOCAL SingleSignOnServiceImpl : public virtual SingleSignOnService, public EndpointTypeImpl
@@ -787,10 +795,7 @@ namespace opensaml {
 
             SingleSignOnServiceImpl(const SingleSignOnServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
 
-            IMPL_XMLOBJECT_CLONE(SingleSignOnService);
-            EndpointType* cloneEndpointType() const {
-                return new SingleSignOnServiceImpl(*this);
-            }
+            IMPL_XMLOBJECT_CLONE_EX(SingleSignOnService);
         };
 
         class SAML_DLLLOCAL NameIDMappingServiceImpl : public virtual NameIDMappingService, public EndpointTypeImpl
@@ -803,10 +808,7 @@ namespace opensaml {
 
             NameIDMappingServiceImpl(const NameIDMappingServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
 
-            IMPL_XMLOBJECT_CLONE(NameIDMappingService);
-            EndpointType* cloneEndpointType() const {
-                return new NameIDMappingServiceImpl(*this);
-            }
+            IMPL_XMLOBJECT_CLONE_EX(NameIDMappingService);
         };
 
         class SAML_DLLLOCAL AssertionIDRequestServiceImpl : public virtual AssertionIDRequestService, public EndpointTypeImpl
@@ -819,10 +821,7 @@ namespace opensaml {
 
             AssertionIDRequestServiceImpl(const AssertionIDRequestServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
 
-            IMPL_XMLOBJECT_CLONE(AssertionIDRequestService);
-            EndpointType* cloneEndpointType() const {
-                return new AssertionIDRequestServiceImpl(*this);
-            }
+            IMPL_XMLOBJECT_CLONE_EX(AssertionIDRequestService);
         };
 
         class SAML_DLLLOCAL AssertionConsumerServiceImpl : public virtual AssertionConsumerService, public IndexedEndpointTypeImpl
@@ -835,13 +834,7 @@ namespace opensaml {
 
             AssertionConsumerServiceImpl(const AssertionConsumerServiceImpl& src) : AbstractXMLObject(src), IndexedEndpointTypeImpl(src) {}
 
-            IMPL_XMLOBJECT_CLONE(AssertionConsumerService);
-            EndpointType* cloneEndpointType() const {
-                return new AssertionConsumerServiceImpl(*this);
-            }
-            IndexedEndpointType* cloneIndexedEndpointType() const {
-                return new AssertionConsumerServiceImpl(*this);
-            }
+            IMPL_XMLOBJECT_CLONE_EX(AssertionConsumerService);
         };
 
         class SAML_DLLLOCAL AuthnQueryServiceImpl : public virtual AuthnQueryService, public EndpointTypeImpl
@@ -854,10 +847,7 @@ namespace opensaml {
 
             AuthnQueryServiceImpl(const AuthnQueryServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
 
-            IMPL_XMLOBJECT_CLONE(AuthnQueryService);
-            EndpointType* cloneEndpointType() const {
-                return new AuthnQueryServiceImpl(*this);
-            }
+            IMPL_XMLOBJECT_CLONE_EX(AuthnQueryService);
         };
 
         class SAML_DLLLOCAL AuthzServiceImpl : public virtual AuthzService, public EndpointTypeImpl
@@ -870,10 +860,7 @@ namespace opensaml {
 
             AuthzServiceImpl(const AuthzServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
 
-            IMPL_XMLOBJECT_CLONE(AuthzService);
-            EndpointType* cloneEndpointType() const {
-                return new AuthzServiceImpl(*this);
-            }
+            IMPL_XMLOBJECT_CLONE_EX(AuthzService);
         };
 
         class SAML_DLLLOCAL AttributeServiceImpl : public virtual AttributeService, public EndpointTypeImpl
@@ -886,10 +873,7 @@ namespace opensaml {
 
             AttributeServiceImpl(const AttributeServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
 
-            IMPL_XMLOBJECT_CLONE(AttributeService);
-            EndpointType* cloneEndpointType() const {
-                return new AttributeServiceImpl(*this);
-            }
+            IMPL_XMLOBJECT_CLONE_EX(AttributeService);
         };
 
         class SAML_DLLLOCAL RoleDescriptorImpl : public virtual RoleDescriptor,
@@ -901,15 +885,15 @@ namespace opensaml {
             public AbstractXMLObjectUnmarshaller
         {
             void init() {
-                m_ID=m_ProtocolSupportEnumeration=m_ErrorURL=NULL;
-                m_ValidUntil=m_CacheDuration=NULL;
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
-                m_Signature=NULL;
-                m_Extensions=NULL;
-                m_Organization=NULL;
+                m_ID=m_ProtocolSupportEnumeration=m_ErrorURL=nullptr;
+                m_ValidUntil=m_CacheDuration=nullptr;
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
+                m_Signature=nullptr;
+                m_Extensions=nullptr;
+                m_Organization=nullptr;
                 m_pos_Signature=m_children.begin();
                 m_pos_Extensions=m_pos_Signature;
                 ++m_pos_Extensions;
@@ -944,6 +928,9 @@ namespace opensaml {
                     : AbstractXMLObject(src), AbstractComplexElement(src),
                         AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
                 init();
+            }
+
+            void _clone(const RoleDescriptorImpl& src) {
                 setID(src.getID());
                 setProtocolSupportEnumeration(src.getProtocolSupportEnumeration());
                 setErrorURL(src.getErrorURL());
@@ -956,16 +943,14 @@ namespace opensaml {
                 if (src.getOrganization())
                     setOrganization(src.getOrganization()->cloneOrganization());
 
-                VectorOf(KeyDescriptor) v=getKeyDescriptors();
                 for (vector<KeyDescriptor*>::const_iterator i=src.m_KeyDescriptors.begin(); i!=src.m_KeyDescriptors.end(); i++) {
                     if (*i) {
-                        v.push_back((*i)->cloneKeyDescriptor());
+                        getKeyDescriptors().push_back((*i)->cloneKeyDescriptor());
                     }
                 }
-                VectorOf(ContactPerson) w=getContactPersons();
                 for (vector<ContactPerson*>::const_iterator j=src.m_ContactPersons.begin(); j!=src.m_ContactPersons.end(); j++) {
                     if (*j) {
-                        w.push_back((*j)->cloneContactPerson());
+                        getContactPersons().push_back((*j)->cloneContactPerson());
                     }
                 }
             }
@@ -988,7 +973,11 @@ namespace opensaml {
                     m_Signature->setContentReference(new opensaml::ContentReference(*this));
             }
 
-            IMPL_ID_ATTRIB(ID);
+            RoleDescriptor* cloneRoleDescriptor() const {
+                return dynamic_cast<RoleDescriptor*>(clone());
+            }
+
+            IMPL_ID_ATTRIB_EX(ID,ID,nullptr);
             IMPL_STRING_ATTRIB(ProtocolSupportEnumeration);
             IMPL_STRING_ATTRIB(ErrorURL);
             IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
@@ -1003,8 +992,8 @@ namespace opensaml {
                     return true;
                 if (m_ProtocolSupportEnumeration) {
                     // Look for first character.
-                    unsigned int len=XMLString::stringLen(protocol);
-                    unsigned int pos=0;
+                    xsecsize_t len=XMLString::stringLen(protocol);
+                    xsecsize_t pos=0;
                     int index=XMLString::indexOf(m_ProtocolSupportEnumeration,protocol[0],pos);
                     while (index>=0) {
                         // Only possible match is if it's the first character or a space comes before it.
@@ -1081,12 +1070,17 @@ namespace opensaml {
             }
 
         protected:
+            void prepareForMarshalling() const {
+                if (m_Signature)
+                    declareNonVisibleNamespaces();
+            }
+
             void marshallAttributes(DOMElement* domElement) const {
-                MARSHALL_ID_ATTRIB(ID,ID,NULL);
-                MARSHALL_STRING_ATTRIB(ProtocolSupportEnumeration,PROTOCOLSUPPORTENUMERATION,NULL);
-                MARSHALL_STRING_ATTRIB(ErrorURL,ERRORURL,NULL);
-                MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,NULL);
-                MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,NULL);
+                MARSHALL_ID_ATTRIB(ID,ID,nullptr);
+                MARSHALL_STRING_ATTRIB(ProtocolSupportEnumeration,PROTOCOLSUPPORTENUMERATION,nullptr);
+                MARSHALL_STRING_ATTRIB(ErrorURL,ERRORURL,nullptr);
+                MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,nullptr);
+                MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,nullptr);
                 marshallExtensionAttributes(domElement);
             }
 
@@ -1100,7 +1094,7 @@ namespace opensaml {
             }
 
             void processAttribute(const DOMAttr* attribute) {
-                PROC_ID_ATTRIB(ID,ID,NULL);
+                PROC_ID_ATTRIB(ID,ID,nullptr);
                 unmarshallExtensionAttribute(attribute);
             }
         };
@@ -1115,16 +1109,18 @@ namespace opensaml {
             }
 
             RoleDescriptorTypeImpl(const RoleDescriptorTypeImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
-                VectorOf(XMLObject) v=getUnknownXMLObjects();
-                for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
-                    v.push_back((*i)->clone());
             }
 
-            IMPL_XMLOBJECT_CLONE(RoleDescriptorType);
-            RoleDescriptor* cloneRoleDescriptor() const {
-                return new RoleDescriptorTypeImpl(*this);
+            void _clone(const RoleDescriptorTypeImpl& src) {
+                RoleDescriptorImpl::_clone(src);
+                for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) {
+                    if (*i) {
+                        getUnknownXMLObjects().push_back((*i)->clone());
+                    }
+                }
             }
 
+            IMPL_XMLOBJECT_CLONE_EX(RoleDescriptorType);
             IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
 
         protected:
@@ -1136,10 +1132,10 @@ namespace opensaml {
         class SAML_DLLLOCAL SSODescriptorTypeImpl : public virtual SSODescriptorType, public RoleDescriptorImpl
         {
             void init() {
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
                 m_pos_ArtifactResolutionService=m_pos_ContactPerson;
                 ++m_pos_ArtifactResolutionService;
                 m_pos_SingleLogoutService=m_pos_ArtifactResolutionService;
@@ -1170,32 +1166,36 @@ namespace opensaml {
 
             SSODescriptorTypeImpl(const SSODescriptorTypeImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
                 init();
-                VectorOf(ArtifactResolutionService) v=getArtifactResolutionServices();
+            }
+
+            void _clone(const SSODescriptorTypeImpl& src) {
+                RoleDescriptorImpl::_clone(src);
                 for (vector<ArtifactResolutionService*>::const_iterator i=src.m_ArtifactResolutionServices.begin(); i!=src.m_ArtifactResolutionServices.end(); i++) {
                     if (*i) {
-                        v.push_back((*i)->cloneArtifactResolutionService());
+                        getArtifactResolutionServices().push_back((*i)->cloneArtifactResolutionService());
                     }
                 }
-                VectorOf(SingleLogoutService) w=getSingleLogoutServices();
                 for (vector<SingleLogoutService*>::const_iterator j=src.m_SingleLogoutServices.begin(); j!=src.m_SingleLogoutServices.end(); j++) {
                     if (*j) {
-                        w.push_back((*j)->cloneSingleLogoutService());
+                        getSingleLogoutServices().push_back((*j)->cloneSingleLogoutService());
                     }
                 }
-                VectorOf(ManageNameIDService) x=getManageNameIDServices();
                 for (vector<ManageNameIDService*>::const_iterator k=src.m_ManageNameIDServices.begin(); k!=src.m_ManageNameIDServices.end(); k++) {
                     if (*k) {
-                        x.push_back((*k)->cloneManageNameIDService());
+                        getManageNameIDServices().push_back((*k)->cloneManageNameIDService());
                     }
                 }
-                VectorOf(NameIDFormat) y=getNameIDFormats();
                 for (vector<NameIDFormat*>::const_iterator m=src.m_NameIDFormats.begin(); m!=src.m_NameIDFormats.end(); m++) {
                     if (*m) {
-                        y.push_back((*m)->cloneNameIDFormat());
+                        getNameIDFormats().push_back((*m)->cloneNameIDFormat());
                     }
                 }
             }
 
+            SSODescriptorType* cloneSSODescriptorType() const {
+                return dynamic_cast<SSODescriptorType*>(clone());
+            }
+
             IMPL_TYPED_CHILDREN(ArtifactResolutionService,m_pos_ArtifactResolutionService);
             IMPL_TYPED_CHILDREN(SingleLogoutService,m_pos_SingleLogoutService);
             IMPL_TYPED_CHILDREN(ManageNameIDService,m_pos_ManageNameIDService);
@@ -1220,10 +1220,10 @@ namespace opensaml {
 
             void init() {
                 m_WantAuthnRequestsSigned=XML_BOOL_NULL;
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
                 m_pos_SingleSignOnService=m_pos_NameIDFormat;
                 ++m_pos_SingleSignOnService;
                 m_pos_NameIDMappingService=m_pos_SingleSignOnService;
@@ -1244,47 +1244,39 @@ namespace opensaml {
 
             IDPSSODescriptorImpl(const IDPSSODescriptorImpl& src) : AbstractXMLObject(src), SSODescriptorTypeImpl(src) {
                 init();
+            }
+
+            void _clone(const IDPSSODescriptorImpl& src) {
+                SSODescriptorTypeImpl::_clone(src);
                 WantAuthnRequestsSigned(src.m_WantAuthnRequestsSigned);
-                VectorOf(SingleSignOnService) v=getSingleSignOnServices();
                 for (vector<SingleSignOnService*>::const_iterator i=src.m_SingleSignOnServices.begin(); i!=src.m_SingleSignOnServices.end(); i++) {
                     if (*i) {
-                        v.push_back((*i)->cloneSingleSignOnService());
+                        getSingleSignOnServices().push_back((*i)->cloneSingleSignOnService());
                     }
                 }
-                VectorOf(NameIDMappingService) w=getNameIDMappingServices();
                 for (vector<NameIDMappingService*>::const_iterator j=src.m_NameIDMappingServices.begin(); j!=src.m_NameIDMappingServices.end(); j++) {
                     if (*j) {
-                        w.push_back((*j)->cloneNameIDMappingService());
+                        getNameIDMappingServices().push_back((*j)->cloneNameIDMappingService());
                     }
                 }
-                VectorOf(AssertionIDRequestService) x=getAssertionIDRequestServices();
                 for (vector<AssertionIDRequestService*>::const_iterator k=src.m_AssertionIDRequestServices.begin(); k!=src.m_AssertionIDRequestServices.end(); k++) {
                     if (*k) {
-                        x.push_back((*k)->cloneAssertionIDRequestService());
+                        getAssertionIDRequestServices().push_back((*k)->cloneAssertionIDRequestService());
                     }
                 }
-                VectorOf(AttributeProfile) y=getAttributeProfiles();
                 for (vector<AttributeProfile*>::const_iterator m=src.m_AttributeProfiles.begin(); m!=src.m_AttributeProfiles.end(); m++) {
                     if (*m) {
-                        y.push_back((*m)->cloneAttributeProfile());
+                        getAttributeProfiles().push_back((*m)->cloneAttributeProfile());
                     }
                 }
-                VectorOf(Attribute) z=getAttributes();
                 for (vector<Attribute*>::const_iterator n=src.m_Attributes.begin(); n!=src.m_Attributes.end(); n++) {
                     if (*n) {
-                        z.push_back((*n)->cloneAttribute());
+                        getAttributes().push_back((*n)->cloneAttribute());
                     }
                 }
             }
 
-            IMPL_XMLOBJECT_CLONE(IDPSSODescriptor);
-            SSODescriptorType* cloneSSODescriptorType() const {
-                return new IDPSSODescriptorImpl(*this);
-            }
-            RoleDescriptor* cloneRoleDescriptor() const {
-                return new IDPSSODescriptorImpl(*this);
-            }
-
+            IMPL_XMLOBJECT_CLONE_EX(IDPSSODescriptor);
             IMPL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned);
             IMPL_TYPED_CHILDREN(SingleSignOnService,m_pos_SingleSignOnService);
             IMPL_TYPED_CHILDREN(NameIDMappingService,m_pos_NameIDMappingService);
@@ -1304,7 +1296,7 @@ namespace opensaml {
 
         protected:
             void marshallAttributes(DOMElement* domElement) const {
-                MARSHALL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned,WANTAUTHNREQUESTSSIGNED,NULL);
+                MARSHALL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned,WANTAUTHNREQUESTSSIGNED,nullptr);
                 RoleDescriptorImpl::marshallAttributes(domElement);
             }
 
@@ -1326,9 +1318,10 @@ namespace opensaml {
             public AbstractXMLObjectUnmarshaller
         {
             void init() {
-                m_Name=m_NameFormat=m_FriendlyName=NULL;
+                m_Name=m_NameFormat=m_FriendlyName=nullptr;
                 m_isRequired=XML_BOOL_NULL;
             }
+
         public:
             virtual ~RequestedAttributeImpl() {
                 XMLString::release(&m_Name);
@@ -1349,19 +1342,14 @@ namespace opensaml {
                 setNameFormat(src.getNameFormat());
                 setFriendlyName(src.getFriendlyName());
                 isRequired(src.m_isRequired);
-                VectorOf(XMLObject) v=getAttributeValues();
                 for (vector<XMLObject*>::const_iterator i=src.m_AttributeValues.begin(); i!=src.m_AttributeValues.end(); i++) {
                     if (*i) {
-                        v.push_back((*i)->clone());
+                        getAttributeValues().push_back((*i)->clone());
                     }
                 }
             }
 
-            IMPL_XMLOBJECT_CLONE(RequestedAttribute);
-            Attribute* cloneAttribute() const {
-                return new RequestedAttributeImpl(*this);
-            }
-
+            IMPL_XMLOBJECT_CLONE2(RequestedAttribute,Attribute);
             IMPL_STRING_ATTRIB(Name);
             IMPL_STRING_ATTRIB(NameFormat);
             IMPL_STRING_ATTRIB(FriendlyName);
@@ -1392,10 +1380,10 @@ namespace opensaml {
 
         protected:
             void marshallAttributes(DOMElement* domElement) const {
-                MARSHALL_STRING_ATTRIB(Name,NAME,NULL);
-                MARSHALL_STRING_ATTRIB(NameFormat,NAMEFORMAT,NULL);
-                MARSHALL_STRING_ATTRIB(FriendlyName,FRIENDLYNAME,NULL);
-                MARSHALL_BOOLEAN_ATTRIB(isRequired,ISREQUIRED,NULL);
+                MARSHALL_STRING_ATTRIB(Name,NAME,nullptr);
+                MARSHALL_STRING_ATTRIB(NameFormat,NAMEFORMAT,nullptr);
+                MARSHALL_STRING_ATTRIB(FriendlyName,FRIENDLYNAME,nullptr);
+                MARSHALL_BOOLEAN_ATTRIB(isRequired,ISREQUIRED,nullptr);
                 marshallExtensionAttributes(domElement);
             }
 
@@ -1418,10 +1406,10 @@ namespace opensaml {
             list<XMLObject*>::iterator m_pos_RequestedAttribute;
 
                void init() {
-                m_Index=NULL;
+                m_Index=nullptr;
                 m_isDefault=XML_BOOL_NULL;
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
                 m_pos_ServiceDescription=m_children.begin();
                 m_pos_RequestedAttribute=m_pos_ServiceDescription;
                 ++m_pos_RequestedAttribute;
@@ -1442,22 +1430,19 @@ namespace opensaml {
                 init();
                 setIndex(src.m_Index);
                 isDefault(src.m_isDefault);
-                VectorOf(ServiceName) v=getServiceNames();
                 for (vector<ServiceName*>::const_iterator i=src.m_ServiceNames.begin(); i!=src.m_ServiceNames.end(); i++) {
                     if (*i) {
-                        v.push_back((*i)->cloneServiceName());
+                        getServiceNames().push_back((*i)->cloneServiceName());
                     }
                 }
-                VectorOf(ServiceDescription) w=getServiceDescriptions();
                 for (vector<ServiceDescription*>::const_iterator j=src.m_ServiceDescriptions.begin(); j!=src.m_ServiceDescriptions.end(); j++) {
                     if (*j) {
-                        w.push_back((*j)->cloneServiceDescription());
+                        getServiceDescriptions().push_back((*j)->cloneServiceDescription());
                     }
                 }
-                VectorOf(RequestedAttribute) x=getRequestedAttributes();
                 for (vector<RequestedAttribute*>::const_iterator k=src.m_RequestedAttributes.begin(); k!=src.m_RequestedAttributes.end(); k++) {
                     if (*k) {
-                        x.push_back((*k)->cloneRequestedAttribute());
+                        getRequestedAttributes().push_back((*k)->cloneRequestedAttribute());
                     }
                 }
             }
@@ -1471,8 +1456,8 @@ namespace opensaml {
 
         protected:
             void marshallAttributes(DOMElement* domElement) const {
-                MARSHALL_INTEGER_ATTRIB(Index,INDEX,NULL);
-                MARSHALL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,NULL);
+                MARSHALL_INTEGER_ATTRIB(Index,INDEX,nullptr);
+                MARSHALL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,nullptr);
             }
 
             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
@@ -1483,8 +1468,8 @@ namespace opensaml {
             }
 
             void processAttribute(const DOMAttr* attribute) {
-                PROC_INTEGER_ATTRIB(Index,INDEX,NULL);
-                PROC_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,NULL);
+                PROC_INTEGER_ATTRIB(Index,INDEX,nullptr);
+                PROC_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,nullptr);
                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
             }
         };
@@ -1496,7 +1481,7 @@ namespace opensaml {
             void init() {
                 m_AuthnRequestsSigned=XML_BOOL_NULL;
                 m_WantAssertionsSigned=XML_BOOL_NULL;
-                m_children.push_back(NULL);
+                m_children.push_back(nullptr);
                 m_pos_AssertionConsumerService=m_pos_NameIDFormat;
                 ++m_pos_AssertionConsumerService;
             }
@@ -1511,30 +1496,25 @@ namespace opensaml {
 
             SPSSODescriptorImpl(const SPSSODescriptorImpl& src) : AbstractXMLObject(src), SSODescriptorTypeImpl(src) {
                 init();
+            }
+
+            void _clone(const SPSSODescriptorImpl& src) {
+                SSODescriptorTypeImpl::_clone(src);
                 AuthnRequestsSigned(src.m_AuthnRequestsSigned);
                 WantAssertionsSigned(src.m_WantAssertionsSigned);
-                VectorOf(AssertionConsumerService) v=getAssertionConsumerServices();
                 for (vector<AssertionConsumerService*>::const_iterator i=src.m_AssertionConsumerServices.begin(); i!=src.m_AssertionConsumerServices.end(); i++) {
                     if (*i) {
-                        v.push_back((*i)->cloneAssertionConsumerService());
+                        getAssertionConsumerServices().push_back((*i)->cloneAssertionConsumerService());
                     }
                 }
-                VectorOf(AttributeConsumingService) w=getAttributeConsumingServices();
                 for (vector<AttributeConsumingService*>::const_iterator j=src.m_AttributeConsumingServices.begin(); j!=src.m_AttributeConsumingServices.end(); j++) {
                     if (*j) {
-                        w.push_back((*j)->cloneAttributeConsumingService());
+                        getAttributeConsumingServices().push_back((*j)->cloneAttributeConsumingService());
                     }
                 }
             }
 
-            IMPL_XMLOBJECT_CLONE(SPSSODescriptor);
-            SSODescriptorType* cloneSSODescriptorType() const {
-                return cloneSPSSODescriptor();
-            }
-            RoleDescriptor* cloneRoleDescriptor() const {
-                return cloneSPSSODescriptor();
-            }
-
+            IMPL_XMLOBJECT_CLONE_EX(SPSSODescriptor);
             IMPL_BOOLEAN_ATTRIB(AuthnRequestsSigned);
             IMPL_BOOLEAN_ATTRIB(WantAssertionsSigned);
             IMPL_TYPED_CHILDREN(AssertionConsumerService,m_pos_AssertionConsumerService);
@@ -1556,8 +1536,8 @@ namespace opensaml {
 
         protected:
             void marshallAttributes(DOMElement* domElement) const {
-                MARSHALL_BOOLEAN_ATTRIB(AuthnRequestsSigned,AUTHNREQUESTSSIGNED,NULL);
-                MARSHALL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,NULL);
+                MARSHALL_BOOLEAN_ATTRIB(AuthnRequestsSigned,AUTHNREQUESTSSIGNED,nullptr);
+                MARSHALL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,nullptr);
                 RoleDescriptorImpl::marshallAttributes(domElement);
             }
 
@@ -1574,8 +1554,8 @@ namespace opensaml {
             list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
 
             void init() {
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
                 m_pos_AuthnQueryService=m_pos_ContactPerson;
                 ++m_pos_AuthnQueryService;
                 m_pos_AssertionIDRequestService=m_pos_AuthnQueryService;
@@ -1586,37 +1566,34 @@ namespace opensaml {
             virtual ~AuthnAuthorityDescriptorImpl() {}
 
             AuthnAuthorityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
-                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+                    : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
                 init();
             }
 
             AuthnAuthorityDescriptorImpl(const AuthnAuthorityDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
                 init();
-                VectorOf(AuthnQueryService) v=getAuthnQueryServices();
+            }
+
+            void _clone(const AuthnAuthorityDescriptorImpl& src) {
+                RoleDescriptorImpl::_clone(src);
                 for (vector<AuthnQueryService*>::const_iterator i=src.m_AuthnQueryServices.begin(); i!=src.m_AuthnQueryServices.end(); i++) {
                     if (*i) {
-                        v.push_back((*i)->cloneAuthnQueryService());
+                        getAuthnQueryServices().push_back((*i)->cloneAuthnQueryService());
                     }
                 }
-                VectorOf(AssertionIDRequestService) w=getAssertionIDRequestServices();
                 for (vector<AssertionIDRequestService*>::const_iterator j=src.m_AssertionIDRequestServices.begin(); j!=src.m_AssertionIDRequestServices.end(); j++) {
                     if (*j) {
-                        w.push_back((*j)->cloneAssertionIDRequestService());
+                        getAssertionIDRequestServices().push_back((*j)->cloneAssertionIDRequestService());
                     }
                 }
-                VectorOf(NameIDFormat) x=getNameIDFormats();
                 for (vector<NameIDFormat*>::const_iterator k=src.m_NameIDFormats.begin(); k!=src.m_NameIDFormats.end(); k++) {
                     if (*k) {
-                        x.push_back((*k)->cloneNameIDFormat());
+                        getNameIDFormats().push_back((*k)->cloneNameIDFormat());
                     }
                 }
             }
 
-            IMPL_XMLOBJECT_CLONE(AuthnAuthorityDescriptor);
-            RoleDescriptor* cloneRoleDescriptor() const {
-                return cloneAuthnAuthorityDescriptor();
-            }
-
+            IMPL_XMLOBJECT_CLONE_EX(AuthnAuthorityDescriptor);
             IMPL_TYPED_CHILDREN(AuthnQueryService,m_pos_AuthnQueryService);
             IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
             IMPL_TYPED_CHILDREN(NameIDFormat,m_children.end());
@@ -1636,8 +1613,8 @@ namespace opensaml {
             list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
 
             void init() {
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
                 m_pos_AuthzService=m_pos_ContactPerson;
                 ++m_pos_AuthzService;
                 m_pos_AssertionIDRequestService=m_pos_AuthzService;
@@ -1648,37 +1625,34 @@ namespace opensaml {
             virtual ~PDPDescriptorImpl() {}
 
             PDPDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
-                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+                    : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
                 init();
             }
 
             PDPDescriptorImpl(const PDPDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
                 init();
-                VectorOf(AuthzService) v=getAuthzServices();
+            }
+
+            void _clone(const PDPDescriptorImpl& src) {
+                RoleDescriptorImpl::_clone(src);
                 for (vector<AuthzService*>::const_iterator i=src.m_AuthzServices.begin(); i!=src.m_AuthzServices.end(); i++) {
                     if (*i) {
-                        v.push_back((*i)->cloneAuthzService());
+                        getAuthzServices().push_back((*i)->cloneAuthzService());
                     }
                 }
-                VectorOf(AssertionIDRequestService) w=getAssertionIDRequestServices();
                 for (vector<AssertionIDRequestService*>::const_iterator j=src.m_AssertionIDRequestServices.begin(); j!=src.m_AssertionIDRequestServices.end(); j++) {
                     if (*j) {
-                        w.push_back((*j)->cloneAssertionIDRequestService());
+                        getAssertionIDRequestServices().push_back((*j)->cloneAssertionIDRequestService());
                     }
                 }
-                VectorOf(NameIDFormat) x=getNameIDFormats();
                 for (vector<NameIDFormat*>::const_iterator k=src.m_NameIDFormats.begin(); k!=src.m_NameIDFormats.end(); k++) {
                     if (*k) {
-                        x.push_back((*k)->cloneNameIDFormat());
+                        getNameIDFormats().push_back((*k)->cloneNameIDFormat());
                     }
                 }
             }
 
-            IMPL_XMLOBJECT_CLONE(PDPDescriptor);
-            RoleDescriptor* cloneRoleDescriptor() const {
-                return clonePDPDescriptor();
-            }
-
+            IMPL_XMLOBJECT_CLONE_EX(PDPDescriptor);
             IMPL_TYPED_CHILDREN(AuthzService,m_pos_AuthzService);
             IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
             IMPL_TYPED_CHILDREN(NameIDFormat,m_children.end());
@@ -1700,10 +1674,10 @@ namespace opensaml {
             list<XMLObject*>::iterator m_pos_AttributeProfile;
 
             void init() {
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
                 m_pos_AttributeService=m_pos_ContactPerson;
                 ++m_pos_AttributeService;
                 m_pos_AssertionIDRequestService=m_pos_AttributeService;
@@ -1718,49 +1692,44 @@ namespace opensaml {
             virtual ~AttributeAuthorityDescriptorImpl() {}
 
             AttributeAuthorityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
-                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+                    : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
                 init();
             }
 
             AttributeAuthorityDescriptorImpl(const AttributeAuthorityDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
                 init();
-                VectorOf(AttributeService) v=getAttributeServices();
+            }
+
+            void _clone(const AttributeAuthorityDescriptorImpl& src) {
+                RoleDescriptorImpl::_clone(src);
                 for (vector<AttributeService*>::const_iterator i=src.m_AttributeServices.begin(); i!=src.m_AttributeServices.end(); i++) {
                     if (*i) {
-                        v.push_back((*i)->cloneAttributeService());
+                        getAttributeServices().push_back((*i)->cloneAttributeService());
                     }
                 }
-                VectorOf(AssertionIDRequestService) w=getAssertionIDRequestServices();
                 for (vector<AssertionIDRequestService*>::const_iterator j=src.m_AssertionIDRequestServices.begin(); j!=src.m_AssertionIDRequestServices.end(); j++) {
                     if (*j) {
-                        w.push_back((*j)->cloneAssertionIDRequestService());
+                        getAssertionIDRequestServices().push_back((*j)->cloneAssertionIDRequestService());
                     }
                 }
-                VectorOf(NameIDFormat) x=getNameIDFormats();
                 for (vector<NameIDFormat*>::const_iterator k=src.m_NameIDFormats.begin(); k!=src.m_NameIDFormats.end(); k++) {
                     if (*k) {
-                        x.push_back((*k)->cloneNameIDFormat());
+                        getNameIDFormats().push_back((*k)->cloneNameIDFormat());
                     }
                 }
-                VectorOf(AttributeProfile) y=getAttributeProfiles();
                 for (vector<AttributeProfile*>::const_iterator m=src.m_AttributeProfiles.begin(); m!=src.m_AttributeProfiles.end(); m++) {
                     if (*m) {
-                        y.push_back((*m)->cloneAttributeProfile());
+                        getAttributeProfiles().push_back((*m)->cloneAttributeProfile());
                     }
                 }
-                VectorOf(Attribute) z=getAttributes();
                 for (vector<Attribute*>::const_iterator n=src.m_Attributes.begin(); n!=src.m_Attributes.end(); n++) {
                     if (*n) {
-                        z.push_back((*n)->cloneAttribute());
+                        getAttributes().push_back((*n)->cloneAttribute());
                     }
                 }
             }
 
-            IMPL_XMLOBJECT_CLONE(AttributeAuthorityDescriptor);
-            RoleDescriptor* cloneRoleDescriptor() const {
-                return cloneAttributeAuthorityDescriptor();
-            }
-
+            IMPL_XMLOBJECT_CLONE_EX(AttributeAuthorityDescriptor);
             IMPL_TYPED_CHILDREN(AttributeService,m_pos_AttributeService);
             IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
             IMPL_TYPED_CHILDREN(NameIDFormat,m_pos_NameIDFormat);
@@ -1782,7 +1751,7 @@ namespace opensaml {
         {
             void init() {
                 m_WantAssertionsSigned=XML_BOOL_NULL;
-                m_children.push_back(NULL);
+                m_children.push_back(nullptr);
                 m_pos_NameIDFormat=m_pos_ContactPerson;
                 ++m_pos_NameIDFormat;
             }
@@ -1798,21 +1767,28 @@ namespace opensaml {
             virtual ~QueryDescriptorTypeImpl() {}
 
             QueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
-                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+                    : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
                 init();
             }
 
             QueryDescriptorTypeImpl(const QueryDescriptorTypeImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
                 init();
+            }
+
+            void _clone(const QueryDescriptorTypeImpl& src) {
+                RoleDescriptorImpl::_clone(src);
                 WantAssertionsSigned(src.m_WantAssertionsSigned);
-                VectorOf(NameIDFormat) y=getNameIDFormats();
                 for (vector<NameIDFormat*>::const_iterator m=src.m_NameIDFormats.begin(); m!=src.m_NameIDFormats.end(); m++) {
                     if (*m) {
-                        y.push_back((*m)->cloneNameIDFormat());
+                        getNameIDFormats().push_back((*m)->cloneNameIDFormat());
                     }
                 }
             }
 
+            QueryDescriptorType* cloneQueryDescriptorType() const {
+                return dynamic_cast<QueryDescriptorType*>(clone());
+            }
+
             IMPL_BOOLEAN_ATTRIB(WantAssertionsSigned);
             IMPL_TYPED_CHILDREN(NameIDFormat,m_pos_NameIDFormat);
 
@@ -1828,7 +1804,7 @@ namespace opensaml {
 
         protected:
             void marshallAttributes(DOMElement* domElement) const {
-                MARSHALL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,NULL);
+                MARSHALL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,nullptr);
                 RoleDescriptorImpl::marshallAttributes(domElement);
             }
 
@@ -1848,13 +1824,7 @@ namespace opensaml {
 
             AuthnQueryDescriptorTypeImpl(const AuthnQueryDescriptorTypeImpl& src) : AbstractXMLObject(src), QueryDescriptorTypeImpl(src) {}
 
-            IMPL_XMLOBJECT_CLONE(AuthnQueryDescriptorType);
-            QueryDescriptorType* cloneQueryDescriptorType() const {
-                return new AuthnQueryDescriptorTypeImpl(*this);
-            }
-            RoleDescriptor* cloneRoleDescriptor() const {
-                return new AuthnQueryDescriptorTypeImpl(*this);
-            }
+            IMPL_XMLOBJECT_CLONE_EX(AuthnQueryDescriptorType);
         };
 
         class SAML_DLLLOCAL AttributeQueryDescriptorTypeImpl : public virtual AttributeQueryDescriptorType, public QueryDescriptorTypeImpl
@@ -1865,24 +1835,19 @@ namespace opensaml {
             AttributeQueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
 
-            AttributeQueryDescriptorTypeImpl(const AttributeQueryDescriptorTypeImpl& src)
-                    : AbstractXMLObject(src), QueryDescriptorTypeImpl(src) {
-                VectorOf(AttributeConsumingService) w=getAttributeConsumingServices();
+            AttributeQueryDescriptorTypeImpl(const AttributeQueryDescriptorTypeImpl& src) : AbstractXMLObject(src), QueryDescriptorTypeImpl(src) {
+            }
+
+            void _clone(const AttributeQueryDescriptorTypeImpl& src) {
+                QueryDescriptorTypeImpl::_clone(src);
                 for (vector<AttributeConsumingService*>::const_iterator j=src.m_AttributeConsumingServices.begin(); j!=src.m_AttributeConsumingServices.end(); j++) {
                     if (*j) {
-                        w.push_back((*j)->cloneAttributeConsumingService());
+                        getAttributeConsumingServices().push_back((*j)->cloneAttributeConsumingService());
                     }
                 }
             }
 
-            IMPL_XMLOBJECT_CLONE(AttributeQueryDescriptorType);
-            QueryDescriptorType* cloneQueryDescriptorType() const {
-                return new AttributeQueryDescriptorTypeImpl(*this);
-            }
-            RoleDescriptor* cloneRoleDescriptor() const {
-                return new AttributeQueryDescriptorTypeImpl(*this);
-            }
-
+            IMPL_XMLOBJECT_CLONE_EX(AttributeQueryDescriptorType);
             IMPL_TYPED_CHILDREN(AttributeConsumingService,m_children.end());
 
         protected:
@@ -1900,24 +1865,19 @@ namespace opensaml {
             AuthzDecisionQueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
 
-            AuthzDecisionQueryDescriptorTypeImpl(const AuthzDecisionQueryDescriptorTypeImpl& src)
-                    : AbstractXMLObject(src), QueryDescriptorTypeImpl(src) {
-                VectorOf(ActionNamespace) w=getActionNamespaces();
+            AuthzDecisionQueryDescriptorTypeImpl(const AuthzDecisionQueryDescriptorTypeImpl& src) : AbstractXMLObject(src), QueryDescriptorTypeImpl(src) {
+            }
+
+            void _clone(const AuthzDecisionQueryDescriptorTypeImpl& src) {
+                QueryDescriptorTypeImpl::_clone(src);
                 for (vector<ActionNamespace*>::const_iterator j=src.m_ActionNamespaces.begin(); j!=src.m_ActionNamespaces.end(); j++) {
                     if (*j) {
-                        w.push_back((*j)->cloneActionNamespace());
+                        getActionNamespaces().push_back((*j)->cloneActionNamespace());
                     }
                 }
             }
 
-            IMPL_XMLOBJECT_CLONE(AuthzDecisionQueryDescriptorType);
-            QueryDescriptorType* cloneQueryDescriptorType() const {
-                return new AuthzDecisionQueryDescriptorTypeImpl(*this);
-            }
-            RoleDescriptor* cloneRoleDescriptor() const {
-                return new AuthzDecisionQueryDescriptorTypeImpl(*this);
-            }
-
+            IMPL_XMLOBJECT_CLONE_EX(AuthzDecisionQueryDescriptorType);
             IMPL_TYPED_CHILDREN(ActionNamespace,m_children.end());
 
         protected:
@@ -1938,13 +1898,13 @@ namespace opensaml {
             list<XMLObject*>::iterator m_pos_AffiliateMember;
 
             void init() {
-                m_ID=m_AffiliationOwnerID=NULL;
-                m_ValidUntil=m_CacheDuration=NULL;
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
-                m_Signature=NULL;
-                m_Extensions=NULL;
+                m_ID=m_AffiliationOwnerID=nullptr;
+                m_ValidUntil=m_CacheDuration=nullptr;
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
+                m_Signature=nullptr;
+                m_Extensions=nullptr;
                 m_pos_Signature=m_children.begin();
                 m_pos_Extensions=m_pos_Signature;
                 ++m_pos_Extensions;
@@ -1978,16 +1938,14 @@ namespace opensaml {
                 if (src.getExtensions())
                     setExtensions(src.getExtensions()->cloneExtensions());
 
-                VectorOf(KeyDescriptor) v=getKeyDescriptors();
                 for (vector<KeyDescriptor*>::const_iterator i=src.m_KeyDescriptors.begin(); i!=src.m_KeyDescriptors.end(); i++) {
                     if (*i) {
-                        v.push_back((*i)->cloneKeyDescriptor());
+                        getKeyDescriptors().push_back((*i)->cloneKeyDescriptor());
                     }
                 }
-                VectorOf(AffiliateMember) w=getAffiliateMembers();
                 for (vector<AffiliateMember*>::const_iterator j=src.m_AffiliateMembers.begin(); j!=src.m_AffiliateMembers.end(); j++) {
                     if (*j) {
-                        w.push_back((*j)->cloneAffiliateMember());
+                        getAffiliateMembers().push_back((*j)->cloneAffiliateMember());
                     }
                 }
             }
@@ -2012,7 +1970,7 @@ namespace opensaml {
                     m_Signature->setContentReference(new opensaml::ContentReference(*this));
             }
 
-            IMPL_ID_ATTRIB(ID);
+            IMPL_ID_ATTRIB_EX(ID,ID,nullptr);
             IMPL_STRING_ATTRIB(AffiliationOwnerID);
             IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
             IMPL_DURATION_ATTRIB(CacheDuration,0);
@@ -2043,11 +2001,16 @@ namespace opensaml {
             }
 
         protected:
+            void prepareForMarshalling() const {
+                if (m_Signature)
+                    declareNonVisibleNamespaces();
+            }
+
             void marshallAttributes(DOMElement* domElement) const {
-                MARSHALL_ID_ATTRIB(ID,ID,NULL);
-                MARSHALL_STRING_ATTRIB(AffiliationOwnerID,AFFILIATIONOWNERID,NULL);
-                MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,NULL);
-                MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,NULL);
+                MARSHALL_ID_ATTRIB(ID,ID,nullptr);
+                MARSHALL_STRING_ATTRIB(AffiliationOwnerID,AFFILIATIONOWNERID,nullptr);
+                MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,nullptr);
+                MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,nullptr);
                 marshallExtensionAttributes(domElement);
             }
 
@@ -2060,7 +2023,7 @@ namespace opensaml {
             }
 
             void processAttribute(const DOMAttr* attribute) {
-                PROC_ID_ATTRIB(ID,ID,NULL);
+                PROC_ID_ATTRIB(ID,ID,nullptr);
                 unmarshallExtensionAttribute(attribute);
             }
         };
@@ -2076,17 +2039,17 @@ namespace opensaml {
             list<XMLObject*>::iterator m_pos_ContactPerson;
 
             void init() {
-                m_ID=m_EntityID=NULL;
-                m_ValidUntil=m_CacheDuration=NULL;
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
-                m_Signature=NULL;
-                m_Extensions=NULL;
-                m_AffiliationDescriptor=NULL;
-                m_Organization=NULL;
+                m_ID=m_EntityID=nullptr;
+                m_ValidUntil=m_CacheDuration=nullptr;
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
+                m_Signature=nullptr;
+                m_Extensions=nullptr;
+                m_AffiliationDescriptor=nullptr;
+                m_Organization=nullptr;
                 m_pos_Signature=m_children.begin();
                 m_pos_Extensions=m_pos_Signature;
                 ++m_pos_Extensions;
@@ -2186,16 +2149,14 @@ namespace opensaml {
                     }
                 }
 
-                VectorOf(ContactPerson) v=getContactPersons();
                 for (vector<ContactPerson*>::const_iterator j=src.m_ContactPersons.begin(); j!=src.m_ContactPersons.end(); j++) {
                     if (*j) {
-                        v.push_back((*j)->cloneContactPerson());
+                        getContactPersons().push_back((*j)->cloneContactPerson());
                     }
                 }
-                VectorOf(AdditionalMetadataLocation) w=getAdditionalMetadataLocations();
                 for (vector<AdditionalMetadataLocation*>::const_iterator k=src.m_AdditionalMetadataLocations.begin(); k!=src.m_AdditionalMetadataLocations.end(); k++) {
                     if (*k) {
-                        w.push_back((*k)->cloneAdditionalMetadataLocation());
+                        getAdditionalMetadataLocations().push_back((*k)->cloneAdditionalMetadataLocation());
                     }
                 }
             }
@@ -2220,7 +2181,7 @@ namespace opensaml {
                     m_Signature->setContentReference(new opensaml::ContentReference(*this));
             }
 
-            IMPL_ID_ATTRIB(ID);
+            IMPL_ID_ATTRIB_EX(ID,ID,nullptr);
             IMPL_STRING_ATTRIB(EntityID);
             IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
             IMPL_DURATION_ATTRIB(CacheDuration,0);
@@ -2282,15 +2243,20 @@ namespace opensaml {
 
                 vector<RoleDescriptor*>::const_iterator i =
                     find_if(m_RoleDescriptors.begin(), m_RoleDescriptors.end(), ofTypeValidForProtocol(qname,protocol));
-                return (i!=m_RoleDescriptors.end()) ? *i : NULL;
+                return (i!=m_RoleDescriptors.end()) ? *i : nullptr;
             }
 
         protected:
+            void prepareForMarshalling() const {
+                if (m_Signature)
+                    declareNonVisibleNamespaces();
+            }
+
             void marshallAttributes(DOMElement* domElement) const {
-                MARSHALL_ID_ATTRIB(ID,ID,NULL);
-                MARSHALL_STRING_ATTRIB(EntityID,ENTITYID,NULL);
-                MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,NULL);
-                MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,NULL);
+                MARSHALL_ID_ATTRIB(ID,ID,nullptr);
+                MARSHALL_STRING_ATTRIB(EntityID,ENTITYID,nullptr);
+                MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,nullptr);
+                MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,nullptr);
                 marshallExtensionAttributes(domElement);
             }
 
@@ -2314,7 +2280,7 @@ namespace opensaml {
             }
 
             void processAttribute(const DOMAttr* attribute) {
-                PROC_ID_ATTRIB(ID,ID,NULL);
+                PROC_ID_ATTRIB(ID,ID,nullptr);
                 unmarshallExtensionAttribute(attribute);
             }
         };
@@ -2327,12 +2293,12 @@ namespace opensaml {
             public AbstractXMLObjectUnmarshaller
         {
             void init() {
-                m_ID=m_Name=NULL;
-                m_ValidUntil=m_CacheDuration=NULL;
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
-                m_Signature=NULL;
-                m_Extensions=NULL;
+                m_ID=m_Name=nullptr;
+                m_ValidUntil=m_CacheDuration=nullptr;
+                m_children.push_back(nullptr);
+                m_children.push_back(nullptr);
+                m_Signature=nullptr;
+                m_Extensions=nullptr;
                 m_pos_Signature=m_children.begin();
                 m_pos_Extensions=m_pos_Signature;
                 ++m_pos_Extensions;
@@ -2400,7 +2366,7 @@ namespace opensaml {
                     m_Signature->setContentReference(new opensaml::ContentReference(*this));
             }
 
-            IMPL_ID_ATTRIB(ID);
+            IMPL_ID_ATTRIB_EX(ID,ID,nullptr);
             IMPL_STRING_ATTRIB(Name);
             IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
             IMPL_DURATION_ATTRIB(CacheDuration,0);
@@ -2409,11 +2375,16 @@ namespace opensaml {
             IMPL_TYPED_CHILDREN(EntitiesDescriptor,m_children.end());
 
         protected:
+            void prepareForMarshalling() const {
+                if (m_Signature)
+                    declareNonVisibleNamespaces();
+            }
+
             void marshallAttributes(DOMElement* domElement) const {
-                MARSHALL_ID_ATTRIB(ID,ID,NULL);
-                MARSHALL_STRING_ATTRIB(Name,NAME,NULL);
-                MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,NULL);
-                MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,NULL);
+                MARSHALL_ID_ATTRIB(ID,ID,nullptr);
+                MARSHALL_STRING_ATTRIB(Name,NAME,nullptr);
+                MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,nullptr);
+                MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,nullptr);
             }
 
             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
@@ -2425,10 +2396,527 @@ namespace opensaml {
             }
 
             void processAttribute(const DOMAttr* attribute) {
-                PROC_ID_ATTRIB(ID,ID,NULL);
-                PROC_STRING_ATTRIB(Name,NAME,NULL);
-                PROC_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,NULL);
-                PROC_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,NULL);
+                PROC_ID_ATTRIB(ID,ID,nullptr);
+                PROC_STRING_ATTRIB(Name,NAME,nullptr);
+                PROC_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,nullptr);
+                PROC_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,nullptr);
+            }
+        };
+
+        class SAML_DLLLOCAL DiscoveryResponseImpl : public virtual DiscoveryResponse, public IndexedEndpointTypeImpl
+        {
+        public:
+            virtual ~DiscoveryResponseImpl() {}
+
+            DiscoveryResponseImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
+
+            DiscoveryResponseImpl(const DiscoveryResponseImpl& src) : AbstractXMLObject(src), IndexedEndpointTypeImpl(src) {}
+
+            IMPL_XMLOBJECT_CLONE_EX(DiscoveryResponse);
+        };
+
+        class SAML_DLLLOCAL RequestInitiatorImpl : public virtual RequestInitiator, public EndpointTypeImpl
+        {
+        public:
+            virtual ~RequestInitiatorImpl() {}
+
+            RequestInitiatorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
+
+            RequestInitiatorImpl(const RequestInitiatorImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
+
+            IMPL_XMLOBJECT_CLONE_EX(RequestInitiator);
+        };
+
+        class SAML_DLLLOCAL EntityAttributesImpl : public virtual EntityAttributes,
+            public AbstractComplexElement,
+            public AbstractDOMCachingXMLObject,
+            public AbstractXMLObjectMarshaller,
+            public AbstractXMLObjectUnmarshaller
+        {
+        public:
+            virtual ~EntityAttributesImpl() {}
+
+            EntityAttributesImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+            }
+
+            EntityAttributesImpl(const EntityAttributesImpl& src)
+                    : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
+                for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
+                    if (*i) {
+                        Attribute* a=dynamic_cast<Attribute*>(*i);
+                        if (a) {
+                            getAttributes().push_back(a->cloneAttribute());
+                            continue;
+                        }
+
+                        saml2::Assertion* as=dynamic_cast<saml2::Assertion*>(*i);
+                        if (as) {
+                            getAssertions().push_back(as->cloneAssertion());
+                            continue;
+                        }
+                    }
+                }
+            }
+
+            IMPL_XMLOBJECT_CLONE(EntityAttributes);
+            IMPL_TYPED_FOREIGN_CHILDREN(Attribute,saml2,m_children.end());
+            IMPL_TYPED_FOREIGN_CHILDREN(Assertion,saml2,m_children.end());
+
+        protected:
+            void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+                PROC_TYPED_FOREIGN_CHILDREN(Attribute,saml2,SAML20_NS,false);
+                PROC_TYPED_FOREIGN_CHILDREN(Assertion,saml2,SAML20_NS,false);
+                AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
+            }
+        };
+
+        class SAML_DLLLOCAL DigestMethodImpl : public virtual DigestMethod,
+            public AbstractComplexElement,
+            public AbstractDOMCachingXMLObject,
+            public AbstractXMLObjectMarshaller,
+            public AbstractXMLObjectUnmarshaller
+        {
+        public:
+            virtual ~DigestMethodImpl() {
+                XMLString::release(&m_Algorithm);
+            }
+
+            DigestMethodImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType), m_Algorithm(nullptr) {
+            }
+
+            DigestMethodImpl(const DigestMethodImpl& src)
+                    : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src), m_Algorithm(nullptr) {
+                setAlgorithm(src.getAlgorithm());
+                for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) {
+                    if (*i) {
+                        getUnknownXMLObjects().push_back((*i)->clone());
+                    }
+                }
+            }
+
+            IMPL_XMLOBJECT_CLONE(DigestMethod);
+            IMPL_STRING_ATTRIB(Algorithm);
+            IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
+
+        protected:
+            void marshallAttributes(DOMElement* domElement) const {
+                MARSHALL_STRING_ATTRIB(Algorithm,ALGORITHM,nullptr);
+            }
+
+            void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+                // Unknown child.
+                getUnknownXMLObjects().push_back(childXMLObject);
+            }
+
+            void processAttribute(const DOMAttr* attribute) {
+                PROC_STRING_ATTRIB(Algorithm,ALGORITHM,nullptr);
+            }
+        };
+
+        class SAML_DLLLOCAL SigningMethodImpl : public virtual SigningMethod,
+            public AbstractComplexElement,
+            public AbstractDOMCachingXMLObject,
+            public AbstractXMLObjectMarshaller,
+            public AbstractXMLObjectUnmarshaller
+        {
+            void init() {
+                m_Algorithm = m_MinKeySize = m_MaxKeySize = nullptr;
+            }
+
+        public:
+            virtual ~SigningMethodImpl() {
+                XMLString::release(&m_Algorithm);
+                XMLString::release(&m_MinKeySize);
+                XMLString::release(&m_MaxKeySize);
+            }
+
+            SigningMethodImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
+                    : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+                init();
+            }
+
+            SigningMethodImpl(const SigningMethodImpl& src)
+                    : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
+                init();
+                setAlgorithm(src.getAlgorithm());
+                setMinKeySize(src.m_MinKeySize);
+                setMaxKeySize(src.m_MaxKeySize);
+                for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) {
+                    if (*i) {
+                        getUnknownXMLObjects().push_back((*i)->clone());
+                    }
+                }
+            }
+
+            IMPL_XMLOBJECT_CLONE(SigningMethod);
+            IMPL_STRING_ATTRIB(Algorithm);
+            IMPL_INTEGER_ATTRIB(MinKeySize);
+            IMPL_INTEGER_ATTRIB(MaxKeySize);
+            IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
+
+        protected:
+            void marshallAttributes(DOMElement* domElement) const {
+                MARSHALL_STRING_ATTRIB(Algorithm,ALGORITHM,nullptr);
+                MARSHALL_INTEGER_ATTRIB(MinKeySize,MINKEYSIZE,nullptr);
+                MARSHALL_INTEGER_ATTRIB(MaxKeySize,MAXKEYSIZE,nullptr);
+            }
+
+            void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+                // Unknown child.
+                getUnknownXMLObjects().push_back(childXMLObject);
+            }
+
+            void processAttribute(const DOMAttr* attribute) {
+                PROC_STRING_ATTRIB(Algorithm,ALGORITHM,nullptr);
+                PROC_INTEGER_ATTRIB(MinKeySize,MINKEYSIZE,nullptr);
+                PROC_INTEGER_ATTRIB(MaxKeySize,MAXKEYSIZE,nullptr);
+            }
+        };
+
+        class SAML_DLLLOCAL DisplayNameImpl : public virtual DisplayName, public localizedNameTypeImpl
+        {
+        public:
+            virtual ~DisplayNameImpl() {}
+
+            DisplayNameImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
+
+            DisplayNameImpl(const DisplayNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
+
+            IMPL_XMLOBJECT_CLONE_EX(DisplayName);
+        };
+
+        class SAML_DLLLOCAL DescriptionImpl : public virtual Description, public localizedNameTypeImpl
+        {
+        public:
+            virtual ~DescriptionImpl() {}
+
+            DescriptionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
+
+            DescriptionImpl(const DescriptionImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
+
+            IMPL_XMLOBJECT_CLONE_EX(Description);
+        };
+
+        class SAML_DLLLOCAL InformationURLImpl : public virtual InformationURL, public localizedURITypeImpl
+        {
+        public:
+            virtual ~InformationURLImpl() {}
+
+            InformationURLImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
+
+            InformationURLImpl(const InformationURLImpl& src) : AbstractXMLObject(src), localizedURITypeImpl(src) {}
+
+            IMPL_XMLOBJECT_CLONE_EX(InformationURL);
+        };
+
+        class SAML_DLLLOCAL PrivacyStatementURLImpl : public virtual PrivacyStatementURL, public localizedURITypeImpl
+        {
+        public:
+            virtual ~PrivacyStatementURLImpl() {}
+
+            PrivacyStatementURLImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
+
+            PrivacyStatementURLImpl(const PrivacyStatementURLImpl& src) : AbstractXMLObject(src), localizedURITypeImpl(src) {}
+
+            IMPL_XMLOBJECT_CLONE_EX(PrivacyStatementURL);
+        };
+
+        class SAML_DLLLOCAL KeywordsImpl : public virtual Keywords,
+            public AbstractSimpleElement,
+            public AbstractDOMCachingXMLObject,
+            public AbstractXMLObjectMarshaller,
+            public AbstractXMLObjectUnmarshaller
+        {
+            void init() {
+                m_Lang=nullptr;
+                m_LangPrefix=nullptr;
+            }
+
+        protected:
+            KeywordsImpl() {
+                init();
+            }
+
+        public:
+            virtual ~KeywordsImpl() {
+                XMLString::release(&m_Lang);
+                XMLString::release(&m_LangPrefix);
+            }
+
+            KeywordsImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
+                    : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+                init();
+            }
+
+            KeywordsImpl(const KeywordsImpl& src)
+                    : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
+                init();
+                setLang(src.getLang());
+                if (src.m_LangPrefix)
+                    m_LangPrefix = XMLString::replicate(src.m_LangPrefix);
+            }
+
+            IMPL_XMLOBJECT_CLONE(Keywords);
+            IMPL_XMLOBJECT_FOREIGN_ATTRIB(Lang,XMLCh);
+
+        protected:
+            void marshallAttributes(DOMElement* domElement) const {
+                if (m_Lang && *m_Lang) {
+                    DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(xmlconstants::XML_NS, LANG_ATTRIB_NAME);
+                    if (m_LangPrefix && *m_LangPrefix)
+                        attr->setPrefix(m_LangPrefix);
+                    else
+                        attr->setPrefix(xmlconstants::XML_PREFIX);
+                    attr->setNodeValue(m_Lang);
+                    domElement->setAttributeNodeNS(attr);
+                }
+            }
+
+            void processAttribute(const DOMAttr* attribute) {
+                if (XMLHelper::isNodeNamed(attribute, xmlconstants::XML_NS, LANG_ATTRIB_NAME)) {
+                    setLang(attribute->getValue());
+                    const XMLCh* temp = attribute->getPrefix();
+                    if (temp && *temp && !XMLString::equals(temp, xmlconstants::XML_NS))
+                        m_LangPrefix = XMLString::replicate(temp);
+                    return;
+                }
+                AbstractXMLObjectUnmarshaller::processAttribute(attribute);
+            }
+        };
+
+        class SAML_DLLLOCAL LogoImpl : public virtual Logo,
+            public AbstractSimpleElement,
+            public AbstractDOMCachingXMLObject,
+            public AbstractXMLObjectMarshaller,
+            public AbstractXMLObjectUnmarshaller
+        {
+            void init() {
+                m_Lang=nullptr;
+                m_LangPrefix=nullptr;
+                m_Height=nullptr;
+                m_Width=nullptr;
+            }
+
+        protected:
+            LogoImpl() {
+                init();
+            }
+
+        public:
+            virtual ~LogoImpl() {
+                XMLString::release(&m_Lang);
+                XMLString::release(&m_LangPrefix);
+                XMLString::release(&m_Height);
+                XMLString::release(&m_Width);
+            }
+
+            LogoImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
+                    : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+                init();
+            }
+
+            LogoImpl(const LogoImpl& src) : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
+                init();
+                setLang(src.getLang());
+                if (src.m_LangPrefix)
+                    m_LangPrefix = XMLString::replicate(src.m_LangPrefix);
+                setHeight(src.m_Height);
+                setWidth(src.m_Width);
+            }
+
+            IMPL_XMLOBJECT_CLONE(Logo);
+            IMPL_XMLOBJECT_FOREIGN_ATTRIB(Lang,XMLCh);
+            IMPL_INTEGER_ATTRIB(Height);
+            IMPL_INTEGER_ATTRIB(Width);
+
+        protected:
+            void marshallAttributes(DOMElement* domElement) const {
+                if (m_Lang && *m_Lang) {
+                    DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(xmlconstants::XML_NS, LANG_ATTRIB_NAME);
+                    if (m_LangPrefix && *m_LangPrefix)
+                        attr->setPrefix(m_LangPrefix);
+                    else
+                        attr->setPrefix(xmlconstants::XML_PREFIX);
+                    attr->setNodeValue(m_Lang);
+                    domElement->setAttributeNodeNS(attr);
+                }
+                MARSHALL_INTEGER_ATTRIB(Height,HEIGHT,nullptr);
+                MARSHALL_INTEGER_ATTRIB(Width,WIDTH,nullptr);
+            }
+
+            void processAttribute(const DOMAttr* attribute) {
+                if (XMLHelper::isNodeNamed(attribute, xmlconstants::XML_NS, LANG_ATTRIB_NAME)) {
+                    setLang(attribute->getValue());
+                    const XMLCh* temp = attribute->getPrefix();
+                    if (temp && *temp && !XMLString::equals(temp, xmlconstants::XML_NS))
+                        m_LangPrefix = XMLString::replicate(temp);
+                    return;
+                }
+                PROC_INTEGER_ATTRIB(Height,HEIGHT,nullptr);
+                PROC_INTEGER_ATTRIB(Width,WIDTH,nullptr);
+                AbstractXMLObjectUnmarshaller::processAttribute(attribute);
+            }
+        };
+
+        class SAML_DLLLOCAL UIInfoImpl : public virtual UIInfo,
+            public AbstractComplexElement,
+            public AbstractDOMCachingXMLObject,
+            public AbstractXMLObjectMarshaller,
+            public AbstractXMLObjectUnmarshaller
+        {
+        public:
+            virtual ~UIInfoImpl() {}
+
+            UIInfoImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+            }
+
+            UIInfoImpl(const UIInfoImpl& src)
+                    : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
+                for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
+                    if (*i) {
+                        DisplayName* dn=dynamic_cast<DisplayName*>(*i);
+                        if (dn) {
+                            getDisplayNames().push_back(dn->cloneDisplayName());
+                            continue;
+                        }
+
+                        Description* des=dynamic_cast<Description*>(*i);
+                        if (des) {
+                            getDescriptions().push_back(des->cloneDescription());
+                            continue;
+                        }
+
+                        Keywords* key=dynamic_cast<Keywords*>(*i);
+                        if (key) {
+                            getKeywordss().push_back(key->cloneKeywords());
+                            continue;
+                        }
+
+                                               Logo* logo=dynamic_cast<Logo*>(*i);
+                        if (logo) {
+                            getLogos().push_back(logo->cloneLogo());
+                            continue;
+                        }
+
+                        InformationURL* inf=dynamic_cast<InformationURL*>(*i);
+                        if (inf) {
+                            getInformationURLs().push_back(inf->cloneInformationURL());
+                            continue;
+                        }
+
+                        PrivacyStatementURL* priv=dynamic_cast<PrivacyStatementURL*>(*i);
+                        if (priv) {
+                            getPrivacyStatementURLs().push_back(priv->clonePrivacyStatementURL());
+                            continue;
+                        }
+
+                        if (*i) {
+                            getUnknownXMLObjects().push_back((*i)->clone());
+                        }
+                    }
+                }
+            }
+
+            IMPL_XMLOBJECT_CLONE(UIInfo);
+            IMPL_TYPED_CHILDREN(DisplayName,m_children.end());
+            IMPL_TYPED_CHILDREN(Description,m_children.end());
+                       IMPL_TYPED_CHILDREN(Keywords,m_children.end());
+            IMPL_TYPED_CHILDREN(Logo,m_children.end());
+            IMPL_TYPED_CHILDREN(InformationURL,m_children.end());
+            IMPL_TYPED_CHILDREN(PrivacyStatementURL,m_children.end());
+            IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
+
+        protected:
+            void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+                PROC_TYPED_CHILDREN(DisplayName,SAML20MD_UI_NS,false);
+                PROC_TYPED_CHILDREN(Description,SAML20MD_UI_NS,false);
+                               PROC_TYPED_CHILDREN(Keywords,SAML20MD_UI_NS,false);
+                PROC_TYPED_CHILDREN(Logo,SAML20MD_UI_NS,false);
+                PROC_TYPED_CHILDREN(InformationURL,SAML20MD_UI_NS,false);
+                PROC_TYPED_CHILDREN(PrivacyStatementURL,SAML20MD_UI_NS,false);
+
+                // Unknown child.
+                const XMLCh* nsURI=root->getNamespaceURI();
+                if (!XMLString::equals(nsURI,SAML20MD_UI_NS) && nsURI && *nsURI) {
+                    getUnknownXMLObjects().push_back(childXMLObject);
+                    return;
+                }
+
+                AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
+            }
+        };
+
+        class SAML_DLLLOCAL DiscoHintsImpl : public virtual DiscoHints,
+            public AbstractComplexElement,
+            public AbstractDOMCachingXMLObject,
+            public AbstractXMLObjectMarshaller,
+            public AbstractXMLObjectUnmarshaller
+        {
+        public:
+            virtual ~DiscoHintsImpl() {}
+
+            DiscoHintsImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+            }
+
+            DiscoHintsImpl(const DiscoHintsImpl& src)
+                    : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
+                for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
+                    if (*i) {
+                        IPHint* ip=dynamic_cast<IPHint*>(*i);
+                        if (ip) {
+                            getIPHints().push_back(ip->cloneIPHint());
+                            continue;
+                        }
+
+                        DomainHint* dom=dynamic_cast<DomainHint*>(*i);
+                        if (dom) {
+                            getDomainHints().push_back(dom->cloneDomainHint());
+                            continue;
+                        }
+
+                        GeolocationHint* geo=dynamic_cast<GeolocationHint*>(*i);
+                        if (geo) {
+                            getGeolocationHints().push_back(geo->cloneGeolocationHint());
+                            continue;
+                        }
+
+                        if (*i) {
+                            getUnknownXMLObjects().push_back((*i)->clone());
+                        }
+                    }
+                }
+            }
+
+            IMPL_XMLOBJECT_CLONE(DiscoHints);
+            IMPL_TYPED_CHILDREN(IPHint,m_children.end());
+            IMPL_TYPED_CHILDREN(DomainHint,m_children.end());
+            IMPL_TYPED_CHILDREN(GeolocationHint,m_children.end());
+            IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
+
+        protected:
+            void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+                PROC_TYPED_CHILDREN(IPHint,SAML20MD_UI_NS,false);
+                PROC_TYPED_CHILDREN(DomainHint,SAML20MD_UI_NS,false);
+                PROC_TYPED_CHILDREN(GeolocationHint,SAML20MD_UI_NS,false);
+
+                // Unknown child.
+                const XMLCh* nsURI=root->getNamespaceURI();
+                if (!XMLString::equals(nsURI,SAML20MD_UI_NS) && nsURI && *nsURI) {
+                    getUnknownXMLObjects().push_back(childXMLObject);
+                    return;
+                }
+
+                AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
             }
         };
 
@@ -2498,6 +2986,22 @@ IMPL_XMLOBJECTBUILDER(TelephoneNumber);
 
 IMPL_XMLOBJECTBUILDER(ActionNamespace);
 IMPL_XMLOBJECTBUILDER(SourceID);
+IMPL_XMLOBJECTBUILDER(DiscoveryResponse);
+IMPL_XMLOBJECTBUILDER(RequestInitiator);
+IMPL_XMLOBJECTBUILDER(EntityAttributes);
+IMPL_XMLOBJECTBUILDER(DigestMethod);
+IMPL_XMLOBJECTBUILDER(SigningMethod);
+IMPL_XMLOBJECTBUILDER(DisplayName);
+IMPL_XMLOBJECTBUILDER(Description);
+IMPL_XMLOBJECTBUILDER(Keywords);
+IMPL_XMLOBJECTBUILDER(Logo);
+IMPL_XMLOBJECTBUILDER(InformationURL);
+IMPL_XMLOBJECTBUILDER(PrivacyStatementURL);
+IMPL_XMLOBJECTBUILDER(UIInfo);
+IMPL_XMLOBJECTBUILDER(IPHint);
+IMPL_XMLOBJECTBUILDER(DomainHint);
+IMPL_XMLOBJECTBUILDER(GeolocationHint);
+IMPL_XMLOBJECTBUILDER(DiscoHints);
 
 #ifdef HAVE_COVARIANT_RETURNS
 RoleDescriptor* RoleDescriptorBuilder::buildObject(
@@ -2510,6 +3014,101 @@ xmltooling::XMLObject* RoleDescriptorBuilder::buildObject(
     return new RoleDescriptorTypeImpl(nsURI,localName,prefix,schemaType);
 }
 
+const DigestMethod* RoleDescriptor::getDigestMethod() const
+{
+    bool roleLevel = false;
+    XMLToolingConfig& conf = XMLToolingConfig::getConfig();
+
+    if (getExtensions()) {
+        const vector<XMLObject*>& exts = const_cast<const Extensions*>(getExtensions())->getUnknownXMLObjects();
+        for (vector<XMLObject*>::const_iterator i = exts.begin(); i != exts.end(); ++i) {
+            const opensaml::saml2md::DigestMethod* dm = dynamic_cast<opensaml::saml2md::DigestMethod*>(*i);
+            if (dm) {
+                if (dm->getAlgorithm() && conf.isXMLAlgorithmSupported(dm->getAlgorithm(), XMLToolingConfig::ALGTYPE_DIGEST))
+                    return dm;
+                roleLevel = true;
+            }
+        }
+    }
+
+    if (!roleLevel) {
+        const EntityDescriptor* entity = dynamic_cast<EntityDescriptor*>(getParent());
+        if (entity && entity->getExtensions()) {
+            const vector<XMLObject*>& exts = const_cast<const Extensions*>(entity->getExtensions())->getUnknownXMLObjects();
+            for (vector<XMLObject*>::const_iterator i = exts.begin(); i != exts.end(); ++i) {
+                const opensaml::saml2md::DigestMethod* dm = dynamic_cast<opensaml::saml2md::DigestMethod*>(*i);
+                if (dm && dm->getAlgorithm() && conf.isXMLAlgorithmSupported(dm->getAlgorithm(), XMLToolingConfig::ALGTYPE_DIGEST))
+                    return dm;
+            }
+        }
+    }
+
+    return nullptr;
+}
+
+pair<const SigningMethod*,const Credential*> RoleDescriptor::getSigningMethod(const CredentialResolver& resolver, CredentialCriteria& cc) const
+{
+    bool roleLevel = false;
+    XMLToolingConfig& conf = XMLToolingConfig::getConfig();
+
+    if (getExtensions()) {
+        const vector<XMLObject*>& exts = const_cast<const Extensions*>(getExtensions())->getUnknownXMLObjects();
+        for (vector<XMLObject*>::const_iterator i = exts.begin(); i != exts.end(); ++i) {
+            const SigningMethod* sm = dynamic_cast<SigningMethod*>(*i);
+            if (sm) {
+                roleLevel = true;
+                if (sm->getAlgorithm() && conf.isXMLAlgorithmSupported(sm->getAlgorithm(), XMLToolingConfig::ALGTYPE_SIGN)) {
+                    cc.setXMLAlgorithm(sm->getAlgorithm());
+                    pair<bool,int> minsize = sm->getMinKeySize(), maxsize = sm->getMaxKeySize();
+                    if (minsize.first || maxsize.first) {
+                        cc.setKeySize(minsize.first ? minsize.second : 0);
+                        cc.setMaxKeySize(maxsize.first ? maxsize.second : UINT_MAX);
+                    }
+                    else {
+                        cc.setKeySize(0);
+                        cc.setMaxKeySize(0);
+                    }
+                    const Credential* cred = resolver.resolve(&cc);
+                    if (cred)
+                        return make_pair(sm, cred);
+                }
+            }
+        }
+    }
+
+    if (!roleLevel) {
+        const EntityDescriptor* entity = dynamic_cast<EntityDescriptor*>(getParent());
+        if (entity && entity->getExtensions()) {
+            const vector<XMLObject*>& exts = const_cast<const Extensions*>(entity->getExtensions())->getUnknownXMLObjects();
+            for (vector<XMLObject*>::const_iterator i = exts.begin(); i != exts.end(); ++i) {
+                const SigningMethod* sm = dynamic_cast<SigningMethod*>(*i);
+                if (sm) {
+                    if (sm->getAlgorithm() && conf.isXMLAlgorithmSupported(sm->getAlgorithm(), XMLToolingConfig::ALGTYPE_SIGN)) {
+                        cc.setXMLAlgorithm(sm->getAlgorithm());
+                        pair<bool,int> minsize = sm->getMinKeySize(), maxsize = sm->getMaxKeySize();
+                        if (minsize.first || maxsize.first) {
+                            cc.setKeySize(minsize.first ? minsize.second : 0);
+                            cc.setMaxKeySize(maxsize.first ? maxsize.second : UINT_MAX);
+                        }
+                        else {
+                            cc.setKeySize(0);
+                            cc.setMaxKeySize(0);
+                        }
+                        const Credential* cred = resolver.resolve(&cc);
+                        if (cred)
+                            return make_pair(sm, cred);
+                    }
+                }
+            }
+        }
+    }
+
+    cc.setKeySize(0);
+    cc.setMaxKeySize(0);
+    cc.setXMLAlgorithm(nullptr);
+    return pair<const SigningMethod*,const Credential*>(nullptr, resolver.resolve(&cc));
+}
+
 const XMLCh ActionNamespace::LOCAL_NAME[] =             UNICODE_LITERAL_15(A,c,t,i,o,n,N,a,m,e,s,p,a,c,e);
 const XMLCh AdditionalMetadataLocation::LOCAL_NAME[] =  UNICODE_LITERAL_26(A,d,d,i,t,i,o,n,a,l,M,e,t,a,d,a,t,a,L,o,c,a,t,i,o,n);
 const XMLCh AdditionalMetadataLocation::TYPE_NAME[] =   UNICODE_LITERAL_30(A,d,d,i,t,i,o,n,a,l,M,e,t,a,d,a,t,a,L,o,c,a,t,i,o,n,T,y,p,e);
@@ -2550,6 +3149,15 @@ const XMLCh ContactPerson::CONTACT_SUPPORT[] =          UNICODE_LITERAL_7(s,u,p,
 const XMLCh ContactPerson::CONTACT_ADMINISTRATIVE[] =   UNICODE_LITERAL_14(a,d,m,i,n,i,s,t,r,a,t,i,v,e);
 const XMLCh ContactPerson::CONTACT_BILLING[] =          UNICODE_LITERAL_7(b,i,l,l,i,n,g);
 const XMLCh ContactPerson::CONTACT_OTHER[] =            UNICODE_LITERAL_5(o,t,h,e,r);
+const XMLCh Description::LOCAL_NAME[] =                 UNICODE_LITERAL_11(D,e,s,c,r,i,p,t,i,o,n);
+const XMLCh DigestMethod::LOCAL_NAME[] =                UNICODE_LITERAL_12(D,i,g,e,s,t,M,e,t,h,o,d);
+const XMLCh DigestMethod::TYPE_NAME[] =                 UNICODE_LITERAL_16(D,i,g,e,s,t,M,e,t,h,o,d,T,y,p,e);
+const XMLCh DigestMethod::ALGORITHM_ATTRIB_NAME[] =     UNICODE_LITERAL_9(A,l,g,o,r,i,t,h,m);
+const XMLCh DiscoHints::LOCAL_NAME[] =                  UNICODE_LITERAL_10(D,i,s,c,o,H,i,n,t,s);
+const XMLCh DiscoHints::TYPE_NAME[] =                   UNICODE_LITERAL_14(D,i,s,c,o,H,i,n,t,s,T,y,p,e);
+const XMLCh DiscoveryResponse::LOCAL_NAME[] =           UNICODE_LITERAL_17(D,i,s,c,o,v,e,r,y,R,e,s,p,o,n,s,e);
+const XMLCh DisplayName::LOCAL_NAME[] =                 UNICODE_LITERAL_11(D,i,s,p,l,a,y,N,a,m,e);
+const XMLCh DomainHint::LOCAL_NAME[] =                  UNICODE_LITERAL_10(D,o,m,a,i,n,H,i,n,t);
 const XMLCh EmailAddress::LOCAL_NAME[] =                UNICODE_LITERAL_12(E,m,a,i,l,A,d,d,r,e,s,s);
 const XMLCh EndpointType::LOCAL_NAME[] =                {chNull};
 const XMLCh EndpointType::TYPE_NAME[] =                 UNICODE_LITERAL_12(E,n,d,p,o,i,n,t,T,y,p,e);
@@ -2564,8 +3172,11 @@ const XMLCh EntityDescriptor::LOCAL_NAME[] =            UNICODE_LITERAL_16(E,n,t
 const XMLCh EntityDescriptor::TYPE_NAME[] =             UNICODE_LITERAL_20(E,n,t,i,t,y,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
 const XMLCh EntityDescriptor::ID_ATTRIB_NAME[] =        UNICODE_LITERAL_2(I,D);
 const XMLCh EntityDescriptor::ENTITYID_ATTRIB_NAME[] =  UNICODE_LITERAL_8(e,n,t,i,t,y,I,D);
+const XMLCh EntityAttributes::LOCAL_NAME[] =            UNICODE_LITERAL_16(E,n,t,i,t,y,A,t,t,r,i,b,u,t,e,s);
+const XMLCh EntityAttributes::TYPE_NAME[] =             UNICODE_LITERAL_20(E,n,t,i,t,y,A,t,t,r,i,b,u,t,e,s,T,y,p,e);
 const XMLCh Extensions::LOCAL_NAME[] =                  UNICODE_LITERAL_10(E,x,t,e,n,s,i,o,n,s);
 const XMLCh Extensions::TYPE_NAME[] =                   UNICODE_LITERAL_14(E,x,t,e,n,s,i,o,n,s,T,y,p,e);
+const XMLCh GeolocationHint::LOCAL_NAME[] =             UNICODE_LITERAL_15(G,e,o,l,o,c,a,t,i,o,n,H,i,n,t);
 const XMLCh GivenName::LOCAL_NAME[] =                   UNICODE_LITERAL_9(G,i,v,e,n,N,a,m,e);
 const XMLCh IDPSSODescriptor::LOCAL_NAME[] =            UNICODE_LITERAL_16(I,D,P,S,S,O,D,e,s,c,r,i,p,t,o,r);
 const XMLCh IDPSSODescriptor::TYPE_NAME[] =             UNICODE_LITERAL_20(I,D,P,S,S,O,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
@@ -2574,11 +3185,21 @@ const XMLCh IndexedEndpointType::LOCAL_NAME[] =         {chNull};
 const XMLCh IndexedEndpointType::TYPE_NAME[] =          UNICODE_LITERAL_19(I,n,d,e,x,e,d,E,n,d,p,o,i,n,t,T,y,p,e);
 const XMLCh IndexedEndpointType::INDEX_ATTRIB_NAME[] =  UNICODE_LITERAL_5(i,n,d,e,x);
 const XMLCh IndexedEndpointType::ISDEFAULT_ATTRIB_NAME[] =  UNICODE_LITERAL_9(i,s,D,e,f,a,u,l,t);
+const XMLCh InformationURL::LOCAL_NAME[] =              UNICODE_LITERAL_14(I,n,f,o,r,m,a,t,i,o,n,U,R,L);
+const XMLCh IPHint::LOCAL_NAME[] =                      UNICODE_LITERAL_6(I,P,H,i,n,t);
 const XMLCh KeyDescriptor::LOCAL_NAME[] =               UNICODE_LITERAL_13(K,e,y,D,e,s,c,r,i,p,t,o,r);
 const XMLCh KeyDescriptor::TYPE_NAME[] =                UNICODE_LITERAL_17(K,e,y,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
 const XMLCh KeyDescriptor::USE_ATTRIB_NAME[] =          UNICODE_LITERAL_3(u,s,e);
 const XMLCh KeyDescriptor::KEYTYPE_ENCRYPTION[] =       UNICODE_LITERAL_10(e,n,c,r,y,p,t,i,o,n);
 const XMLCh KeyDescriptor::KEYTYPE_SIGNING[] =          UNICODE_LITERAL_7(s,i,g,n,i,n,g);
+const XMLCh Keywords::LOCAL_NAME[] =                                   UNICODE_LITERAL_8(K,e,y,w,o,r,d,s);
+const XMLCh Keywords::TYPE_NAME[] =                                            UNICODE_LITERAL_12(K,e,y,w,o,r,d,s,T,y,p,e);
+const XMLCh Keywords::LANG_ATTRIB_NAME[] =              UNICODE_LITERAL_4(l,a,n,g);
+const XMLCh Logo::LOCAL_NAME[] =                        UNICODE_LITERAL_4(L,o,g,o);
+const XMLCh Logo::TYPE_NAME[] =                         UNICODE_LITERAL_8(L,o,g,o,T,y,p,e);
+const XMLCh Logo::LANG_ATTRIB_NAME[] =                  UNICODE_LITERAL_4(l,a,n,g);
+const XMLCh Logo::HEIGHT_ATTRIB_NAME[] =                UNICODE_LITERAL_6(h,e,i,g,h,t);
+const XMLCh Logo::WIDTH_ATTRIB_NAME[] =                 UNICODE_LITERAL_5(w,i,d,t,h);
 const XMLCh localizedNameType::LOCAL_NAME[] =           {chNull};
 const XMLCh localizedNameType::TYPE_NAME[] =            UNICODE_LITERAL_17(l,o,c,a,l,i,z,e,d,N,a,m,e,T,y,p,e);
 const XMLCh localizedNameType::LANG_ATTRIB_NAME[] =     UNICODE_LITERAL_4(l,a,n,g);
@@ -2595,18 +3216,25 @@ const XMLCh OrganizationDisplayName::LOCAL_NAME[] =     UNICODE_LITERAL_23(O,r,g
 const XMLCh OrganizationURL::LOCAL_NAME[] =             UNICODE_LITERAL_15(O,r,g,a,n,i,z,a,t,i,o,n,U,R,L);
 const XMLCh PDPDescriptor::LOCAL_NAME[] =               UNICODE_LITERAL_13(P,D,P,D,e,s,c,r,i,p,t,o,r);
 const XMLCh PDPDescriptor::TYPE_NAME[] =                UNICODE_LITERAL_17(P,D,P,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
+const XMLCh PrivacyStatementURL::LOCAL_NAME[] =         UNICODE_LITERAL_19(P,r,i,v,a,c,y,S,t,a,t,e,m,e,n,t,U,R,L);
 const XMLCh QueryDescriptorType::LOCAL_NAME[] =         {chNull};
 const XMLCh QueryDescriptorType::TYPE_NAME[] =          UNICODE_LITERAL_19(Q,u,e,r,y,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
 const XMLCh QueryDescriptorType::WANTASSERTIONSSIGNED_ATTRIB_NAME[] =   UNICODE_LITERAL_20(W,a,n,t,A,s,s,e,r,t,i,o,n,s,S,i,g,n,e,d);
 const XMLCh RequestedAttribute::LOCAL_NAME[] =          UNICODE_LITERAL_18(R,e,q,u,e,s,t,e,d,A,t,t,r,i,b,u,t,e);
 const XMLCh RequestedAttribute::TYPE_NAME[] =           UNICODE_LITERAL_22(R,e,q,u,e,s,t,e,d,A,t,t,r,i,b,u,t,e,T,y,p,e);
 const XMLCh RequestedAttribute::ISREQUIRED_ATTRIB_NAME[] =  UNICODE_LITERAL_10(i,s,R,e,q,u,i,r,e,d);
+const XMLCh RequestInitiator::LOCAL_NAME[] =            UNICODE_LITERAL_16(R,e,q,u,e,s,t,I,n,i,t,i,a,t,o,r);
 const XMLCh RoleDescriptor::LOCAL_NAME[] =              UNICODE_LITERAL_14(R,o,l,e,D,e,s,c,r,i,p,t,o,r);
 const XMLCh RoleDescriptor::ID_ATTRIB_NAME[] =          UNICODE_LITERAL_2(I,D);
 const XMLCh RoleDescriptor::PROTOCOLSUPPORTENUMERATION_ATTRIB_NAME[] =  UNICODE_LITERAL_26(p,r,o,t,o,c,o,l,S,u,p,p,o,r,t,E,n,u,m,e,r,a,t,i,o,n);
 const XMLCh RoleDescriptor::ERRORURL_ATTRIB_NAME[] =    UNICODE_LITERAL_8(e,r,r,o,r,U,R,L);
 const XMLCh ServiceDescription::LOCAL_NAME[] =          UNICODE_LITERAL_18(S,e,r,v,i,c,e,D,e,s,c,r,i,p,t,i,o,n);
 const XMLCh ServiceName::LOCAL_NAME[] =                 UNICODE_LITERAL_11(S,e,r,v,i,c,e,N,a,m,e);
+const XMLCh SigningMethod::LOCAL_NAME[] =               UNICODE_LITERAL_13(S,i,g,n,i,n,g,M,e,t,h,o,d);
+const XMLCh SigningMethod::TYPE_NAME[] =                UNICODE_LITERAL_17(S,i,g,n,i,n,g,M,e,t,h,o,d,T,y,p,e);
+const XMLCh SigningMethod::ALGORITHM_ATTRIB_NAME[] =    UNICODE_LITERAL_9(A,l,g,o,r,i,t,h,m);
+const XMLCh SigningMethod::MINKEYSIZE_ATTRIB_NAME[] =   UNICODE_LITERAL_10(M,i,n,K,e,y,S,i,z,e);
+const XMLCh SigningMethod::MAXKEYSIZE_ATTRIB_NAME[] =   UNICODE_LITERAL_10(M,a,x,K,e,y,S,i,z,e);
 const XMLCh SingleLogoutService::LOCAL_NAME[] =         UNICODE_LITERAL_19(S,i,n,g,l,e,L,o,g,o,u,t,S,e,r,v,i,c,e);
 const XMLCh SingleSignOnService::LOCAL_NAME[] =         UNICODE_LITERAL_19(S,i,n,g,l,e,S,i,g,n,O,n,S,e,r,v,i,c,e);
 const XMLCh SourceID::LOCAL_NAME[] =                    UNICODE_LITERAL_8(S,o,u,r,c,e,I,D);
@@ -2619,3 +3247,5 @@ const XMLCh SSODescriptorType::TYPE_NAME[] =            UNICODE_LITERAL_17(S,S,O
 const XMLCh SurName::LOCAL_NAME[] =                     UNICODE_LITERAL_7(S,u,r,N,a,m,e);
 const XMLCh TelephoneNumber::LOCAL_NAME[] =             UNICODE_LITERAL_15(T,e,l,e,p,h,o,n,e,N,u,m,b,e,r);
 const XMLCh TimeBoundSAMLObject::VALIDUNTIL_ATTRIB_NAME[] =   UNICODE_LITERAL_10(v,a,l,i,d,U,n,t,i,l);
+const XMLCh UIInfo::LOCAL_NAME[] =                      UNICODE_LITERAL_6(U,I,I,n,f,o);
+const XMLCh UIInfo::TYPE_NAME[] =                       UNICODE_LITERAL_10(U,I,I,n,f,o,T,y,p,e);