First metadata check-in, misc. fixes.
authorScott Cantor <cantor.2@osu.edu>
Mon, 19 Jun 2006 03:05:28 +0000 (03:05 +0000)
committerScott Cantor <cantor.2@osu.edu>
Mon, 19 Jun 2006 03:05:28 +0000 (03:05 +0000)
14 files changed:
.cdtproject
saml/Makefile.am
saml/SAMLConfig.cpp
saml/saml.vcproj
saml/saml1/core/Protocols.h
saml/saml1/core/impl/ProtocolsImpl.cpp
saml/saml2/core/impl/Assertions20Impl.cpp
saml/saml2/core/impl/Assertions20SchemaValidators.cpp
saml/saml2/metadata/Metadata.h [new file with mode: 0644]
saml/saml2/metadata/impl/MetadataImpl.cpp [new file with mode: 0644]
saml/saml2/metadata/impl/MetadataSchemaValidators.cpp [new file with mode: 0644]
samltest/signature/SAML1AssertionTest.h
samltest/signature/SAML1RequestTest.h
samltest/signature/SAML1ResponseTest.h

index 90f5f41..6a24918 100644 (file)
 <pathentry include="C:/cxxtest" kind="inc" path="" system="true"/>\r
 <pathentry kind="out" path=""/>\r
 <pathentry kind="con" path="org.eclipse.cdt.make.core.DISCOVERED_SCANNER_INFO"/>\r
-<pathentry excluding="util/|saml1/|signature/|saml2/|encryption/" kind="src" path="saml"/>\r
+<pathentry excluding="util/|saml1/|signature/|saml2/|encryption/|saml2/metadata/impl/" kind="src" path="saml"/>\r
 <pathentry excluding="impl/" kind="src" path="saml/saml1/core"/>\r
 <pathentry kind="src" path="saml/saml1/core/impl"/>\r
 <pathentry excluding="impl/" kind="src" path="saml/saml2/core"/>\r
 <pathentry kind="src" path="saml/saml2/core/impl"/>\r
-<pathentry kind="src" path="saml/saml2/metadata"/>\r
+<pathentry excluding="impl/" kind="src" path="saml/saml2/metadata"/>\r
+<pathentry kind="src" path="saml/saml2/metadata/impl"/>\r
 <pathentry kind="src" path="saml/encryption"/>\r
 <pathentry kind="src" path="saml/signature"/>\r
 <pathentry kind="src" path="saml/util"/>\r
index 28ae43d..f42e634 100644 (file)
@@ -14,6 +14,8 @@ saml1coreincludedir = $(includedir)/saml/saml1/core
 
 saml2coreincludedir = $(includedir)/saml/saml2/core
 
+saml2mdincludedir = $(includedir)/saml/saml2/metadata
+
 libsamlinclude_HEADERS = \
        base.h \
        exceptions.h \
@@ -38,6 +40,9 @@ saml1coreinclude_HEADERS = \
 saml2coreinclude_HEADERS = \
        saml2/core/Assertions.h
 
+saml2mdinclude_HEADERS = \
+       saml2/metadata/Metadata.h
+
 noinst_HEADERS = \
        internal.h
 
@@ -50,6 +55,8 @@ libsaml_la_SOURCES = \
        saml1/core/impl/ProtocolsSchemaValidators.cpp \
        saml2/core/impl/Assertions20Impl.cpp \
        saml2/core/impl/Assertions20SchemaValidators.cpp \
+       saml2/metadata/impl/MetadataImpl.cpp \
+       saml2/metadata/impl/MetadataSchemaValidators.cpp \
        signature/ContentReference.cpp \
        signature/SignatureProfileValidator.cpp \
        util/SAMLConstants.cpp
index efd3e1c..d7c1042 100644 (file)
@@ -27,7 +27,7 @@
 #include "SAMLConfig.h"
 #include "saml1/core/Assertions.h"
 #include "saml1/core/Protocols.h"
-#include "saml2/core/Assertions.h"
+#include "saml2/metadata/Metadata.h"
 #include "util/SAMLConstants.h"
 
 #include <xmltooling/XMLToolingConfig.h>
@@ -74,6 +74,7 @@ bool SAMLInternalConfig::init()
     saml1::registerAssertionClasses();
     saml1p::registerProtocolClasses();
     saml2::registerAssertionClasses();
+    saml2md::registerMetadataClasses();
 
     log.info("library initialization complete");
     return true;
index 0bae7b3..6bdb719 100644 (file)
                                        <Filter\r
                                                Name="impl"\r
                                                >\r
+                                               <File\r
+                                                       RelativePath=".\saml2\metadata\impl\MetadataImpl.cpp"\r
+                                                       >\r
+                                               </File>\r
+                                               <File\r
+                                                       RelativePath=".\saml2\metadata\impl\MetadataSchemaValidators.cpp"\r
+                                                       >\r
+                                               </File>\r
                                        </Filter>\r
                                </Filter>\r
                        </Filter>\r
index 8b72e45..cd69ea4 100644 (file)
@@ -74,15 +74,17 @@ namespace opensaml {
             static const XMLCh TYPE_NAME[];
         END_XMLOBJECT;
 
-        BEGIN_XMLOBJECT(SAML_API,AbstractRequest,SignableObject,SAML 1.x RequestAbstractType base type);
+        BEGIN_XMLOBJECT(SAML_API,RequestAbstractType,SignableObject,SAML 1.x RequestAbstractType base type);
             DECL_INTEGER_ATTRIB(MinorVersion,MINORVERSION);
             DECL_STRING_ATTRIB(RequestID,REQUESTID);
             DECL_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT);
             DECL_TYPED_CHILDREN(RespondWith);
             DECL_TYPED_FOREIGN_CHILD(Signature,xmlsignature);
+            /** RequestAbstractType local name */
+            static const XMLCh TYPE_NAME[];
         END_XMLOBJECT;
 
-        BEGIN_XMLOBJECT(SAML_API,Request,AbstractRequest,SAML 1.x Request element);
+        BEGIN_XMLOBJECT(SAML_API,Request,RequestAbstractType,SAML 1.x Request element);
             DECL_TYPED_CHILD(Query);
             DECL_TYPED_CHILD(SubjectQuery);
             DECL_TYPED_CHILD(AuthenticationQuery);
@@ -123,16 +125,18 @@ namespace opensaml {
             static const XMLCh TYPE_NAME[];
         END_XMLOBJECT;
 
-        BEGIN_XMLOBJECT(SAML_API,AbstractResponse,SignableObject,SAML 1.x ResponseAbstractType base type);
+        BEGIN_XMLOBJECT(SAML_API,ResponseAbstractType,SignableObject,SAML 1.x ResponseAbstractType base type);
             DECL_INTEGER_ATTRIB(MinorVersion,MINORVERSION);
             DECL_STRING_ATTRIB(ResponseID,RESPONSEID);
             DECL_STRING_ATTRIB(InResponseTo,INRESPONSETO);
             DECL_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT);
             DECL_STRING_ATTRIB(Recipient,RECIPIENT);
             DECL_TYPED_FOREIGN_CHILD(Signature,xmlsignature);
+            /** ResponseAbstractType local name */
+            static const XMLCh TYPE_NAME[];
         END_XMLOBJECT;
 
-        BEGIN_XMLOBJECT(SAML_API,Response,AbstractResponse,SAML 1.x Response element);
+        BEGIN_XMLOBJECT(SAML_API,Response,ResponseAbstractType,SAML 1.x Response element);
             DECL_TYPED_CHILD(Status);
             DECL_TYPED_FOREIGN_CHILDREN(Assertion,saml1);
             /** ResponseType local name */
index b2261f9..af7797b 100644 (file)
@@ -299,7 +299,7 @@ namespace opensaml {
             }
         };
 
-        class SAML_DLLLOCAL AbstractRequestImpl : public virtual AbstractRequest,
+        class SAML_DLLLOCAL RequestAbstractTypeImpl : public virtual RequestAbstractType,
             public AbstractComplexElement,
             public AbstractDOMCachingXMLObject,
             public AbstractValidatingXMLObject,
@@ -315,21 +315,21 @@ namespace opensaml {
                 m_pos_Signature=m_children.begin();
             }
         protected:
-            AbstractRequestImpl() {
+            RequestAbstractTypeImpl() {
                 init();
             }
         public:
-            virtual ~AbstractRequestImpl() {
+            virtual ~RequestAbstractTypeImpl() {
                 XMLString::release(&m_RequestID);
                 delete m_IssueInstant;
             }
     
-            AbstractRequestImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+            RequestAbstractTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
                 init();
             }
                 
-            AbstractRequestImpl(const AbstractRequestImpl& src)
+            RequestAbstractTypeImpl(const RequestAbstractTypeImpl& src)
                     : AbstractXMLObject(src),
                         AbstractDOMCachingXMLObject(src),
                         AbstractValidatingXMLObject(src) {
@@ -381,10 +381,10 @@ namespace opensaml {
                 domElement->setAttributeNS(NULL,MAJORVERSION,ONE);
                 MARSHALL_INTEGER_ATTRIB(MinorVersion,MINORVERSION,NULL);
                 if (!m_RequestID)
-                    const_cast<AbstractRequestImpl*>(this)->m_RequestID=SAMLConfig::getConfig().generateIdentifier();
+                    const_cast<RequestAbstractTypeImpl*>(this)->m_RequestID=SAMLConfig::getConfig().generateIdentifier();
                 MARSHALL_ID_ATTRIB(RequestID,REQUESTID,NULL);
                 if (!m_IssueInstant)
-                    const_cast<AbstractRequestImpl*>(this)->m_IssueInstant=new DateTime(time(NULL));
+                    const_cast<RequestAbstractTypeImpl*>(this)->m_IssueInstant=new DateTime(time(NULL));
                 MARSHALL_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,NULL);
             }
 
@@ -406,7 +406,7 @@ namespace opensaml {
             }
         };
 
-        class SAML_DLLLOCAL RequestImpl : public virtual Request, public AbstractRequestImpl
+        class SAML_DLLLOCAL RequestImpl : public virtual Request, public RequestAbstractTypeImpl
         {
             void init() {
                 m_children.push_back(NULL);
@@ -423,7 +423,7 @@ namespace opensaml {
             }
                 
             RequestImpl(const RequestImpl& src)
-                    : AbstractXMLObject(src), AbstractRequestImpl(src) {
+                    : AbstractXMLObject(src), RequestAbstractTypeImpl(src) {
                 init();
                 if (src.getQuery())
                     setQuery(src.getQuery()->cloneQuery());
@@ -442,7 +442,7 @@ namespace opensaml {
             }
             
             IMPL_XMLOBJECT_CLONE(Request);
-            AbstractRequest* cloneAbstractRequest() const {
+            RequestAbstractType* cloneRequestAbstractType() const {
                 return cloneRequest();
             }
             IMPL_TYPED_CHILD(Query);
@@ -481,7 +481,7 @@ namespace opensaml {
                 PROC_TYPED_CHILD(Query,SAMLConstants::SAML1P_NS,true);
                 PROC_TYPED_CHILDREN(AssertionIDReference,SAMLConstants::SAML1_NS,false);
                 PROC_TYPED_CHILDREN(AssertionArtifact,SAMLConstants::SAML1P_NS,false);
-                AbstractRequestImpl::processChildElement(childXMLObject,root);
+                RequestAbstractTypeImpl::processChildElement(childXMLObject,root);
             }
         };
 
@@ -621,7 +621,7 @@ namespace opensaml {
             }
         };
 
-        class SAML_DLLLOCAL AbstractResponseImpl : public virtual AbstractResponse,
+        class SAML_DLLLOCAL ResponseAbstractTypeImpl : public virtual ResponseAbstractType,
             public AbstractComplexElement,
             public AbstractDOMCachingXMLObject,
             public AbstractValidatingXMLObject,
@@ -639,23 +639,23 @@ namespace opensaml {
                 m_pos_Signature=m_children.begin();
             }
         protected:
-            AbstractResponseImpl() {
+            ResponseAbstractTypeImpl() {
                 init();
             }
         public:
-            virtual ~AbstractResponseImpl() {
+            virtual ~ResponseAbstractTypeImpl() {
                 XMLString::release(&m_ResponseID);
                 XMLString::release(&m_InResponseTo);
                 XMLString::release(&m_Recipient);
                 delete m_IssueInstant;
             }
     
-            AbstractResponseImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+            ResponseAbstractTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
                 init();
             }
                 
-            AbstractResponseImpl(const AbstractResponseImpl& src)
+            ResponseAbstractTypeImpl(const ResponseAbstractTypeImpl& src)
                     : AbstractXMLObject(src),
                         AbstractDOMCachingXMLObject(src),
                         AbstractValidatingXMLObject(src) {
@@ -704,11 +704,11 @@ namespace opensaml {
                 domElement->setAttributeNS(NULL,MAJORVERSION,ONE);
                 MARSHALL_INTEGER_ATTRIB(MinorVersion,MINORVERSION,NULL);
                 if (!m_ResponseID)
-                    const_cast<AbstractResponseImpl*>(this)->m_ResponseID=SAMLConfig::getConfig().generateIdentifier();
+                    const_cast<ResponseAbstractTypeImpl*>(this)->m_ResponseID=SAMLConfig::getConfig().generateIdentifier();
                 MARSHALL_ID_ATTRIB(ResponseID,RESPONSEID,NULL);
                 MARSHALL_STRING_ATTRIB(InResponseTo,INRESPONSETO,NULL);
                 if (!m_IssueInstant)
-                    const_cast<AbstractResponseImpl*>(this)->m_IssueInstant=new DateTime(time(NULL));
+                    const_cast<ResponseAbstractTypeImpl*>(this)->m_IssueInstant=new DateTime(time(NULL));
                 MARSHALL_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,NULL);
                 MARSHALL_STRING_ATTRIB(Recipient,RECIPIENT,NULL);
             }
@@ -732,7 +732,7 @@ namespace opensaml {
             }
         };
 
-        class SAML_DLLLOCAL ResponseImpl : public virtual Response, public AbstractResponseImpl
+        class SAML_DLLLOCAL ResponseImpl : public virtual Response, public ResponseAbstractTypeImpl
         {
             void init() {
                 m_children.push_back(NULL);
@@ -749,7 +749,7 @@ namespace opensaml {
             }
                 
             ResponseImpl(const ResponseImpl& src)
-                    : AbstractXMLObject(src), AbstractResponseImpl(src) {
+                    : AbstractXMLObject(src), ResponseAbstractTypeImpl(src) {
                 init();
                 if (src.getStatus())
                     setStatus(src.getStatus()->cloneStatus());
@@ -762,7 +762,7 @@ namespace opensaml {
             }
             
             IMPL_XMLOBJECT_CLONE(Response);
-            AbstractResponse* cloneAbstractResponse() const {
+            ResponseAbstractType* cloneResponseAbstractType() const {
                 return cloneResponse();
             }
             IMPL_TYPED_CHILD(Status);
@@ -772,7 +772,7 @@ namespace opensaml {
             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
                 PROC_TYPED_CHILD(Status,SAMLConstants::SAML1P_NS,false);
                 PROC_TYPED_CHILDREN(Assertion,SAMLConstants::SAML1_NS,true);
-                AbstractResponseImpl::processChildElement(childXMLObject,root);
+                ResponseAbstractTypeImpl::processChildElement(childXMLObject,root);
             }
         };
 
@@ -798,14 +798,18 @@ IMPL_XMLOBJECTBUILDER(StatusDetail);
 IMPL_XMLOBJECTBUILDER(StatusMessage);
 
 // Unicode literals
-const XMLCh AbstractRequest::MINORVERSION_ATTRIB_NAME[] =   UNICODE_LITERAL_12(M,i,n,o,r,V,e,r,s,i,o,n);
-const XMLCh AbstractRequest::REQUESTID_ATTRIB_NAME[] =      UNICODE_LITERAL_9(R,e,q,u,e,s,t,I,D);
-const XMLCh AbstractRequest::ISSUEINSTANT_ATTRIB_NAME[] =   UNICODE_LITERAL_12(I,s,s,u,e,I,n,s,t,a,n,t);
-const XMLCh AbstractResponse::MINORVERSION_ATTRIB_NAME[] =  UNICODE_LITERAL_12(M,i,n,o,r,V,e,r,s,i,o,n);
-const XMLCh AbstractResponse::RESPONSEID_ATTRIB_NAME[] =    UNICODE_LITERAL_10(R,e,s,p,o,n,s,e,I,D);
-const XMLCh AbstractResponse::ISSUEINSTANT_ATTRIB_NAME[] =  UNICODE_LITERAL_12(I,s,s,u,e,I,n,s,t,a,n,t);
-const XMLCh AbstractResponse::INRESPONSETO_ATTRIB_NAME[] =  UNICODE_LITERAL_12(I,n,R,e,s,p,o,n,s,e,T,o);
-const XMLCh AbstractResponse::RECIPIENT_ATTRIB_NAME[] =     UNICODE_LITERAL_9(R,e,c,i,p,i,e,n,t);
+const XMLCh RequestAbstractType::LOCAL_NAME[] =             {chNull};
+const XMLCh RequestAbstractType::TYPE_NAME[] =              UNICODE_LITERAL_19(R,e,q,u,e,s,t,A,b,s,t,r,a,c,t,T,y,p,e);
+const XMLCh RequestAbstractType::MINORVERSION_ATTRIB_NAME[] =   UNICODE_LITERAL_12(M,i,n,o,r,V,e,r,s,i,o,n);
+const XMLCh RequestAbstractType::REQUESTID_ATTRIB_NAME[] =      UNICODE_LITERAL_9(R,e,q,u,e,s,t,I,D);
+const XMLCh RequestAbstractType::ISSUEINSTANT_ATTRIB_NAME[] =   UNICODE_LITERAL_12(I,s,s,u,e,I,n,s,t,a,n,t);
+const XMLCh ResponseAbstractType::LOCAL_NAME[] =            {chNull};
+const XMLCh ResponseAbstractType::TYPE_NAME[] =             UNICODE_LITERAL_20(R,e,s,p,o,n,s,e,A,b,s,t,r,a,c,t,T,y,p,e);
+const XMLCh ResponseAbstractType::MINORVERSION_ATTRIB_NAME[] =  UNICODE_LITERAL_12(M,i,n,o,r,V,e,r,s,i,o,n);
+const XMLCh ResponseAbstractType::RESPONSEID_ATTRIB_NAME[] =    UNICODE_LITERAL_10(R,e,s,p,o,n,s,e,I,D);
+const XMLCh ResponseAbstractType::ISSUEINSTANT_ATTRIB_NAME[] =  UNICODE_LITERAL_12(I,s,s,u,e,I,n,s,t,a,n,t);
+const XMLCh ResponseAbstractType::INRESPONSETO_ATTRIB_NAME[] =  UNICODE_LITERAL_12(I,n,R,e,s,p,o,n,s,e,T,o);
+const XMLCh ResponseAbstractType::RECIPIENT_ATTRIB_NAME[] =     UNICODE_LITERAL_9(R,e,c,i,p,i,e,n,t);
 const XMLCh AssertionArtifact::LOCAL_NAME[] =               UNICODE_LITERAL_17(A,s,s,e,r,t,i,o,n,A,r,t,i,f,a,c,t);
 const XMLCh AttributeQuery::LOCAL_NAME[] =                  UNICODE_LITERAL_14(A,t,t,r,i,b,u,t,e,Q,u,e,r,y);
 const XMLCh AttributeQuery::TYPE_NAME[] =                   UNICODE_LITERAL_18(A,t,t,r,i,b,u,t,e,Q,u,e,r,y,T,y,p,e);
index 5d4e58f..57310b3 100644 (file)
@@ -15,7 +15,7 @@
  */
 
 /**
- * AssertionsImpl.cpp
+ * Assertions20Impl.cpp
  * 
  * Implementation classes for SAML 2.0 Assertions schema
  */
@@ -478,16 +478,26 @@ namespace opensaml {
         public:
             void setAttribute(QName& qualifiedName, const XMLCh* value) {
                 if (!qualifiedName.hasNamespaceURI()) {
-                    if (XMLString::equals(qualifiedName.getLocalPart(),NOTBEFORE_ATTRIB_NAME))
+                    if (XMLString::equals(qualifiedName.getLocalPart(),NOTBEFORE_ATTRIB_NAME)) {
                         setNotBefore(value);
-                    else if (XMLString::equals(qualifiedName.getLocalPart(),NOTONORAFTER_ATTRIB_NAME))
+                        return;
+                    }
+                    else if (XMLString::equals(qualifiedName.getLocalPart(),NOTONORAFTER_ATTRIB_NAME)) {
                         setNotOnOrAfter(value);
-                    else if (XMLString::equals(qualifiedName.getLocalPart(),RECIPIENT_ATTRIB_NAME))
+                        return;
+                    }
+                    else if (XMLString::equals(qualifiedName.getLocalPart(),RECIPIENT_ATTRIB_NAME)) {
                         setRecipient(value);
-                    else if (XMLString::equals(qualifiedName.getLocalPart(),INRESPONSETO_ATTRIB_NAME))
+                        return;
+                    }
+                    else if (XMLString::equals(qualifiedName.getLocalPart(),INRESPONSETO_ATTRIB_NAME)) {
                         setInResponseTo(value);
-                    else if (XMLString::equals(qualifiedName.getLocalPart(),ADDRESS_ATTRIB_NAME))
+                        return;
+                    }
+                    else if (XMLString::equals(qualifiedName.getLocalPart(),ADDRESS_ATTRIB_NAME)) {
                         setAddress(value);
+                        return;
+                    }
                 }
                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value);
             }
@@ -561,16 +571,26 @@ namespace opensaml {
         public:
             void setAttribute(QName& qualifiedName, const XMLCh* value) {
                 if (!qualifiedName.hasNamespaceURI()) {
-                    if (XMLString::equals(qualifiedName.getLocalPart(),NOTBEFORE_ATTRIB_NAME))
+                    if (XMLString::equals(qualifiedName.getLocalPart(),NOTBEFORE_ATTRIB_NAME)) {
                         setNotBefore(value);
-                    else if (XMLString::equals(qualifiedName.getLocalPart(),NOTONORAFTER_ATTRIB_NAME))
+                        return;
+                    }
+                    else if (XMLString::equals(qualifiedName.getLocalPart(),NOTONORAFTER_ATTRIB_NAME)) {
                         setNotOnOrAfter(value);
-                    else if (XMLString::equals(qualifiedName.getLocalPart(),RECIPIENT_ATTRIB_NAME))
+                        return;
+                    }
+                    else if (XMLString::equals(qualifiedName.getLocalPart(),RECIPIENT_ATTRIB_NAME)) {
                         setRecipient(value);
-                    else if (XMLString::equals(qualifiedName.getLocalPart(),INRESPONSETO_ATTRIB_NAME))
+                        return;
+                    }
+                    else if (XMLString::equals(qualifiedName.getLocalPart(),INRESPONSETO_ATTRIB_NAME)) {
                         setInResponseTo(value);
-                    else if (XMLString::equals(qualifiedName.getLocalPart(),ADDRESS_ATTRIB_NAME))
+                        return;
+                    }
+                    else if (XMLString::equals(qualifiedName.getLocalPart(),ADDRESS_ATTRIB_NAME)) {
                         setAddress(value);
+                        return;
+                    }
                 }
                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value);
             }
@@ -1025,13 +1045,11 @@ namespace opensaml {
                             continue;
                         }
                         
-                        /*
                         EncryptedAssertion* enc=dynamic_cast<EncryptedAssertion*>(*i);
                         if (enc) {
                             getEncryptedAssertions().push_back(enc->cloneEncryptedAssertion());
                             continue;
                         }
-                        */
                     }
                 }
             }
@@ -1040,14 +1058,14 @@ namespace opensaml {
             IMPL_TYPED_CHILDREN(AssertionIDRef,m_children.end());
             IMPL_TYPED_CHILDREN(AssertionURIRef,m_children.end());
             IMPL_TYPED_CHILDREN(Assertion,m_children.end());
-            //IMPL_TYPED_CHILDREN(EncryptedAssertion,m_children.end());
+            IMPL_TYPED_CHILDREN(EncryptedAssertion,m_children.end());
     
         protected:
             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
                 PROC_TYPED_CHILDREN(AssertionIDRef,SAMLConstants::SAML20_NS,false);
                 PROC_TYPED_CHILDREN(AssertionURIRef,SAMLConstants::SAML20_NS,false);
                 PROC_TYPED_CHILDREN(Assertion,SAMLConstants::SAML20_NS,false);
-                //PROC_TYPED_CHILDREN(EncryptedAssertion,SAMLConstants::SAML20_NS,false);
+                PROC_TYPED_CHILDREN(EncryptedAssertion,SAMLConstants::SAML20_NS,false);
                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
             }
         };
@@ -1186,12 +1204,18 @@ namespace opensaml {
     
             void setAttribute(QName& qualifiedName, const XMLCh* value) {
                 if (!qualifiedName.hasNamespaceURI()) {
-                    if (XMLString::equals(qualifiedName.getLocalPart(),NAME_ATTRIB_NAME))
+                    if (XMLString::equals(qualifiedName.getLocalPart(),NAME_ATTRIB_NAME)) {
                         setName(value);
-                    else if (XMLString::equals(qualifiedName.getLocalPart(),NAMEFORMAT_ATTRIB_NAME))
+                        return;
+                    }
+                    else if (XMLString::equals(qualifiedName.getLocalPart(),NAMEFORMAT_ATTRIB_NAME)) {
                         setNameFormat(value);
-                    else if (XMLString::equals(qualifiedName.getLocalPart(),FRIENDLYNAME_ATTRIB_NAME))
+                        return;
+                    }
+                    else if (XMLString::equals(qualifiedName.getLocalPart(),FRIENDLYNAME_ATTRIB_NAME)) {
                         setFriendlyName(value);
+                        return;
+                    }
                 }
                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value);
             }
index 703a109..0ad267e 100644 (file)
@@ -15,7 +15,7 @@
  */
 
 /**
- * AssertionsSchemaValidators.cpp
+ * Assertions20SchemaValidators.cpp
  * 
  * Schema-based validators for SAML 2.0 Assertions classes
  */
diff --git a/saml/saml2/metadata/Metadata.h b/saml/saml2/metadata/Metadata.h
new file mode 100644 (file)
index 0000000..305407a
--- /dev/null
@@ -0,0 +1,469 @@
+/*
+ *  Copyright 2001-2006 Internet2
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     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.
+ */
+
+/**
+ * @file Metadata.h
+ * 
+ * XMLObjects representing the SAML 2.0 Metadata schema
+ */
+
+#ifndef __saml2_metadata_h__
+#define __saml2_metadata_h__
+
+#include <saml/saml2/core/Assertions.h>
+#include <saml/util/SAMLConstants.h>
+
+#include <xmltooling/AttributeExtensibleXMLObject.h>
+#include <xmltooling/ElementProxy.h>
+#include <xmltooling/SimpleElement.h>
+#include <xmltooling/XMLObjectBuilder.h>
+#include <xmltooling/encryption/Encryption.h>
+#include <xmltooling/signature/KeyInfo.h>
+#include <xmltooling/signature/Signature.h>
+#include <xmltooling/util/DateTime.h>
+#include <xmltooling/validation/ValidatingXMLObject.h>
+
+#define DECL_SAML2MDOBJECTBUILDER(cname) \
+    DECL_XMLOBJECTBUILDER(SAML_API,cname,opensaml::SAMLConstants::SAML20MD_NS,opensaml::SAMLConstants::SAML20MD_PREFIX)
+
+namespace opensaml {
+
+    /**
+     * @namespace saml2md
+     * SAML 2.0 metadata namespace
+     */
+    namespace saml2md {
+        
+        DECL_XMLOBJECT_SIMPLE(SAML_API,AffiliateMember,ID,SAML 2.0 AffiliateMember element);
+        DECL_XMLOBJECT_SIMPLE(SAML_API,AttributeProfile,ProfileURI,SAML 2.0 AttributeProfile element);
+        DECL_XMLOBJECT_SIMPLE(SAML_API,Company,Name,SAML 2.0 Company element);
+        DECL_XMLOBJECT_SIMPLE(SAML_API,EmailAddress,Address,SAML 2.0 EmailAddress element);
+        DECL_XMLOBJECT_SIMPLE(SAML_API,GivenName,Name,SAML 2.0 GivenName element);
+        DECL_XMLOBJECT_SIMPLE(SAML_API,NameIDFormat,Format,SAML 2.0 NameIDFormat element);
+        DECL_XMLOBJECT_SIMPLE(SAML_API,SurName,Name,SAML 2.0 SurName element);
+        DECL_XMLOBJECT_SIMPLE(SAML_API,TelephoneNumber,Number,SAML 2.0 TelephoneNumber element);
+
+        BEGIN_XMLOBJECT(SAML_API,localizedNameType,xmltooling::SimpleElement,SAML 2.0 localizedNameType type);
+            DECL_STRING_ATTRIB(Lang,LANG);
+            /** localizedNameType local name */
+            static const XMLCh TYPE_NAME[];
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,localizedURIType,xmltooling::SimpleElement,SAML 2.0 localizedURIType type);
+            DECL_STRING_ATTRIB(Lang,LANG);
+            /** localizedURIType local name */
+            static const XMLCh TYPE_NAME[];
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,OrganizationName,localizedNameType,SAML 2.0 OrganizationName element);
+            DECL_XMLOBJECT_CONTENT(Name);
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,OrganizationDisplayName,localizedNameType,SAML 2.0 OrganizationDisplayName element);
+            DECL_XMLOBJECT_CONTENT(Name);
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,OrganizationURL,localizedURIType,SAML 2.0 OrganizationURL element);
+            DECL_XMLOBJECT_CONTENT(URL);
+        END_XMLOBJECT;
+        
+        BEGIN_XMLOBJECT(SAML_API,Extensions,xmltooling::ElementProxy,SAML 2.0 Extensions element);
+            /** ExtensionsType local name */
+            static const XMLCh TYPE_NAME[];
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,Organization,xmltooling::AttributeExtensibleXMLObject,SAML 2.0 Organization element);
+            DECL_TYPED_CHILD(Extensions);
+            DECL_TYPED_CHILDREN(OrganizationName);
+            DECL_TYPED_CHILDREN(OrganizationDisplayName);
+            DECL_TYPED_CHILDREN(OrganizationURL);
+            /** OrganizationType local name */
+            static const XMLCh TYPE_NAME[];
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,ContactPerson,xmltooling::AttributeExtensibleXMLObject,SAML 2.0 ContactPerson element);
+            DECL_STRING_ATTRIB(ContactType,CONTACTTYPE);
+            DECL_TYPED_CHILD(Extensions);
+            DECL_TYPED_CHILD(Company);
+            DECL_TYPED_CHILD(GivenName);
+            DECL_TYPED_CHILD(SurName);
+            DECL_TYPED_CHILDREN(EmailAddress);
+            DECL_TYPED_CHILDREN(TelephoneNumber);
+            /** ContactType local name */
+            static const XMLCh TYPE_NAME[];
+            /** technical Contact Type */
+            static const XMLCh CONTACT_TECHNICAL[];
+            /** support Contact Type */
+            static const XMLCh CONTACT_SUPPORT[];
+            /** administrative Contact Type */
+            static const XMLCh CONTACT_ADMINISTRATIVE[];
+            /** billing Contact Type */
+            static const XMLCh CONTACT_BILLING[];
+            /** other Contact Type */
+            static const XMLCh CONTACT_OTHER[];
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,AdditionalMetadataLocation,xmltooling::SimpleElement,SAML 2.0 AdditionalMetadataLocation element);
+            DECL_STRING_ATTRIB(Namespace,NAMESPACE);
+            DECL_XMLOBJECT_CONTENT(Location);
+            /** AdditionalMetadataLocationType local name */
+            static const XMLCh TYPE_NAME[];
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,KeyDescriptor,xmltooling::XMLObject,SAML 2.0 KeyDescriptor element);
+            DECL_STRING_ATTRIB(Use,USE);
+            DECL_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature);
+            DECL_TYPED_FOREIGN_CHILDREN(EncryptionMethod,xmlencryption);
+            /** KeyDescriptorType local name */
+            static const XMLCh TYPE_NAME[];
+            /** encryption Key Type */
+            static const XMLCh KEYTYPE_ENCRYPTION[];
+            /** signing Key Type */
+            static const XMLCh KEYTYPE_SIGNING[];
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT2(SAML_API,RoleDescriptor,xmltooling::AttributeExtensibleXMLObject,SignableObject,SAML 2.0 RoleDescriptor abstract element);
+            DECL_STRING_ATTRIB(ID,ID);
+            DECL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL);
+            DECL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION);
+            DECL_STRING_ATTRIB(ProtocolSupportEnumeration,PROTOCOLSUPPORTENUMERATION);
+            DECL_STRING_ATTRIB(ErrorURL,ERRORURL);
+            DECL_TYPED_FOREIGN_CHILD(Signature,xmlsignature);
+            DECL_TYPED_CHILD(Extensions);
+            DECL_TYPED_CHILDREN(KeyDescriptor);
+            DECL_TYPED_CHILD(Organization);
+            DECL_TYPED_CHILDREN(ContactPerson);
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT2(SAML_API,EndpointType,xmltooling::ElementProxy,xmltooling::AttributeExtensibleXMLObject,SAML 2.0 EndpointType type);
+            DECL_STRING_ATTRIB(Binding,BINDING);
+            DECL_STRING_ATTRIB(Location,LOCATION);
+            DECL_STRING_ATTRIB(ResponseLocation,RESPONSELOCATION);
+            /** EndpointType local name */
+            static const XMLCh TYPE_NAME[];
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,IndexedEndpointType,EndpointType,SAML 2.0 IndexedEndpointType type);
+            DECL_INTEGER_ATTRIB(Index,INDEX);
+            DECL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT);
+            /** IndexedEndpointType local name */
+            static const XMLCh TYPE_NAME[];
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,ArtifactResolutionService,IndexedEndpointType,SAML 2.0 ArtifactResolutionService element);
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,SingleLogoutService,EndpointType,SAML 2.0 SingleLogoutService element);
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,ManageNameIDService,EndpointType,SAML 2.0 ManageNameIDService element);
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,SSODescriptorType,RoleDescriptor,SAML 2.0 SSODescriptorType abstract type);
+            DECL_TYPED_CHILDREN(ArtifactResolutionService);
+            DECL_TYPED_CHILDREN(SingleLogoutService);
+            DECL_TYPED_CHILDREN(ManageNameIDService);
+            DECL_TYPED_CHILDREN(NameIDFormat);
+            /** SSODescriptorType local name */
+            static const XMLCh TYPE_NAME[];
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,SingleSignOnService,EndpointType,SAML 2.0 SingleSignOnService element);
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,NameIDMappingService,EndpointType,SAML 2.0 NameIDMappingService element);
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,AssertionIDRequestService,EndpointType,SAML 2.0 AssertionIDRequestService element);
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,IDPSSODescriptor,SSODescriptorType,SAML 2.0 IDPSSODescriptor element);
+            DECL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned,WANTAUTHNREQUESTSSIGNED);
+            DECL_TYPED_CHILDREN(SingleSignOnService);
+            DECL_TYPED_CHILDREN(NameIDMappingService);
+            DECL_TYPED_CHILDREN(AssertionIDRequestService);
+            DECL_TYPED_CHILDREN(AttributeProfile);
+            DECL_TYPED_FOREIGN_CHILDREN(Attribute,saml2);
+            /** IDPSSODescriptorType local name */
+            static const XMLCh TYPE_NAME[];
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,ServiceName,localizedNameType,SAML 2.0 ServiceName element);
+            DECL_XMLOBJECT_CONTENT(Name);
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,ServiceDescription,localizedNameType,SAML 2.0 ServiceDescription element);
+            DECL_XMLOBJECT_CONTENT(Description);
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,RequestedAttribute,saml2::Attribute,SAML 2.0 RequestedAttribute element);
+            DECL_BOOLEAN_ATTRIB(isRequired,ISREQUIRED);
+            /** RequestedAttributeType local name */
+            static const XMLCh TYPE_NAME[];
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,AttributeConsumingService,xmltooling::XMLObject,SAML 2.0 AttributeConsumingService element);
+            DECL_INTEGER_ATTRIB(Index,INDEX);
+            DECL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT);
+            DECL_TYPED_CHILDREN(ServiceName);
+            DECL_TYPED_CHILDREN(ServiceDescription);
+            DECL_TYPED_CHILDREN(RequestedAttribute);
+            /** AttributeConsumingServiceType local name */
+            static const XMLCh TYPE_NAME[];
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,AssertionConsumerService,IndexedEndpointType,SAML 2.0 AssertionConsumerService element);
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,SPSSODescriptor,SSODescriptorType,SAML 2.0 SPSSODescriptor element);
+            DECL_BOOLEAN_ATTRIB(AuthnRequestsSigned,AUTHNREQUESTSSIGNED);
+            DECL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED);
+            DECL_TYPED_CHILDREN(AssertionConsumerService);
+            DECL_TYPED_CHILDREN(AttributeConsumingService);
+            /** SPSSODescriptorType local name */
+            static const XMLCh TYPE_NAME[];
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,AuthnQueryService,EndpointType,SAML 2.0 AuthnQueryService element);
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,AuthnAuthorityDescriptor,RoleDescriptor,SAML 2.0 AuthnAuthorityDescriptor element);
+            DECL_TYPED_CHILDREN(AuthnQueryService);
+            DECL_TYPED_CHILDREN(AssertionIDRequestService);
+            DECL_TYPED_CHILDREN(NameIDFormat);
+            /** AuthnAuthorityDescriptorType local name */
+            static const XMLCh TYPE_NAME[];
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,AuthzService,EndpointType,SAML 2.0 AuthzService element);
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,PDPDescriptor,RoleDescriptor,SAML 2.0 PDPDescriptor element);
+            DECL_TYPED_CHILDREN(AuthzService);
+            DECL_TYPED_CHILDREN(AssertionIDRequestService);
+            DECL_TYPED_CHILDREN(NameIDFormat);
+            /** PDPDescriptorType local name */
+            static const XMLCh TYPE_NAME[];
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,AttributeService,EndpointType,SAML 2.0 AttributeService element);
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,AttributeAuthorityDescriptor,RoleDescriptor,SAML 2.0 AttributeAuthorityDescriptor element);
+            DECL_TYPED_CHILDREN(AttributeService);
+            DECL_TYPED_CHILDREN(AssertionIDRequestService);
+            DECL_TYPED_CHILDREN(NameIDFormat);
+            DECL_TYPED_CHILDREN(AttributeProfile);
+            DECL_TYPED_FOREIGN_CHILDREN(Attribute,saml2);
+            /** AttributeAuthorityDescriptorType local name */
+            static const XMLCh TYPE_NAME[];
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT2(SAML_API,AffiliationDescriptor,xmltooling::AttributeExtensibleXMLObject,SignableObject,SAML 2.0 AffiliationDescriptor element);
+            DECL_STRING_ATTRIB(ID,ID);
+            DECL_STRING_ATTRIB(AffiliationOwnerID,AFFILIATIONOWNERID);
+            DECL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL);
+            DECL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION);
+            DECL_TYPED_FOREIGN_CHILD(Signature,xmlsignature);
+            DECL_TYPED_CHILD(Extensions);
+            DECL_TYPED_CHILDREN(AffiliateMember);
+            DECL_TYPED_CHILDREN(KeyDescriptor);
+            /** AffiliationDescriptorType local name */
+            static const XMLCh TYPE_NAME[];
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT2(SAML_API,EntityDescriptor,xmltooling::AttributeExtensibleXMLObject,SignableObject,SAML 2.0 EntityDescriptor element);
+            DECL_STRING_ATTRIB(ID,ID);
+            DECL_STRING_ATTRIB(EntityID,ENTITYID);
+            DECL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL);
+            DECL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION);
+            DECL_TYPED_FOREIGN_CHILD(Signature,xmlsignature);
+            DECL_TYPED_CHILD(Extensions);
+            DECL_TYPED_CHILD(AffiliationDescriptor);
+            DECL_TYPED_CHILDREN(RoleDescriptor);
+            DECL_TYPED_CHILDREN(IDPSSODescriptor);
+            DECL_TYPED_CHILDREN(SPSSODescriptor);
+            DECL_TYPED_CHILDREN(AuthnAuthorityDescriptor);
+            DECL_TYPED_CHILDREN(AttributeAuthorityDescriptor);
+            DECL_TYPED_CHILDREN(PDPDescriptor);
+            /** EntityDescriptorType local name */
+            static const XMLCh TYPE_NAME[];
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,EntitiesDescriptor,SignableObject,SAML 2.0 EntitiesDescriptor element);
+            DECL_STRING_ATTRIB(ID,ID);
+            DECL_STRING_ATTRIB(Name,NAME);
+            DECL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL);
+            DECL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION);
+            DECL_TYPED_FOREIGN_CHILD(Signature,xmlsignature);
+            DECL_TYPED_CHILD(Extensions);
+            DECL_TYPED_CHILDREN(EntityDescriptor);
+            DECL_TYPED_CHILDREN(EntitiesDescriptor);
+            /** EntitiesDescriptorType local name */
+            static const XMLCh TYPE_NAME[];
+        END_XMLOBJECT;
+
+        DECL_SAML2MDOBJECTBUILDER(AdditionalMetadataLocation);
+        DECL_SAML2MDOBJECTBUILDER(AffiliateMember);
+        DECL_SAML2MDOBJECTBUILDER(AffiliationDescriptor);
+        DECL_SAML2MDOBJECTBUILDER(ArtifactResolutionService);
+        DECL_SAML2MDOBJECTBUILDER(AssertionConsumerService);
+        DECL_SAML2MDOBJECTBUILDER(AssertionIDRequestService);
+        DECL_SAML2MDOBJECTBUILDER(AttributeAuthorityDescriptor);
+        DECL_SAML2MDOBJECTBUILDER(AttributeConsumingService);
+        DECL_SAML2MDOBJECTBUILDER(AttributeProfile);
+        DECL_SAML2MDOBJECTBUILDER(AttributeService);
+        DECL_SAML2MDOBJECTBUILDER(AuthnAuthorityDescriptor);
+        DECL_SAML2MDOBJECTBUILDER(AuthnQueryService);
+        DECL_SAML2MDOBJECTBUILDER(AuthzService);
+        DECL_SAML2MDOBJECTBUILDER(Company);
+        DECL_SAML2MDOBJECTBUILDER(ContactPerson);
+        DECL_SAML2MDOBJECTBUILDER(EmailAddress);
+        DECL_SAML2MDOBJECTBUILDER(EntitiesDescriptor);
+        DECL_SAML2MDOBJECTBUILDER(EntityDescriptor);
+        DECL_SAML2MDOBJECTBUILDER(Extensions);
+        DECL_SAML2MDOBJECTBUILDER(GivenName);
+        DECL_SAML2MDOBJECTBUILDER(IDPSSODescriptor);
+        DECL_SAML2MDOBJECTBUILDER(KeyDescriptor);
+        DECL_SAML2MDOBJECTBUILDER(ManageNameIDService);
+        DECL_SAML2MDOBJECTBUILDER(NameIDFormat);
+        DECL_SAML2MDOBJECTBUILDER(NameIDMappingService);
+        DECL_SAML2MDOBJECTBUILDER(Organization);
+        DECL_SAML2MDOBJECTBUILDER(OrganizationName);
+        DECL_SAML2MDOBJECTBUILDER(OrganizationDisplayName);
+        DECL_SAML2MDOBJECTBUILDER(OrganizationURL);
+        DECL_SAML2MDOBJECTBUILDER(PDPDescriptor);
+        DECL_SAML2MDOBJECTBUILDER(RequestedAttribute);
+        DECL_SAML2MDOBJECTBUILDER(ServiceDescription);
+        DECL_SAML2MDOBJECTBUILDER(ServiceName);
+        DECL_SAML2MDOBJECTBUILDER(SingleLogoutService);
+        DECL_SAML2MDOBJECTBUILDER(SingleSignOnService);
+        DECL_SAML2MDOBJECTBUILDER(SPSSODescriptor);
+        DECL_SAML2MDOBJECTBUILDER(SurName);
+        DECL_SAML2MDOBJECTBUILDER(TelephoneNumber);
+
+        /**
+         * Builder for localizedNameType objects.
+         * 
+         * This is customized to force the element name to be specified.
+         */
+        class SAML_API localizedNameTypeBuilder : public xmltooling::XMLObjectBuilder {
+        public:
+            virtual ~localizedNameTypeBuilder() {}
+            /** Builder that allows element/type override. */
+            virtual localizedNameType* buildObject(
+                const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
+                ) const;
+        
+            /** Singleton builder. */
+            static localizedNameType* buildlocalizedNameType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL) {
+                const localizedNameTypeBuilder* b = dynamic_cast<const localizedNameTypeBuilder*>(
+                    XMLObjectBuilder::getBuilder(xmltooling::QName(SAMLConstants::SAML20MD_NS,localizedNameType::TYPE_NAME))
+                    );
+                if (b) {
+                    xmltooling::QName schemaType(SAMLConstants::SAML20MD_NS,localizedNameType::TYPE_NAME,SAMLConstants::SAML20MD_PREFIX);
+                    return b->buildObject(nsURI, localName, prefix, &schemaType);
+                }
+                throw xmltooling::XMLObjectException("Unable to obtain typed builder for localizedNameType.");
+            }
+        };
+
+        /**
+         * Builder for localizedURIType objects.
+         * 
+         * This is customized to force the element name to be specified.
+         */
+        class SAML_API localizedURITypeBuilder : public xmltooling::XMLObjectBuilder {
+        public:
+            virtual ~localizedURITypeBuilder() {}
+            /** Builder that allows element/type override. */
+            virtual localizedURIType* buildObject(
+                const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
+                ) const;
+        
+            /** Singleton builder. */
+            static localizedURIType* buildlocalizedURIType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL) {
+                const localizedURITypeBuilder* b = dynamic_cast<const localizedURITypeBuilder*>(
+                    XMLObjectBuilder::getBuilder(xmltooling::QName(SAMLConstants::SAML20MD_NS,localizedURIType::TYPE_NAME))
+                    );
+                if (b) {
+                    xmltooling::QName schemaType(SAMLConstants::SAML20MD_NS,localizedURIType::TYPE_NAME,SAMLConstants::SAML20MD_PREFIX);
+                    return b->buildObject(nsURI, localName, prefix, &schemaType);
+                }
+                throw xmltooling::XMLObjectException("Unable to obtain typed builder for localizedURIType.");
+            }
+        };
+
+        /**
+         * Builder for EndpointType objects.
+         * 
+         * This is customized to force the element name to be specified.
+         */
+        class SAML_API EndpointTypeBuilder : public xmltooling::XMLObjectBuilder {
+        public:
+            virtual ~EndpointTypeBuilder() {}
+            /** Builder that allows element/type override. */
+            virtual EndpointType* buildObject(
+                const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
+                ) const;
+        
+            /** Singleton builder. */
+            static EndpointType* buildEndpointType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL) {
+                const EndpointTypeBuilder* b = dynamic_cast<const EndpointTypeBuilder*>(
+                    XMLObjectBuilder::getBuilder(xmltooling::QName(SAMLConstants::SAML20MD_NS,EndpointType::TYPE_NAME))
+                    );
+                if (b) {
+                    xmltooling::QName schemaType(SAMLConstants::SAML20MD_NS,EndpointType::TYPE_NAME,SAMLConstants::SAML20MD_PREFIX);
+                    return b->buildObject(nsURI, localName, prefix, &schemaType);
+                }
+                throw xmltooling::XMLObjectException("Unable to obtain typed builder for EndpointType.");
+            }
+        };
+
+        /**
+         * Builder for IndexedEndpointType objects.
+         * 
+         * This is customized to force the element name to be specified.
+         */
+        class SAML_API IndexedEndpointTypeBuilder : public xmltooling::XMLObjectBuilder {
+        public:
+            virtual ~IndexedEndpointTypeBuilder() {}
+            /** Builder that allows element/type override. */
+            virtual IndexedEndpointType* buildObject(
+                const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
+                ) const;
+        
+            /** Singleton builder. */
+            static IndexedEndpointType* buildIndexedEndpointType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL) {
+                const IndexedEndpointTypeBuilder* b = dynamic_cast<const IndexedEndpointTypeBuilder*>(
+                    XMLObjectBuilder::getBuilder(xmltooling::QName(SAMLConstants::SAML20MD_NS,IndexedEndpointType::TYPE_NAME))
+                    );
+                if (b) {
+                    xmltooling::QName schemaType(SAMLConstants::SAML20MD_NS,IndexedEndpointType::TYPE_NAME,SAMLConstants::SAML20MD_PREFIX);
+                    return b->buildObject(nsURI, localName, prefix, &schemaType);
+                }
+                throw xmltooling::XMLObjectException("Unable to obtain typed builder for IndexedEndpointType.");
+            }
+        };
+
+        /**
+         * Registers builders and validators for Metadata classes into the runtime.
+         */
+        void SAML_API registerMetadataClasses();
+    };
+};
+
+#endif /* __saml2_metadata_h__ */
diff --git a/saml/saml2/metadata/impl/MetadataImpl.cpp b/saml/saml2/metadata/impl/MetadataImpl.cpp
new file mode 100644 (file)
index 0000000..4ff0864
--- /dev/null
@@ -0,0 +1,2413 @@
+/*
+ *  Copyright 2001-2006 Internet2
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     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.
+ */
+
+/**
+ * MetadataImpl.cpp
+ * 
+ * Implementation classes for SAML 2.0 Assertions schema
+ */
+
+#include "internal.h"
+#include "exceptions.h"
+#include "saml2/metadata/Metadata.h"
+
+#include <xmltooling/AbstractChildlessElement.h>
+#include <xmltooling/AbstractComplexElement.h>
+#include <xmltooling/AbstractElementProxy.h>
+#include <xmltooling/AbstractSimpleElement.h>
+#include <xmltooling/impl/AnyElement.h>
+#include <xmltooling/io/AbstractXMLObjectMarshaller.h>
+#include <xmltooling/io/AbstractXMLObjectUnmarshaller.h>
+#include <xmltooling/util/XMLHelper.h>
+#include <xmltooling/validation/AbstractValidatingXMLObject.h>
+
+#include <ctime>
+#include <xercesc/util/XMLUniDefs.hpp>
+
+using namespace opensaml::saml2md;
+using namespace opensaml::saml2;
+using namespace opensaml;
+using namespace xmlencryption;
+using namespace xmlsignature;
+using namespace xmltooling;
+using namespace std;
+
+#if defined (_MSC_VER)
+    #pragma warning( push )
+    #pragma warning( disable : 4250 4251 )
+#endif
+
+namespace opensaml {
+    namespace saml2md {
+
+        DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,AffiliateMember);
+        DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,AttributeProfile);
+        DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,Company);
+        DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,EmailAddress);
+        DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,GivenName);
+        DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,NameIDFormat);
+        DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,SurName);
+        DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,TelephoneNumber);
+
+        class SAML_DLLLOCAL localizedNameTypeImpl : public virtual localizedNameType,
+            public AbstractSimpleElement,
+            public AbstractChildlessElement,
+            public AbstractDOMCachingXMLObject,
+            public AbstractValidatingXMLObject,
+            public AbstractXMLObjectMarshaller,
+            public AbstractXMLObjectUnmarshaller
+        {
+            void init() {
+                m_Lang=NULL;
+            }
+            
+        protected:
+            localizedNameTypeImpl() {
+                init();
+            }
+            
+        public:
+            virtual ~localizedNameTypeImpl() {
+                XMLString::release(&m_Lang);
+            }
+    
+            localizedNameTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                    : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+                init();
+            }
+                
+            localizedNameTypeImpl(const localizedNameTypeImpl& src)
+                    : AbstractXMLObject(src), AbstractSimpleElement(src),
+                        AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) {
+                init();
+                setLang(src.getLang());
+            }
+            
+            IMPL_XMLOBJECT_CLONE(localizedNameType);
+            IMPL_XMLOBJECT_CONTENT;
+            IMPL_STRING_ATTRIB(Lang);
+    
+        protected:
+            void marshallAttributes(DOMElement* domElement) const {
+                MARSHALL_STRING_ATTRIB(Lang,LANG,XMLConstants::XML_NS);
+            }
+
+            void processAttribute(const DOMAttr* attribute) {
+                PROC_STRING_ATTRIB(Lang,LANG,XMLConstants::XML_NS);
+                AbstractXMLObjectUnmarshaller::processAttribute(attribute);
+            }
+        };
+
+        class SAML_DLLLOCAL localizedURITypeImpl : public virtual localizedURIType,
+            public AbstractSimpleElement,
+            public AbstractChildlessElement,
+            public AbstractDOMCachingXMLObject,
+            public AbstractValidatingXMLObject,
+            public AbstractXMLObjectMarshaller,
+            public AbstractXMLObjectUnmarshaller
+        {
+            void init() {
+                m_Lang=NULL;
+            }
+            
+        protected:
+            localizedURITypeImpl() {
+                init();
+            }
+            
+        public:
+            virtual ~localizedURITypeImpl() {
+                XMLString::release(&m_Lang);
+            }
+    
+            localizedURITypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                    : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+                init();
+            }
+                
+            localizedURITypeImpl(const localizedURITypeImpl& src)
+                    : AbstractXMLObject(src), AbstractSimpleElement(src),
+                        AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) {
+                init();
+                setLang(src.getLang());
+            }
+            
+            IMPL_XMLOBJECT_CLONE(localizedURIType);
+            IMPL_XMLOBJECT_CONTENT;
+            IMPL_STRING_ATTRIB(Lang);
+    
+        protected:
+            void marshallAttributes(DOMElement* domElement) const {
+                MARSHALL_STRING_ATTRIB(Lang,LANG,XMLConstants::XML_NS);
+            }
+
+            void processAttribute(const DOMAttr* attribute) {
+                PROC_STRING_ATTRIB(Lang,LANG,XMLConstants::XML_NS);
+                AbstractXMLObjectUnmarshaller::processAttribute(attribute);
+            }
+        };
+
+        class SAML_DLLLOCAL OrganizationNameImpl : public virtual OrganizationName, public localizedNameTypeImpl
+        {
+        public:
+            virtual ~OrganizationNameImpl() {}
+    
+            OrganizationNameImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
+                
+            OrganizationNameImpl(const OrganizationNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
+            
+            IMPL_XMLOBJECT_CLONE(OrganizationName);
+            localizedNameType* clonelocalizedNameType() const {
+                return new OrganizationNameImpl(*this);
+            }
+        };
+               
+        class SAML_DLLLOCAL OrganizationDisplayNameImpl : public virtual OrganizationDisplayName, public localizedNameTypeImpl
+        {
+        public:
+            virtual ~OrganizationDisplayNameImpl() {}
+    
+            OrganizationDisplayNameImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
+                
+            OrganizationDisplayNameImpl(const OrganizationDisplayNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
+            
+            IMPL_XMLOBJECT_CLONE(OrganizationDisplayName);
+            localizedNameType* clonelocalizedNameType() const {
+                return new OrganizationDisplayNameImpl(*this);
+            }
+        };
+
+        class SAML_DLLLOCAL OrganizationURLImpl : public virtual OrganizationURL, public localizedURITypeImpl
+        {
+        public:
+            virtual ~OrganizationURLImpl() {}
+    
+            OrganizationURLImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
+                
+            OrganizationURLImpl(const OrganizationURLImpl& src) : AbstractXMLObject(src), localizedURITypeImpl(src) {}
+            
+            IMPL_XMLOBJECT_CLONE(OrganizationURL);
+            localizedURIType* clonelocalizedURIType() const {
+                return new OrganizationURLImpl(*this);
+            }
+        };
+
+        class SAML_DLLLOCAL ServiceNameImpl : public virtual ServiceName, public localizedNameTypeImpl
+        {
+        public:
+            virtual ~ServiceNameImpl() {}
+    
+            ServiceNameImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
+                
+            ServiceNameImpl(const ServiceNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
+            
+            IMPL_XMLOBJECT_CLONE(ServiceName);
+            localizedNameType* clonelocalizedNameType() const {
+                return new ServiceNameImpl(*this);
+            }
+        };
+
+        class SAML_DLLLOCAL ServiceDescriptionImpl : public virtual ServiceDescription, public localizedNameTypeImpl
+        {
+        public:
+            virtual ~ServiceDescriptionImpl() {}
+    
+            ServiceDescriptionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
+                
+            ServiceDescriptionImpl(const ServiceDescriptionImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
+            
+            IMPL_XMLOBJECT_CLONE(ServiceDescription);
+            localizedNameType* clonelocalizedNameType() const {
+                return new ServiceDescriptionImpl(*this);
+            }
+        };
+
+        class SAML_DLLLOCAL ExtensionsImpl : public virtual Extensions,
+            public AbstractDOMCachingXMLObject,
+            public AbstractElementProxy,
+            public AbstractValidatingXMLObject,
+            public AbstractXMLObjectMarshaller,
+            public AbstractXMLObjectUnmarshaller
+        {
+        public:
+            virtual ~ExtensionsImpl() {}
+    
+            ExtensionsImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+            }
+                
+            ExtensionsImpl(const ExtensionsImpl& src)
+                    : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractElementProxy(src),
+                        AbstractValidatingXMLObject(src) {
+                for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
+                    if (*i) {
+                        getXMLObjects().push_back((*i)->clone());
+                    }
+                }
+            }
+            
+            IMPL_XMLOBJECT_CLONE(Extensions);
+    
+        protected:
+            void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+                // Unknown child.
+                const XMLCh* nsURI=root->getNamespaceURI();
+                if (!XMLString::equals(nsURI,SAMLConstants::SAML20MD_NS) && nsURI && *nsURI) {
+                    getXMLObjects().push_back(childXMLObject);
+                    return;
+                }
+                
+                AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
+            }
+        };
+
+        class SAML_DLLLOCAL OrganizationImpl : public virtual Organization,
+            public AbstractComplexElement,
+            public AbstractAttributeExtensibleXMLObject,
+            public AbstractDOMCachingXMLObject,
+            public AbstractValidatingXMLObject,
+            public AbstractXMLObjectMarshaller,
+            public AbstractXMLObjectUnmarshaller
+        {
+            list<XMLObject*>::iterator m_pos_OrganizationDisplayName;
+            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_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() {}
+    
+            OrganizationImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+                init();
+            }
+                
+            OrganizationImpl(const OrganizationImpl& src)
+                    : AbstractXMLObject(src),
+                        AbstractAttributeExtensibleXMLObject(src),
+                        AbstractDOMCachingXMLObject(src),
+                        AbstractValidatingXMLObject(src) {
+                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());
+                    }
+                }
+                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());
+                    }
+                }
+                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());
+                    }
+                }
+            }
+            
+            IMPL_XMLOBJECT_CLONE(Organization);
+            IMPL_TYPED_CHILD(Extensions);
+            IMPL_TYPED_CHILDREN(OrganizationName,m_pos_OrganizationDisplayName);
+            IMPL_TYPED_CHILDREN(OrganizationDisplayName,m_pos_OrganizationURL);
+            IMPL_TYPED_CHILDREN(OrganizationURL,m_children.end());
+    
+        protected:
+            void marshallAttributes(DOMElement* domElement) const {
+                // Take care of wildcard.
+                for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
+                    DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
+                    if (i->first.hasPrefix())
+                        attr->setPrefix(i->first.getPrefix());
+                    attr->setNodeValue(i->second);
+                    domElement->setAttributeNode(attr);
+                }
+            }
+
+            void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+                PROC_TYPED_CHILD(Extensions,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(OrganizationName,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(OrganizationDisplayName,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(OrganizationURL,SAMLConstants::SAML20MD_NS,false);
+                AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
+            }
+
+            void processAttribute(const DOMAttr* attribute) {
+                QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix()); 
+                setAttribute(q,attribute->getNodeValue());
+            }
+        };
+
+        class SAML_DLLLOCAL ContactPersonImpl : public virtual ContactPerson,
+            public AbstractComplexElement,
+            public AbstractAttributeExtensibleXMLObject,
+            public AbstractDOMCachingXMLObject,
+            public AbstractValidatingXMLObject,
+            public AbstractXMLObjectMarshaller,
+            public AbstractXMLObjectUnmarshaller
+        {
+            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_pos_Extensions=m_children.begin();
+                m_pos_Company=m_pos_Extensions;
+                ++m_pos_Company;
+                m_pos_GivenName=m_pos_Company;
+                ++m_pos_GivenName;
+                m_pos_SurName=m_pos_GivenName;
+                ++m_pos_SurName;
+                m_pos_TelephoneNumber=m_pos_SurName;
+                ++m_pos_TelephoneNumber;
+            }
+        public:
+            virtual ~ContactPersonImpl() {}
+    
+            ContactPersonImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+                init();
+            }
+                
+            ContactPersonImpl(const ContactPersonImpl& src)
+                    : AbstractXMLObject(src),
+                        AbstractAttributeExtensibleXMLObject(src),
+                        AbstractDOMCachingXMLObject(src),
+                        AbstractValidatingXMLObject(src) {
+                init();
+                if (src.getExtensions())
+                    setExtensions(src.getExtensions()->cloneExtensions());
+                if (src.getCompany())
+                    setCompany(src.getCompany()->cloneCompany());
+                if (src.getGivenName())
+                    setGivenName(src.getGivenName()->cloneGivenName());
+                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());
+                    }
+                }
+                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());
+                    }
+                }
+            }
+            
+            IMPL_XMLOBJECT_CLONE(ContactPerson);
+            IMPL_STRING_ATTRIB(ContactType);
+            IMPL_TYPED_CHILD(Extensions);
+            IMPL_TYPED_CHILD(Company);
+            IMPL_TYPED_CHILD(GivenName);
+            IMPL_TYPED_CHILD(SurName);
+            IMPL_TYPED_CHILDREN(EmailAddress,m_pos_TelephoneNumber);
+            IMPL_TYPED_CHILDREN(TelephoneNumber,m_children.end());
+    
+            void setAttribute(QName& qualifiedName, const XMLCh* value) {
+                if (!qualifiedName.hasNamespaceURI()) {
+                    if (XMLString::equals(qualifiedName.getLocalPart(),CONTACTTYPE_ATTRIB_NAME)) {
+                        setContactType(value);
+                        return;
+                    }
+                }
+                AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value);
+            }
+
+        protected:
+            void marshallAttributes(DOMElement* domElement) const {
+                MARSHALL_STRING_ATTRIB(ContactType,CONTACTTYPE,NULL);
+                
+                // Take care of wildcard.
+                for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
+                    DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
+                    if (i->first.hasPrefix())
+                        attr->setPrefix(i->first.getPrefix());
+                    attr->setNodeValue(i->second);
+                    domElement->setAttributeNode(attr);
+                }
+            }
+
+            void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+                PROC_TYPED_CHILD(Extensions,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILD(Company,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILD(GivenName,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILD(SurName,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(EmailAddress,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(TelephoneNumber,SAMLConstants::SAML20MD_NS,false);
+                AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
+            }
+
+            void processAttribute(const DOMAttr* attribute) {
+                QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix()); 
+                setAttribute(q,attribute->getNodeValue());
+            }
+        };
+
+        class SAML_DLLLOCAL AdditionalMetadataLocationImpl : public virtual AdditionalMetadataLocation,
+            public AbstractSimpleElement,
+            public AbstractChildlessElement,
+            public AbstractDOMCachingXMLObject,
+            public AbstractValidatingXMLObject,
+            public AbstractXMLObjectMarshaller,
+            public AbstractXMLObjectUnmarshaller
+        {
+            void init() {
+                m_Namespace=NULL;
+            }
+            
+        public:
+            virtual ~AdditionalMetadataLocationImpl() {
+                XMLString::release(&m_Namespace);
+            }
+    
+            AdditionalMetadataLocationImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                    : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+                init();
+            }
+                
+            AdditionalMetadataLocationImpl(const AdditionalMetadataLocationImpl& src)
+                    : AbstractXMLObject(src), AbstractSimpleElement(src),
+                        AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) {
+                init();
+            }
+            
+            IMPL_XMLOBJECT_CLONE(AdditionalMetadataLocation);
+            IMPL_XMLOBJECT_CONTENT;
+            IMPL_STRING_ATTRIB(Namespace);
+    
+        protected:
+            void marshallAttributes(DOMElement* domElement) const {
+                MARSHALL_STRING_ATTRIB(Namespace,NAMESPACE,NULL);
+            }
+
+            void processAttribute(const DOMAttr* attribute) {
+                PROC_STRING_ATTRIB(Namespace,NAMESPACE,NULL);
+                AbstractXMLObjectUnmarshaller::processAttribute(attribute);
+            }
+        };
+
+        class SAML_DLLLOCAL KeyDescriptorImpl : public virtual KeyDescriptor,
+            public AbstractComplexElement,
+            public AbstractDOMCachingXMLObject,
+            public AbstractValidatingXMLObject,
+            public AbstractXMLObjectMarshaller,
+            public AbstractXMLObjectUnmarshaller
+        {
+               void init() {
+                m_Use=NULL;
+                m_KeyInfo=NULL;
+                m_children.push_back(NULL);
+                m_pos_KeyInfo=m_children.begin();
+           }
+        public:
+            virtual ~KeyDescriptorImpl() {
+                XMLString::release(&m_Use);
+            }
+    
+            KeyDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+                init();
+            }
+                
+            KeyDescriptorImpl(const KeyDescriptorImpl& src)
+                    : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) {
+                init();
+                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());
+                    }
+                }
+            }
+            
+            IMPL_XMLOBJECT_CLONE(KeyDescriptor);
+            IMPL_STRING_ATTRIB(Use);
+            IMPL_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature);
+            IMPL_TYPED_FOREIGN_CHILDREN(EncryptionMethod,xmlencryption,m_children.end());
+    
+        protected:
+            void marshallAttributes(DOMElement* domElement) const {
+                MARSHALL_STRING_ATTRIB(Use,USE,NULL);
+            }
+
+            void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+                PROC_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature,XMLConstants::XMLSIG_NS,false);
+                PROC_TYPED_FOREIGN_CHILDREN(EncryptionMethod,xmlencryption,XMLConstants::XMLENC_NS,false);
+                AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
+            }
+
+            void processAttribute(const DOMAttr* attribute) {
+                PROC_STRING_ATTRIB(Use,USE,NULL);
+                AbstractXMLObjectUnmarshaller::processAttribute(attribute);
+            }
+        };
+
+        class SAML_DLLLOCAL EndpointTypeImpl : public virtual EndpointType,
+            public AbstractDOMCachingXMLObject,
+            public AbstractElementProxy,
+            public AbstractAttributeExtensibleXMLObject,
+            public AbstractValidatingXMLObject,
+            public AbstractXMLObjectMarshaller,
+            public AbstractXMLObjectUnmarshaller
+        {
+            void init() {
+                m_Binding=m_Location=m_ResponseLocation=NULL;
+            }
+        
+        protected:
+            EndpointTypeImpl() {
+                init();
+            }
+            
+        public:
+            virtual ~EndpointTypeImpl() {
+                XMLString::release(&m_Binding);
+                XMLString::release(&m_Location);
+                XMLString::release(&m_ResponseLocation);
+            }
+    
+            EndpointTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+            }
+                
+            EndpointTypeImpl(const EndpointTypeImpl& src)
+                    : AbstractXMLObject(src),
+                        AbstractDOMCachingXMLObject(src),
+                        AbstractElementProxy(src),
+                        AbstractAttributeExtensibleXMLObject(src),
+                        AbstractValidatingXMLObject(src) {
+                setBinding(src.getBinding());
+                setLocation(src.getLocation());
+                setResponseLocation(src.getResponseLocation());
+                for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
+                    if (*i) {
+                        getXMLObjects().push_back((*i)->clone());
+                    }
+                }
+            }
+            
+            IMPL_XMLOBJECT_CLONE(EndpointType);
+            IMPL_STRING_ATTRIB(Binding);
+            IMPL_STRING_ATTRIB(Location);
+            IMPL_STRING_ATTRIB(ResponseLocation);
+    
+            void setAttribute(QName& qualifiedName, const XMLCh* value) {
+                if (!qualifiedName.hasNamespaceURI()) {
+                    if (XMLString::equals(qualifiedName.getLocalPart(),BINDING_ATTRIB_NAME)) {
+                        setBinding(value);
+                        return;
+                    }
+                    else if (XMLString::equals(qualifiedName.getLocalPart(),LOCATION_ATTRIB_NAME)) {
+                        setLocation(value);
+                        return;
+                    }
+                    else if (XMLString::equals(qualifiedName.getLocalPart(),RESPONSELOCATION_ATTRIB_NAME)) {
+                        setResponseLocation(value);
+                        return;
+                    }
+                }
+                AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value);
+            }
+        protected:
+            void marshallAttributes(DOMElement* domElement) const {
+                MARSHALL_STRING_ATTRIB(Binding,BINDING,NULL);
+                MARSHALL_STRING_ATTRIB(Location,LOCATION,NULL);
+                MARSHALL_STRING_ATTRIB(ResponseLocation,RESPONSELOCATION,NULL);
+                
+                // Take care of wildcard.
+                for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
+                    DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
+                    if (i->first.hasPrefix())
+                        attr->setPrefix(i->first.getPrefix());
+                    attr->setNodeValue(i->second);
+                    domElement->setAttributeNode(attr);
+                }
+            }
+
+            void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+                // Unknown child.
+                const XMLCh* nsURI=root->getNamespaceURI();
+                if (!XMLString::equals(nsURI,SAMLConstants::SAML20MD_NS) && nsURI && *nsURI) {
+                    getXMLObjects().push_back(childXMLObject);
+                    return;
+                }
+                
+                AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
+            }
+
+            void processAttribute(const DOMAttr* attribute) {
+                QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix()); 
+                setAttribute(q,attribute->getNodeValue());
+            }
+        };
+
+        class SAML_DLLLOCAL IndexedEndpointTypeImpl : public virtual IndexedEndpointType, public EndpointTypeImpl
+        {
+            void init() {
+                m_Index=0;
+                m_isDefault=false;
+            }
+        
+        protected:
+            IndexedEndpointTypeImpl() {
+                init();
+            }
+        public:
+            virtual ~IndexedEndpointTypeImpl() {}
+    
+            IndexedEndpointTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
+                
+            IndexedEndpointTypeImpl(const IndexedEndpointTypeImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {
+                setIndex(src.getIndex());
+                isDefault(src.isDefault());
+            }
+            
+            IMPL_XMLOBJECT_CLONE(IndexedEndpointType);
+            EndpointType* cloneEndpointType() const {
+                return new IndexedEndpointTypeImpl(*this);
+            }
+            
+            IMPL_INTEGER_ATTRIB(Index);
+            IMPL_BOOLEAN_ATTRIB(isDefault);
+
+            void setAttribute(QName& qualifiedName, const XMLCh* value) {
+                if (!qualifiedName.hasNamespaceURI()) {
+                    if (XMLString::equals(qualifiedName.getLocalPart(),INDEX_ATTRIB_NAME)) {
+                        setIndex(XMLString::parseInt(value));
+                        return;
+                    }
+                    else if (XMLString::equals(qualifiedName.getLocalPart(),ISDEFAULT_ATTRIB_NAME)) {
+                        if (value) {
+                            if (*value==chLatin_t || *value==chDigit_1)
+                                isDefault(true);
+                            else if (*value==chLatin_f || *value==chDigit_0)
+                                isDefault(false);
+                        }
+                        return;
+                    }
+                }
+                EndpointTypeImpl::setAttribute(qualifiedName, value);
+            }
+        
+        protected:
+            void marshallAttributes(DOMElement* domElement) const {
+                MARSHALL_INTEGER_ATTRIB(Index,INDEX,NULL);
+                MARSHALL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,NULL);
+                EndpointTypeImpl::marshallAttributes(domElement);
+            }
+        };
+
+        class SAML_DLLLOCAL ArtifactResolutionServiceImpl : public virtual ArtifactResolutionService, public IndexedEndpointTypeImpl
+        {
+        public:
+            virtual ~ArtifactResolutionServiceImpl() {}
+    
+            ArtifactResolutionServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
+                
+            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);
+            }
+        };
+
+        class SAML_DLLLOCAL SingleLogoutServiceImpl : public virtual SingleLogoutService, public EndpointTypeImpl
+        {
+        public:
+            virtual ~SingleLogoutServiceImpl() {}
+    
+            SingleLogoutServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
+                
+            SingleLogoutServiceImpl(const SingleLogoutServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
+            
+            IMPL_XMLOBJECT_CLONE(SingleLogoutService);
+            EndpointType* cloneEndpointType() const {
+                return new SingleLogoutServiceImpl(*this);
+            }
+        };
+
+        class SAML_DLLLOCAL ManageNameIDServiceImpl : public virtual ManageNameIDService, public EndpointTypeImpl
+        {
+        public:
+            virtual ~ManageNameIDServiceImpl() {}
+    
+            ManageNameIDServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
+                
+            ManageNameIDServiceImpl(const ManageNameIDServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
+            
+            IMPL_XMLOBJECT_CLONE(ManageNameIDService);
+            EndpointType* cloneEndpointType() const {
+                return new ManageNameIDServiceImpl(*this);
+            }
+        };
+
+        class SAML_DLLLOCAL SingleSignOnServiceImpl : public virtual SingleSignOnService, public EndpointTypeImpl
+        {
+        public:
+            virtual ~SingleSignOnServiceImpl() {}
+    
+            SingleSignOnServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
+                
+            SingleSignOnServiceImpl(const SingleSignOnServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
+            
+            IMPL_XMLOBJECT_CLONE(SingleSignOnService);
+            EndpointType* cloneEndpointType() const {
+                return new SingleSignOnServiceImpl(*this);
+            }
+        };
+
+        class SAML_DLLLOCAL NameIDMappingServiceImpl : public virtual NameIDMappingService, public EndpointTypeImpl
+        {
+        public:
+            virtual ~NameIDMappingServiceImpl() {}
+    
+            NameIDMappingServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
+                
+            NameIDMappingServiceImpl(const NameIDMappingServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
+            
+            IMPL_XMLOBJECT_CLONE(NameIDMappingService);
+            EndpointType* cloneEndpointType() const {
+                return new NameIDMappingServiceImpl(*this);
+            }
+        };
+               
+        class SAML_DLLLOCAL AssertionIDRequestServiceImpl : public virtual AssertionIDRequestService, public EndpointTypeImpl
+        {
+        public:
+            virtual ~AssertionIDRequestServiceImpl() {}
+    
+            AssertionIDRequestServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
+                
+            AssertionIDRequestServiceImpl(const AssertionIDRequestServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
+            
+            IMPL_XMLOBJECT_CLONE(AssertionIDRequestService);
+            EndpointType* cloneEndpointType() const {
+                return new AssertionIDRequestServiceImpl(*this);
+            }
+        };
+
+        class SAML_DLLLOCAL AssertionConsumerServiceImpl : public virtual AssertionConsumerService, public IndexedEndpointTypeImpl
+        {
+        public:
+            virtual ~AssertionConsumerServiceImpl() {}
+    
+            AssertionConsumerServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
+                
+            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);
+            }
+        };
+
+        class SAML_DLLLOCAL AuthnQueryServiceImpl : public virtual AuthnQueryService, public EndpointTypeImpl
+        {
+        public:
+            virtual ~AuthnQueryServiceImpl() {}
+    
+            AuthnQueryServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
+                
+            AuthnQueryServiceImpl(const AuthnQueryServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
+            
+            IMPL_XMLOBJECT_CLONE(AuthnQueryService);
+            EndpointType* cloneEndpointType() const {
+                return new AuthnQueryServiceImpl(*this);
+            }
+        };
+
+        class SAML_DLLLOCAL AuthzServiceImpl : public virtual AuthzService, public EndpointTypeImpl
+        {
+        public:
+            virtual ~AuthzServiceImpl() {}
+    
+            AuthzServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
+                
+            AuthzServiceImpl(const AuthzServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
+            
+            IMPL_XMLOBJECT_CLONE(AuthzService);
+            EndpointType* cloneEndpointType() const {
+                return new AuthzServiceImpl(*this);
+            }
+        };
+
+        class SAML_DLLLOCAL AttributeServiceImpl : public virtual AttributeService, public EndpointTypeImpl
+        {
+        public:
+            virtual ~AttributeServiceImpl() {}
+    
+            AttributeServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
+                
+            AttributeServiceImpl(const AttributeServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
+            
+            IMPL_XMLOBJECT_CLONE(AttributeService);
+            EndpointType* cloneEndpointType() const {
+                return new AttributeServiceImpl(*this);
+            }
+        };
+
+        class SAML_DLLLOCAL RoleDescriptorImpl : public virtual RoleDescriptor,
+            public virtual SignableObject,
+            public AbstractComplexElement,
+            public AbstractAttributeExtensibleXMLObject,
+            public AbstractDOMCachingXMLObject,
+            public AbstractValidatingXMLObject,
+            public AbstractXMLObjectMarshaller,
+            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_pos_Signature=m_children.begin();
+                m_pos_Extensions=m_pos_Signature;
+                ++m_pos_Extensions;
+                m_pos_Organization=m_pos_Extensions;
+                ++m_pos_Organization;
+                m_pos_ContactPerson=m_pos_Organization;
+                ++m_pos_ContactPerson;
+            }
+            
+        protected:
+            list<XMLObject*>::iterator m_pos_ContactPerson;
+
+            RoleDescriptorImpl() {
+                init();
+            }
+            
+        public:
+            virtual ~RoleDescriptorImpl() {
+                XMLString::release(&m_ID);
+                XMLString::release(&m_ProtocolSupportEnumeration);
+                XMLString::release(&m_ErrorURL);
+                delete m_ValidUntil;
+                delete m_CacheDuration;
+            }
+    
+            RoleDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+                init();
+            }
+                
+            RoleDescriptorImpl(const RoleDescriptorImpl& src)
+                    : AbstractXMLObject(src),
+                        AbstractAttributeExtensibleXMLObject(src),
+                        AbstractDOMCachingXMLObject(src),
+                        AbstractValidatingXMLObject(src) {
+                init();
+                setID(src.getID());
+                setProtocolSupportEnumeration(src.getProtocolSupportEnumeration());
+                setErrorURL(src.getErrorURL());
+                setValidUntil(src.getValidUntil());
+                setCacheDuration(src.getCacheDuration());
+                if (src.getSignature())
+                    setSignature(src.getSignature()->cloneSignature());
+                if (src.getExtensions())
+                    setExtensions(src.getExtensions()->cloneExtensions());
+                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());
+                    }
+                }
+                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());
+                    }
+                }
+            }
+
+            const XMLCh* getId() const {
+                return getID();
+            }
+
+            //IMPL_TYPED_CHILD(Signature);
+            // Need customized setter.
+        protected:
+            Signature* m_Signature;
+            list<XMLObject*>::iterator m_pos_Signature;
+        public:
+            Signature* getSignature() const {
+                return m_Signature;
+            }
+            
+            void setSignature(Signature* sig) {
+                prepareForAssignment(m_Signature,sig);
+                *m_pos_Signature=m_Signature=sig;
+                // Sync content reference back up.
+                if (m_Signature)
+                    m_Signature->setContentReference(new opensaml::ContentReference(*this));
+            }
+            
+            IMPL_STRING_ATTRIB(ID);
+            IMPL_STRING_ATTRIB(ProtocolSupportEnumeration);
+            IMPL_STRING_ATTRIB(ErrorURL);
+            IMPL_DATETIME_ATTRIB(ValidUntil);
+            IMPL_DATETIME_ATTRIB(CacheDuration);
+            IMPL_TYPED_CHILD(Extensions);
+            IMPL_TYPED_CHILDREN(KeyDescriptor,m_pos_Organization);
+            IMPL_TYPED_CHILD(Organization);
+            IMPL_TYPED_CHILDREN(ContactPerson,m_pos_ContactPerson);
+    
+            void setAttribute(QName& qualifiedName, const XMLCh* value) {
+                if (!qualifiedName.hasNamespaceURI()) {
+                    if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) {
+                        setID(value);
+                        return;
+                    }
+                    else if (XMLString::equals(qualifiedName.getLocalPart(),PROTOCOLSUPPORTENUMERATION_ATTRIB_NAME)) {
+                        setProtocolSupportEnumeration(value);
+                        return;
+                    }
+                    else if (XMLString::equals(qualifiedName.getLocalPart(),ERRORURL_ATTRIB_NAME)) {
+                        setErrorURL(value);
+                        return;
+                    }
+                    else if (XMLString::equals(qualifiedName.getLocalPart(),VALIDUNTIL_ATTRIB_NAME)) {
+                        setValidUntil(value);
+                        return;
+                    }
+                    else if (XMLString::equals(qualifiedName.getLocalPart(),CACHEDURATION_ATTRIB_NAME)) {
+                        setCacheDuration(value);
+                        return;
+                    }
+                }
+                AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value);
+            }
+
+        protected:
+            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);
+                
+                // Take care of wildcard.
+                for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
+                    DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
+                    if (i->first.hasPrefix())
+                        attr->setPrefix(i->first.getPrefix());
+                    attr->setNodeValue(i->second);
+                    domElement->setAttributeNode(attr);
+                }
+            }
+
+            void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+                PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLConstants::XMLSIG_NS,false);
+                PROC_TYPED_CHILD(Extensions,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(KeyDescriptor,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILD(Organization,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(ContactPerson,SAMLConstants::SAML20MD_NS,false);
+                AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
+            }
+
+            void processAttribute(const DOMAttr* attribute) {
+                PROC_ID_ATTRIB(ID,ID,NULL);
+                QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix()); 
+                setAttribute(q,attribute->getNodeValue());
+            }
+        };
+
+        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_pos_ArtifactResolutionService=m_pos_ContactPerson;
+                ++m_pos_ArtifactResolutionService;
+                m_pos_SingleLogoutService=m_pos_ArtifactResolutionService;
+                ++m_pos_SingleLogoutService;
+                m_pos_ManageNameIDService=m_pos_SingleLogoutService;
+                ++m_pos_ManageNameIDService;
+                m_pos_NameIDFormat=m_pos_ManageNameIDService;
+                ++m_pos_NameIDFormat;
+            }
+        
+        protected:
+            list<XMLObject*>::iterator m_pos_ArtifactResolutionService;
+            list<XMLObject*>::iterator m_pos_SingleLogoutService;
+            list<XMLObject*>::iterator m_pos_ManageNameIDService;
+            list<XMLObject*>::iterator m_pos_NameIDFormat;
+            
+            SSODescriptorTypeImpl() {
+                init();
+            }
+        
+        public:
+            virtual ~SSODescriptorTypeImpl() {}
+    
+            SSODescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+                init();
+            }
+                
+            SSODescriptorTypeImpl(const SSODescriptorTypeImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
+                init();
+                VectorOf(ArtifactResolutionService) v=getArtifactResolutionServices();
+                for (vector<ArtifactResolutionService*>::const_iterator i=src.m_ArtifactResolutionServices.begin(); i!=src.m_ArtifactResolutionServices.end(); i++) {
+                    if (*i) {
+                        v.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());
+                    }
+                }
+                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());
+                    }
+                }
+                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());
+                    }
+                }
+            }
+            
+            IMPL_TYPED_CHILDREN(ArtifactResolutionService,m_pos_ArtifactResolutionService);
+            IMPL_TYPED_CHILDREN(SingleLogoutService,m_pos_SingleLogoutService);
+            IMPL_TYPED_CHILDREN(ManageNameIDService,m_pos_ManageNameIDService);
+            IMPL_TYPED_CHILDREN(NameIDFormat,m_pos_NameIDFormat);
+
+        protected:
+            void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+                PROC_TYPED_CHILDREN(ArtifactResolutionService,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(SingleLogoutService,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(ManageNameIDService,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(NameIDFormat,SAMLConstants::SAML20MD_NS,false);
+                RoleDescriptorImpl::processChildElement(childXMLObject,root);
+            }
+        };
+
+        class SAML_DLLLOCAL IDPSSODescriptorImpl : public virtual IDPSSODescriptor, public SSODescriptorTypeImpl
+        {
+            list<XMLObject*>::iterator m_pos_SingleSignOnService;
+            list<XMLObject*>::iterator m_pos_NameIDMappingService;
+            list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
+            list<XMLObject*>::iterator m_pos_AttributeProfile;
+            
+            void init() {
+                m_WantAuthnRequestsSigned=false;
+                m_children.push_back(NULL);
+                m_children.push_back(NULL);
+                m_children.push_back(NULL);
+                m_children.push_back(NULL);
+                m_pos_SingleSignOnService=m_pos_NameIDFormat;
+                ++m_pos_SingleSignOnService;
+                m_pos_NameIDMappingService=m_pos_SingleSignOnService;
+                ++m_pos_NameIDMappingService;
+                m_pos_AssertionIDRequestService=m_pos_NameIDMappingService;
+                ++m_pos_AssertionIDRequestService;
+                m_pos_AttributeProfile=m_pos_AssertionIDRequestService;
+                ++m_pos_AttributeProfile;
+            }
+        
+        public:
+            virtual ~IDPSSODescriptorImpl() {}
+    
+            IDPSSODescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+                init();
+            }
+                
+            IDPSSODescriptorImpl(const IDPSSODescriptorImpl& src) : AbstractXMLObject(src), SSODescriptorTypeImpl(src) {
+                init();
+                WantAuthnRequestsSigned(src.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());
+                    }
+                }
+                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());
+                    }
+                }
+                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());
+                    }
+                }
+                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());
+                    }
+                }
+                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());
+                    }
+                }
+            }
+            
+            IMPL_XMLOBJECT_CLONE(IDPSSODescriptor);
+            SSODescriptorType* cloneSSODescriptorType() const {
+                return new IDPSSODescriptorImpl(*this);
+            }
+            RoleDescriptor* cloneRoleDescriptor() const {
+                return new IDPSSODescriptorImpl(*this);
+            }
+            
+            IMPL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned);
+            IMPL_TYPED_CHILDREN(SingleSignOnService,m_pos_SingleSignOnService);
+            IMPL_TYPED_CHILDREN(NameIDMappingService,m_pos_NameIDMappingService);
+            IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
+            IMPL_TYPED_CHILDREN(AttributeProfile,m_pos_AttributeProfile);
+            IMPL_TYPED_FOREIGN_CHILDREN(Attribute,saml2,m_children.end());
+
+            void setAttribute(QName& qualifiedName, const XMLCh* value) {
+                if (!qualifiedName.hasNamespaceURI()) {
+                    if (XMLString::equals(qualifiedName.getLocalPart(),WANTAUTHNREQUESTSSIGNED_ATTRIB_NAME)) {
+                        if (value) {
+                            if (*value==chLatin_t || *value==chDigit_1)
+                                WantAuthnRequestsSigned(true);
+                            else if (*value==chLatin_f || *value==chDigit_0)
+                                WantAuthnRequestsSigned(false);
+                        }
+                        return;
+                    }
+                }
+                RoleDescriptorImpl::setAttribute(qualifiedName, value);
+            }
+
+        protected:
+            void marshallAttributes(DOMElement* domElement) const {
+                MARSHALL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned,WANTAUTHNREQUESTSSIGNED,NULL);
+                RoleDescriptorImpl::marshallAttributes(domElement);
+            }
+            
+            void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+                PROC_TYPED_CHILDREN(SingleSignOnService,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(NameIDMappingService,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(AssertionIDRequestService,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(AttributeProfile,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_FOREIGN_CHILDREN(Attribute,saml2,SAMLConstants::SAML20_NS,false);
+                SSODescriptorTypeImpl::processChildElement(childXMLObject,root);
+            }
+        };
+
+        class SAML_DLLLOCAL RequestedAttributeImpl : public virtual RequestedAttribute,
+            public AbstractComplexElement,
+            public AbstractAttributeExtensibleXMLObject,
+            public AbstractDOMCachingXMLObject,
+            public AbstractValidatingXMLObject,
+            public AbstractXMLObjectMarshaller,
+            public AbstractXMLObjectUnmarshaller
+        {
+            void init() {
+                m_Name=m_NameFormat=m_FriendlyName=NULL;
+                m_isRequired=false;
+            }
+        public:
+            virtual ~RequestedAttributeImpl() {
+                XMLString::release(&m_Name);
+                XMLString::release(&m_NameFormat);
+                XMLString::release(&m_FriendlyName);
+            }
+    
+            RequestedAttributeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+                init();
+            }
+                
+            RequestedAttributeImpl(const RequestedAttributeImpl& src)
+                    : AbstractXMLObject(src),
+                        AbstractAttributeExtensibleXMLObject(src),
+                        AbstractDOMCachingXMLObject(src),
+                        AbstractValidatingXMLObject(src) {
+                init();
+                setName(src.getName());
+                setNameFormat(src.getNameFormat());
+                setFriendlyName(src.getFriendlyName());
+                isRequired(src.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());
+                    }
+                }
+            }
+            
+            IMPL_XMLOBJECT_CLONE(RequestedAttribute);
+            Attribute* cloneAttribute() const {
+                return new RequestedAttributeImpl(*this);
+            }
+            
+            IMPL_STRING_ATTRIB(Name);
+            IMPL_STRING_ATTRIB(NameFormat);
+            IMPL_STRING_ATTRIB(FriendlyName);
+            IMPL_BOOLEAN_ATTRIB(isRequired);
+            IMPL_XMLOBJECT_CHILDREN(AttributeValue,m_children.end());
+    
+            void setAttribute(QName& qualifiedName, const XMLCh* value) {
+                if (!qualifiedName.hasNamespaceURI()) {
+                    if (XMLString::equals(qualifiedName.getLocalPart(),NAME_ATTRIB_NAME)) {
+                        setName(value);
+                        return;
+                    }
+                    else if (XMLString::equals(qualifiedName.getLocalPart(),NAMEFORMAT_ATTRIB_NAME)) {
+                        setNameFormat(value);
+                        return;
+                    }
+                    else if (XMLString::equals(qualifiedName.getLocalPart(),FRIENDLYNAME_ATTRIB_NAME)) {
+                        setFriendlyName(value);
+                        return;
+                    }
+                    else if (XMLString::equals(qualifiedName.getLocalPart(),ISREQUIRED_ATTRIB_NAME)) {
+                        if (value) {
+                            if (*value==chLatin_t || *value==chDigit_1)
+                                isRequired(true);
+                            else if (*value==chLatin_f || *value==chDigit_0)
+                                isRequired(false);
+                        }
+                        return;
+                    }
+                }
+                AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value);
+            }
+
+        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);
+
+                // Take care of wildcard.
+                for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
+                    DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
+                    if (i->first.hasPrefix())
+                        attr->setPrefix(i->first.getPrefix());
+                    attr->setNodeValue(i->second);
+                    domElement->setAttributeNode(attr);
+                }
+            }
+
+            void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+                getAttributeValues().push_back(childXMLObject);
+            }
+
+            void processAttribute(const DOMAttr* attribute) {
+                QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix()); 
+                setAttribute(q,attribute->getNodeValue());
+            }
+        };
+
+        class SAML_DLLLOCAL AttributeConsumingServiceImpl : public virtual AttributeConsumingService,
+            public AbstractComplexElement,
+            public AbstractDOMCachingXMLObject,
+            public AbstractValidatingXMLObject,
+            public AbstractXMLObjectMarshaller,
+            public AbstractXMLObjectUnmarshaller
+        {
+            list<XMLObject*>::iterator m_pos_ServiceDescription;
+            list<XMLObject*>::iterator m_pos_RequestedAttribute;
+            
+               void init() {
+                m_Index=1;
+                m_isDefault=false;
+                m_children.push_back(NULL);
+                m_children.push_back(NULL);
+                m_pos_ServiceDescription=m_children.begin();
+                m_pos_RequestedAttribute=m_pos_ServiceDescription;
+                ++m_pos_RequestedAttribute;
+            }
+
+        public:
+            virtual ~AttributeConsumingServiceImpl() {}
+    
+            AttributeConsumingServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+                init();
+            }
+                
+            AttributeConsumingServiceImpl(const AttributeConsumingServiceImpl& src)
+                    : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) {
+                init();
+                setIndex(src.getIndex());
+                isDefault(src.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());
+                    }
+                }
+                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());
+                    }
+                }
+                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());
+                    }
+                }
+            }
+            
+            IMPL_XMLOBJECT_CLONE(AttributeConsumingService);
+            IMPL_INTEGER_ATTRIB(Index);
+            IMPL_BOOLEAN_ATTRIB(isDefault);
+            IMPL_TYPED_CHILDREN(ServiceName,m_pos_ServiceDescription);
+            IMPL_TYPED_CHILDREN(ServiceDescription,m_pos_RequestedAttribute);
+            IMPL_TYPED_CHILDREN(RequestedAttribute,m_children.end());
+    
+        protected:
+            void marshallAttributes(DOMElement* domElement) const {
+                MARSHALL_INTEGER_ATTRIB(Index,INDEX,NULL);
+                MARSHALL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,NULL);
+            }
+
+            void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+                PROC_TYPED_CHILDREN(ServiceName,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(ServiceDescription,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(RequestedAttribute,SAMLConstants::SAML20MD_NS,false);
+                AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
+            }
+
+            void processAttribute(const DOMAttr* attribute) {
+                PROC_INTEGER_ATTRIB(Index,INDEX,NULL);
+                PROC_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,NULL);
+                AbstractXMLObjectUnmarshaller::processAttribute(attribute);
+            }
+        };
+
+        class SAML_DLLLOCAL SPSSODescriptorImpl : public virtual SPSSODescriptor, public SSODescriptorTypeImpl
+        {
+            list<XMLObject*>::iterator m_pos_AssertionConsumerService;
+            
+            void init() {
+                m_AuthnRequestsSigned=false;
+                m_WantAssertionsSigned=false;
+                m_children.push_back(NULL);
+                m_pos_AssertionConsumerService=m_pos_NameIDFormat;
+                ++m_pos_AssertionConsumerService;
+            }
+        
+        public:
+            virtual ~SPSSODescriptorImpl() {}
+    
+            SPSSODescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+                init();
+            }
+                
+            SPSSODescriptorImpl(const SPSSODescriptorImpl& src) : AbstractXMLObject(src), SSODescriptorTypeImpl(src) {
+                init();
+                AuthnRequestsSigned(src.AuthnRequestsSigned());
+                WantAssertionsSigned(src.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());
+                    }
+                }
+                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());
+                    }
+                }
+            }
+            
+            IMPL_XMLOBJECT_CLONE(SPSSODescriptor);
+            SSODescriptorType* cloneSSODescriptorType() const {
+                return cloneSPSSODescriptor();
+            }
+            RoleDescriptor* cloneRoleDescriptor() const {
+                return cloneSPSSODescriptor();
+            }
+            
+            IMPL_BOOLEAN_ATTRIB(AuthnRequestsSigned);
+            IMPL_BOOLEAN_ATTRIB(WantAssertionsSigned);
+            IMPL_TYPED_CHILDREN(AssertionConsumerService,m_pos_AssertionConsumerService);
+            IMPL_TYPED_CHILDREN(AttributeConsumingService,m_children.end());
+
+            void setAttribute(QName& qualifiedName, const XMLCh* value) {
+                if (!qualifiedName.hasNamespaceURI()) {
+                    if (XMLString::equals(qualifiedName.getLocalPart(),AUTHNREQUESTSSIGNED_ATTRIB_NAME)) {
+                        if (value) {
+                            if (*value==chLatin_t || *value==chDigit_1)
+                                AuthnRequestsSigned(true);
+                            else if (*value==chLatin_f || *value==chDigit_0)
+                                AuthnRequestsSigned(false);
+                        }
+                        return;
+                    }
+                    else if (XMLString::equals(qualifiedName.getLocalPart(),WANTASSERTIONSSIGNED_ATTRIB_NAME)) {
+                        if (value) {
+                            if (*value==chLatin_t || *value==chDigit_1)
+                                WantAssertionsSigned(true);
+                            else if (*value==chLatin_f || *value==chDigit_0)
+                                WantAssertionsSigned(false);
+                        }
+                        return;
+                    }
+                }
+                RoleDescriptorImpl::setAttribute(qualifiedName, value);
+            }
+
+        protected:
+            void marshallAttributes(DOMElement* domElement) const {
+                MARSHALL_BOOLEAN_ATTRIB(AuthnRequestsSigned,AUTHNREQUESTSSIGNED,NULL);
+                MARSHALL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,NULL);
+                RoleDescriptorImpl::marshallAttributes(domElement);
+            }
+            
+            void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+                PROC_TYPED_CHILDREN(AssertionConsumerService,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(AttributeConsumingService,SAMLConstants::SAML20MD_NS,false);
+                SSODescriptorTypeImpl::processChildElement(childXMLObject,root);
+            }
+        };
+
+        class SAML_DLLLOCAL AuthnAuthorityDescriptorImpl : public virtual AuthnAuthorityDescriptor, public RoleDescriptorImpl
+        {
+            list<XMLObject*>::iterator m_pos_AuthnQueryService;
+            list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
+            
+            void init() {
+                m_children.push_back(NULL);
+                m_children.push_back(NULL);
+                m_pos_AuthnQueryService=m_pos_ContactPerson;
+                ++m_pos_AuthnQueryService;
+                m_pos_AssertionIDRequestService=m_pos_AuthnQueryService;
+                ++m_pos_AssertionIDRequestService;
+            }
+        
+        public:
+            virtual ~AuthnAuthorityDescriptorImpl() {}
+    
+            AuthnAuthorityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+                init();
+            }
+                
+            AuthnAuthorityDescriptorImpl(const AuthnAuthorityDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
+                init();
+                VectorOf(AuthnQueryService) v=getAuthnQueryServices();
+                for (vector<AuthnQueryService*>::const_iterator i=src.m_AuthnQueryServices.begin(); i!=src.m_AuthnQueryServices.end(); i++) {
+                    if (*i) {
+                        v.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());
+                    }
+                }
+                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());
+                    }
+                }
+            }
+            
+            IMPL_XMLOBJECT_CLONE(AuthnAuthorityDescriptor);
+            RoleDescriptor* cloneRoleDescriptor() const {
+                return cloneAuthnAuthorityDescriptor();
+            }
+            
+            IMPL_TYPED_CHILDREN(AuthnQueryService,m_pos_AuthnQueryService);
+            IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
+            IMPL_TYPED_CHILDREN(NameIDFormat,m_children.end());
+
+        protected:
+            void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+                PROC_TYPED_CHILDREN(AuthnQueryService,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(AssertionIDRequestService,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(NameIDFormat,SAMLConstants::SAML20MD_NS,false);
+                RoleDescriptorImpl::processChildElement(childXMLObject,root);
+            }
+        };
+
+        class SAML_DLLLOCAL PDPDescriptorImpl : public virtual PDPDescriptor, public RoleDescriptorImpl
+        {
+            list<XMLObject*>::iterator m_pos_AuthzService;
+            list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
+            
+            void init() {
+                m_children.push_back(NULL);
+                m_children.push_back(NULL);
+                m_pos_AuthzService=m_pos_ContactPerson;
+                ++m_pos_AuthzService;
+                m_pos_AssertionIDRequestService=m_pos_AuthzService;
+                ++m_pos_AssertionIDRequestService;
+            }
+        
+        public:
+            virtual ~PDPDescriptorImpl() {}
+    
+            PDPDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+                init();
+            }
+                
+            PDPDescriptorImpl(const PDPDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
+                init();
+                VectorOf(AuthzService) v=getAuthzServices();
+                for (vector<AuthzService*>::const_iterator i=src.m_AuthzServices.begin(); i!=src.m_AuthzServices.end(); i++) {
+                    if (*i) {
+                        v.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());
+                    }
+                }
+                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());
+                    }
+                }
+            }
+            
+            IMPL_XMLOBJECT_CLONE(PDPDescriptor);
+            RoleDescriptor* cloneRoleDescriptor() const {
+                return clonePDPDescriptor();
+            }
+            
+            IMPL_TYPED_CHILDREN(AuthzService,m_pos_AuthzService);
+            IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
+            IMPL_TYPED_CHILDREN(NameIDFormat,m_children.end());
+
+        protected:
+            void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+                PROC_TYPED_CHILDREN(AuthzService,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(AssertionIDRequestService,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(NameIDFormat,SAMLConstants::SAML20MD_NS,false);
+                RoleDescriptorImpl::processChildElement(childXMLObject,root);
+            }
+        };
+
+        class SAML_DLLLOCAL AttributeAuthorityDescriptorImpl : public virtual AttributeAuthorityDescriptor, public RoleDescriptorImpl
+        {
+            list<XMLObject*>::iterator m_pos_AttributeService;
+            list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
+            list<XMLObject*>::iterator m_pos_NameIDFormat;
+            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_pos_AttributeService=m_pos_ContactPerson;
+                ++m_pos_AttributeService;
+                m_pos_AssertionIDRequestService=m_pos_AttributeService;
+                ++m_pos_AssertionIDRequestService;
+                m_pos_NameIDFormat=m_pos_AssertionIDRequestService;
+                ++m_pos_NameIDFormat;
+                m_pos_AttributeProfile=m_pos_NameIDFormat;
+                ++m_pos_AttributeProfile;
+            }
+        
+        public:
+            virtual ~AttributeAuthorityDescriptorImpl() {}
+    
+            AttributeAuthorityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+                init();
+            }
+                
+            AttributeAuthorityDescriptorImpl(const AttributeAuthorityDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
+                init();
+                VectorOf(AttributeService) v=getAttributeServices();
+                for (vector<AttributeService*>::const_iterator i=src.m_AttributeServices.begin(); i!=src.m_AttributeServices.end(); i++) {
+                    if (*i) {
+                        v.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());
+                    }
+                }
+                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());
+                    }
+                }
+                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());
+                    }
+                }
+                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());
+                    }
+                }
+            }
+
+            IMPL_XMLOBJECT_CLONE(AttributeAuthorityDescriptor);
+            RoleDescriptor* cloneRoleDescriptor() const {
+                return cloneAttributeAuthorityDescriptor();
+            }
+            
+            IMPL_TYPED_CHILDREN(AttributeService,m_pos_AttributeService);
+            IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
+            IMPL_TYPED_CHILDREN(NameIDFormat,m_pos_NameIDFormat);
+            IMPL_TYPED_CHILDREN(AttributeProfile,m_pos_AttributeProfile);
+            IMPL_TYPED_FOREIGN_CHILDREN(Attribute,saml2,m_children.end());
+
+        protected:
+            void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+                PROC_TYPED_CHILDREN(AttributeService,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(AssertionIDRequestService,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(NameIDFormat,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(AttributeProfile,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_FOREIGN_CHILDREN(Attribute,saml2,SAMLConstants::SAML20_NS,false);
+                RoleDescriptorImpl::processChildElement(childXMLObject,root);
+            }
+        };
+
+        class SAML_DLLLOCAL AffiliationDescriptorImpl : public virtual AffiliationDescriptor,
+            public virtual SignableObject,
+            public AbstractComplexElement,
+            public AbstractAttributeExtensibleXMLObject,
+            public AbstractDOMCachingXMLObject,
+            public AbstractValidatingXMLObject,
+            public AbstractXMLObjectMarshaller,
+            public AbstractXMLObjectUnmarshaller
+        {
+            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_pos_Signature=m_children.begin();
+                m_pos_Extensions=m_pos_Signature;
+                ++m_pos_Extensions;
+                m_pos_AffiliateMember=m_pos_Extensions;
+                ++m_pos_AffiliateMember;
+            }
+            
+        public:
+            virtual ~AffiliationDescriptorImpl() {
+                XMLString::release(&m_ID);
+                XMLString::release(&m_AffiliationOwnerID);
+                delete m_ValidUntil;
+                delete m_CacheDuration;
+            }
+    
+            AffiliationDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+                init();
+            }
+                
+            AffiliationDescriptorImpl(const AffiliationDescriptorImpl& src)
+                    : AbstractXMLObject(src),
+                        AbstractAttributeExtensibleXMLObject(src),
+                        AbstractDOMCachingXMLObject(src),
+                        AbstractValidatingXMLObject(src) {
+                init();
+                setID(src.getID());
+                setAffiliationOwnerID(src.getAffiliationOwnerID());
+                setValidUntil(src.getValidUntil());
+                setCacheDuration(src.getCacheDuration());
+                if (src.getSignature())
+                    setSignature(src.getSignature()->cloneSignature());
+                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());
+                    }
+                }
+                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());
+                    }
+                }
+            }
+
+            IMPL_XMLOBJECT_CLONE(AffiliationDescriptor);
+
+            const XMLCh* getId() const {
+                return getID();
+            }
+
+            //IMPL_TYPED_CHILD(Signature);
+            // Need customized setter.
+        protected:
+            Signature* m_Signature;
+            list<XMLObject*>::iterator m_pos_Signature;
+        public:
+            Signature* getSignature() const {
+                return m_Signature;
+            }
+            
+            void setSignature(Signature* sig) {
+                prepareForAssignment(m_Signature,sig);
+                *m_pos_Signature=m_Signature=sig;
+                // Sync content reference back up.
+                if (m_Signature)
+                    m_Signature->setContentReference(new opensaml::ContentReference(*this));
+            }
+            
+            IMPL_STRING_ATTRIB(ID);
+            IMPL_STRING_ATTRIB(AffiliationOwnerID);
+            IMPL_DATETIME_ATTRIB(ValidUntil);
+            IMPL_DATETIME_ATTRIB(CacheDuration);
+            IMPL_TYPED_CHILD(Extensions);
+            IMPL_TYPED_CHILDREN(AffiliateMember,m_pos_AffiliateMember);
+            IMPL_TYPED_CHILDREN(KeyDescriptor,m_children.end());
+    
+            void setAttribute(QName& qualifiedName, const XMLCh* value) {
+                if (!qualifiedName.hasNamespaceURI()) {
+                    if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) {
+                        setID(value);
+                        return;
+                    }
+                    else if (XMLString::equals(qualifiedName.getLocalPart(),AFFILIATIONOWNERID_ATTRIB_NAME)) {
+                        setAffiliationOwnerID(value);
+                        return;
+                    }
+                    else if (XMLString::equals(qualifiedName.getLocalPart(),VALIDUNTIL_ATTRIB_NAME)) {
+                        setValidUntil(value);
+                        return;
+                    }
+                    else if (XMLString::equals(qualifiedName.getLocalPart(),CACHEDURATION_ATTRIB_NAME)) {
+                        setCacheDuration(value);
+                        return;
+                    }
+                }
+                AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value);
+            }
+
+        protected:
+            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);
+                
+                // Take care of wildcard.
+                for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
+                    DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
+                    if (i->first.hasPrefix())
+                        attr->setPrefix(i->first.getPrefix());
+                    attr->setNodeValue(i->second);
+                    domElement->setAttributeNode(attr);
+                }
+            }
+
+            void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+                PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLConstants::XMLSIG_NS,false);
+                PROC_TYPED_CHILD(Extensions,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(AffiliateMember,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(KeyDescriptor,SAMLConstants::SAML20MD_NS,false);
+                AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
+            }
+
+            void processAttribute(const DOMAttr* attribute) {
+                PROC_ID_ATTRIB(ID,ID,NULL);
+                QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix()); 
+                setAttribute(q,attribute->getNodeValue());
+            }
+        };
+
+        class SAML_DLLLOCAL EntityDescriptorImpl : public virtual EntityDescriptor,
+            public virtual SignableObject,
+            public AbstractComplexElement,
+            public AbstractAttributeExtensibleXMLObject,
+            public AbstractDOMCachingXMLObject,
+            public AbstractValidatingXMLObject,
+            public AbstractXMLObjectMarshaller,
+            public AbstractXMLObjectUnmarshaller
+        {
+            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_pos_Signature=m_children.begin();
+                m_pos_Extensions=m_pos_Signature;
+                ++m_pos_Extensions;
+                m_pos_AffiliationDescriptor=m_pos_Extensions;
+                ++m_pos_AffiliationDescriptor;
+                m_pos_Organization=m_pos_AffiliationDescriptor;
+                ++m_pos_Organization;
+                m_pos_ContactPerson=m_pos_Organization;
+                ++m_pos_ContactPerson;
+            }
+            
+        public:
+            virtual ~EntityDescriptorImpl() {
+                XMLString::release(&m_ID);
+                XMLString::release(&m_EntityID);
+                delete m_ValidUntil;
+                delete m_CacheDuration;
+            }
+    
+            EntityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+                init();
+            }
+                
+            EntityDescriptorImpl(const EntityDescriptorImpl& src)
+                    : AbstractXMLObject(src),
+                        AbstractAttributeExtensibleXMLObject(src),
+                        AbstractDOMCachingXMLObject(src),
+                        AbstractValidatingXMLObject(src) {
+                init();
+                setID(src.getID());
+                setEntityID(src.getEntityID());
+                setValidUntil(src.getValidUntil());
+                setCacheDuration(src.getCacheDuration());
+                if (src.getSignature())
+                    setSignature(src.getSignature()->cloneSignature());
+                if (src.getExtensions())
+                    setExtensions(src.getExtensions()->cloneExtensions());
+                if (src.getAffiliationDescriptor())
+                    setAffiliationDescriptor(src.getAffiliationDescriptor()->cloneAffiliationDescriptor());
+                if (src.getOrganization())
+                    setOrganization(src.getOrganization()->cloneOrganization());
+                
+                for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
+                    if (*i) {
+                        IDPSSODescriptor* idp=dynamic_cast<IDPSSODescriptor*>(*i);
+                        if (idp) {
+                            getIDPSSODescriptors().push_back(idp->cloneIDPSSODescriptor());
+                            continue;
+                        }
+                        
+                        SPSSODescriptor* sp=dynamic_cast<SPSSODescriptor*>(*i);
+                        if (sp) {
+                            getSPSSODescriptors().push_back(sp->cloneSPSSODescriptor());
+                            continue;
+                        }
+
+                        AuthnAuthorityDescriptor* authn=dynamic_cast<AuthnAuthorityDescriptor*>(*i);
+                        if (authn) {
+                            getAuthnAuthorityDescriptors().push_back(authn->cloneAuthnAuthorityDescriptor());
+                            continue;
+                        }
+
+                        AttributeAuthorityDescriptor* attr=dynamic_cast<AttributeAuthorityDescriptor*>(*i);
+                        if (attr) {
+                            getAttributeAuthorityDescriptors().push_back(attr->cloneAttributeAuthorityDescriptor());
+                            continue;
+                        }
+
+                        PDPDescriptor* pdp=dynamic_cast<PDPDescriptor*>(*i);
+                        if (pdp) {
+                            getPDPDescriptors().push_back(pdp->clonePDPDescriptor());
+                            continue;
+                        }
+    
+                        RoleDescriptor* role=dynamic_cast<RoleDescriptor*>(*i);
+                        if (role) {
+                            getRoleDescriptors().push_back(role->cloneRoleDescriptor());
+                            continue;
+                        }
+                    }
+                }
+
+                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());
+                    }
+                }
+                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());
+                    }
+                }
+            }
+
+            IMPL_XMLOBJECT_CLONE(EntityDescriptor);
+
+            const XMLCh* getId() const {
+                return getID();
+            }
+
+            //IMPL_TYPED_CHILD(Signature);
+            // Need customized setter.
+        protected:
+            Signature* m_Signature;
+            list<XMLObject*>::iterator m_pos_Signature;
+        public:
+            Signature* getSignature() const {
+                return m_Signature;
+            }
+            
+            void setSignature(Signature* sig) {
+                prepareForAssignment(m_Signature,sig);
+                *m_pos_Signature=m_Signature=sig;
+                // Sync content reference back up.
+                if (m_Signature)
+                    m_Signature->setContentReference(new opensaml::ContentReference(*this));
+            }
+            
+            IMPL_STRING_ATTRIB(ID);
+            IMPL_STRING_ATTRIB(EntityID);
+            IMPL_DATETIME_ATTRIB(ValidUntil);
+            IMPL_DATETIME_ATTRIB(CacheDuration);
+            IMPL_TYPED_CHILD(Extensions);
+            IMPL_TYPED_CHILDREN(RoleDescriptor,m_pos_AffiliationDescriptor);
+            IMPL_TYPED_CHILDREN(IDPSSODescriptor,m_pos_AffiliationDescriptor);
+            IMPL_TYPED_CHILDREN(SPSSODescriptor,m_pos_AffiliationDescriptor);
+            IMPL_TYPED_CHILDREN(AuthnAuthorityDescriptor,m_pos_AffiliationDescriptor);
+            IMPL_TYPED_CHILDREN(AttributeAuthorityDescriptor,m_pos_AffiliationDescriptor);
+            IMPL_TYPED_CHILDREN(PDPDescriptor,m_pos_AffiliationDescriptor);
+            IMPL_TYPED_CHILD(AffiliationDescriptor);
+            IMPL_TYPED_CHILD(Organization);
+            IMPL_TYPED_CHILDREN(ContactPerson,m_pos_ContactPerson);
+            IMPL_TYPED_CHILDREN(AdditionalMetadataLocation,m_children.end());
+    
+            void setAttribute(QName& qualifiedName, const XMLCh* value) {
+                if (!qualifiedName.hasNamespaceURI()) {
+                    if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) {
+                        setID(value);
+                        return;
+                    }
+                    else if (XMLString::equals(qualifiedName.getLocalPart(),ENTITYID_ATTRIB_NAME)) {
+                        setEntityID(value);
+                        return;
+                    }
+                    else if (XMLString::equals(qualifiedName.getLocalPart(),VALIDUNTIL_ATTRIB_NAME)) {
+                        setValidUntil(value);
+                        return;
+                    }
+                    else if (XMLString::equals(qualifiedName.getLocalPart(),CACHEDURATION_ATTRIB_NAME)) {
+                        setCacheDuration(value);
+                        return;
+                    }
+                }
+                AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value);
+            }
+
+        protected:
+            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);
+                
+                // Take care of wildcard.
+                for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
+                    DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
+                    if (i->first.hasPrefix())
+                        attr->setPrefix(i->first.getPrefix());
+                    attr->setNodeValue(i->second);
+                    domElement->setAttributeNode(attr);
+                }
+            }
+
+            void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+                PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLConstants::XMLSIG_NS,false);
+                PROC_TYPED_CHILD(Extensions,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(RoleDescriptor,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(IDPSSODescriptor,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(SPSSODescriptor,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(AuthnAuthorityDescriptor,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(AttributeAuthorityDescriptor,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(PDPDescriptor,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILD(AffiliationDescriptor,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILD(Organization,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(ContactPerson,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(AdditionalMetadataLocation,SAMLConstants::SAML20MD_NS,false);
+                AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
+            }
+
+            void processAttribute(const DOMAttr* attribute) {
+                PROC_ID_ATTRIB(ID,ID,NULL);
+                QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix()); 
+                setAttribute(q,attribute->getNodeValue());
+            }
+        };
+
+        class SAML_DLLLOCAL EntitiesDescriptorImpl : public virtual EntitiesDescriptor,
+            public virtual SignableObject,
+            public AbstractComplexElement,
+            public AbstractDOMCachingXMLObject,
+            public AbstractValidatingXMLObject,
+            public AbstractXMLObjectMarshaller,
+            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_pos_Signature=m_children.begin();
+                m_pos_Extensions=m_pos_Signature;
+                ++m_pos_Extensions;
+            }
+            
+        public:
+            virtual ~EntitiesDescriptorImpl() {
+                XMLString::release(&m_ID);
+                XMLString::release(&m_Name);
+                delete m_ValidUntil;
+                delete m_CacheDuration;
+            }
+    
+            EntitiesDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+                init();
+            }
+                
+            EntitiesDescriptorImpl(const EntitiesDescriptorImpl& src)
+                    : AbstractXMLObject(src),
+                        AbstractDOMCachingXMLObject(src),
+                        AbstractValidatingXMLObject(src) {
+                init();
+                setID(src.getID());
+                setName(src.getName());
+                setValidUntil(src.getValidUntil());
+                setCacheDuration(src.getCacheDuration());
+                if (src.getSignature())
+                    setSignature(src.getSignature()->cloneSignature());
+                if (src.getExtensions())
+                    setExtensions(src.getExtensions()->cloneExtensions());
+                
+                for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
+                    if (*i) {
+                        EntityDescriptor* e=dynamic_cast<EntityDescriptor*>(*i);
+                        if (e) {
+                            getEntityDescriptors().push_back(e->cloneEntityDescriptor());
+                            continue;
+                        }
+                        
+                        EntitiesDescriptor* es=dynamic_cast<EntitiesDescriptor*>(*i);
+                        if (es) {
+                            getEntitiesDescriptors().push_back(es->cloneEntitiesDescriptor());
+                            continue;
+                        }
+                    }
+                }
+            }
+
+            IMPL_XMLOBJECT_CLONE(EntitiesDescriptor);
+
+            const XMLCh* getId() const {
+                return getID();
+            }
+
+            //IMPL_TYPED_CHILD(Signature);
+            // Need customized setter.
+        protected:
+            Signature* m_Signature;
+            list<XMLObject*>::iterator m_pos_Signature;
+        public:
+            Signature* getSignature() const {
+                return m_Signature;
+            }
+            
+            void setSignature(Signature* sig) {
+                prepareForAssignment(m_Signature,sig);
+                *m_pos_Signature=m_Signature=sig;
+                // Sync content reference back up.
+                if (m_Signature)
+                    m_Signature->setContentReference(new opensaml::ContentReference(*this));
+            }
+            
+            IMPL_STRING_ATTRIB(ID);
+            IMPL_STRING_ATTRIB(Name);
+            IMPL_DATETIME_ATTRIB(ValidUntil);
+            IMPL_DATETIME_ATTRIB(CacheDuration);
+            IMPL_TYPED_CHILD(Extensions);
+            IMPL_TYPED_CHILDREN(EntityDescriptor,m_children.end());
+            IMPL_TYPED_CHILDREN(EntitiesDescriptor,m_children.end());
+    
+        protected:
+            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);
+            }
+
+            void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+                PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLConstants::XMLSIG_NS,false);
+                PROC_TYPED_CHILD(Extensions,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(EntityDescriptor,SAMLConstants::SAML20MD_NS,false);
+                PROC_TYPED_CHILDREN(EntitiesDescriptor,SAMLConstants::SAML20MD_NS,false);
+                AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
+            }
+
+            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);
+            }
+        };
+
+    };
+};
+
+#if defined (_MSC_VER)
+    #pragma warning( pop )
+#endif
+
+// Builder Implementations
+
+IMPL_XMLOBJECTBUILDER(AdditionalMetadataLocation);
+IMPL_XMLOBJECTBUILDER(AffiliateMember);
+IMPL_XMLOBJECTBUILDER(AffiliationDescriptor);
+IMPL_XMLOBJECTBUILDER(ArtifactResolutionService);
+IMPL_XMLOBJECTBUILDER(AssertionConsumerService);
+IMPL_XMLOBJECTBUILDER(AssertionIDRequestService);
+IMPL_XMLOBJECTBUILDER(AttributeAuthorityDescriptor);
+IMPL_XMLOBJECTBUILDER(AttributeConsumingService);
+IMPL_XMLOBJECTBUILDER(AttributeProfile);
+IMPL_XMLOBJECTBUILDER(AttributeService);
+IMPL_XMLOBJECTBUILDER(AuthnAuthorityDescriptor);
+IMPL_XMLOBJECTBUILDER(AuthnQueryService);
+IMPL_XMLOBJECTBUILDER(AuthzService);
+IMPL_XMLOBJECTBUILDER(Company);
+IMPL_XMLOBJECTBUILDER(ContactPerson);
+IMPL_XMLOBJECTBUILDER(EmailAddress);
+IMPL_XMLOBJECTBUILDER(EndpointType);
+IMPL_XMLOBJECTBUILDER(EntitiesDescriptor);
+IMPL_XMLOBJECTBUILDER(EntityDescriptor);
+IMPL_XMLOBJECTBUILDER(Extensions);
+IMPL_XMLOBJECTBUILDER(GivenName);
+IMPL_XMLOBJECTBUILDER(IDPSSODescriptor);
+IMPL_XMLOBJECTBUILDER(IndexedEndpointType);
+IMPL_XMLOBJECTBUILDER(KeyDescriptor);
+IMPL_XMLOBJECTBUILDER(localizedNameType);
+IMPL_XMLOBJECTBUILDER(localizedURIType);
+IMPL_XMLOBJECTBUILDER(ManageNameIDService);
+IMPL_XMLOBJECTBUILDER(NameIDFormat);
+IMPL_XMLOBJECTBUILDER(NameIDMappingService);
+IMPL_XMLOBJECTBUILDER(Organization);
+IMPL_XMLOBJECTBUILDER(OrganizationName);
+IMPL_XMLOBJECTBUILDER(OrganizationDisplayName);
+IMPL_XMLOBJECTBUILDER(OrganizationURL);
+IMPL_XMLOBJECTBUILDER(PDPDescriptor);
+IMPL_XMLOBJECTBUILDER(RequestedAttribute);
+IMPL_XMLOBJECTBUILDER(ServiceDescription);
+IMPL_XMLOBJECTBUILDER(ServiceName);
+IMPL_XMLOBJECTBUILDER(SingleLogoutService);
+IMPL_XMLOBJECTBUILDER(SingleSignOnService);
+IMPL_XMLOBJECTBUILDER(SPSSODescriptor);
+IMPL_XMLOBJECTBUILDER(SurName);
+IMPL_XMLOBJECTBUILDER(TelephoneNumber);
+
+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);
+const XMLCh AdditionalMetadataLocation::NAMESPACE_ATTRIB_NAME[] =   UNICODE_LITERAL_9(n,a,m,e,s,p,a,c,e);
+const XMLCh AffiliateMember::LOCAL_NAME[] =             UNICODE_LITERAL_15(A,f,f,i,l,i,a,t,e,M,e,m,b,e,r);
+const XMLCh AffiliationDescriptor::LOCAL_NAME[] =       UNICODE_LITERAL_21(A,f,f,i,l,i,a,t,i,o,n,D,e,s,c,r,i,p,t,o,r);
+const XMLCh AffiliationDescriptor::TYPE_NAME[] =        UNICODE_LITERAL_25(A,f,f,i,l,i,a,t,i,o,n,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
+const XMLCh AffiliationDescriptor::ID_ATTRIB_NAME[] =   UNICODE_LITERAL_2(I,D);
+const XMLCh AffiliationDescriptor::VALIDUNTIL_ATTRIB_NAME[] =   UNICODE_LITERAL_10(v,a,l,i,d,U,n,t,i,l);
+const XMLCh AffiliationDescriptor::CACHEDURATION_ATTRIB_NAME[] =    UNICODE_LITERAL_13(c,a,c,h,e,D,u,r,a,t,i,o,n);
+const XMLCh AffiliationDescriptor::AFFILIATIONOWNERID_ATTRIB_NAME[] =   UNICODE_LITERAL_18(a,f,f,i,l,i,a,t,i,o,n,O,w,n,e,r,I,D);
+const XMLCh ArtifactResolutionService::LOCAL_NAME[] =   UNICODE_LITERAL_25(A,r,t,i,f,a,c,t,R,e,s,o,l,u,t,i,o,n,S,e,r,v,i,c,e);
+const XMLCh AssertionConsumerService::LOCAL_NAME[] =    UNICODE_LITERAL_24(A,s,s,e,r,t,i,o,n,C,o,n,s,u,m,e,r,S,e,r,v,i,c,e);
+const XMLCh AssertionIDRequestService::LOCAL_NAME[] =   UNICODE_LITERAL_25(A,s,s,e,r,t,i,o,n,I,D,R,e,q,u,e,s,t,S,e,r,v,i,c,e);
+const XMLCh AttributeAuthorityDescriptor::LOCAL_NAME[] =UNICODE_LITERAL_28(A,t,t,r,i,b,u,t,e,A,u,t,h,o,r,i,t,y,D,e,s,c,r,i,p,t,o,r);
+const XMLCh AttributeAuthorityDescriptor::TYPE_NAME[] = UNICODE_LITERAL_32(A,t,t,r,i,b,u,t,e,A,u,t,h,o,r,i,t,y,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
+const XMLCh AttributeConsumingService::LOCAL_NAME[] =   UNICODE_LITERAL_25(A,t,t,r,i,b,u,t,e,C,o,n,s,u,m,i,n,g,S,e,r,v,i,c,e);
+const XMLCh AttributeConsumingService::TYPE_NAME[] =    UNICODE_LITERAL_29(A,t,t,r,i,b,u,t,e,C,o,n,s,u,m,i,n,g,S,e,r,v,i,c,e,T,y,p,e);
+const XMLCh AttributeConsumingService::INDEX_ATTRIB_NAME[] =    UNICODE_LITERAL_5(i,n,d,e,x);
+const XMLCh AttributeConsumingService::ISDEFAULT_ATTRIB_NAME[] =    UNICODE_LITERAL_9(i,s,D,e,f,a,u,l,t);
+const XMLCh AttributeProfile::LOCAL_NAME[] =            UNICODE_LITERAL_16(A,t,t,r,i,b,u,t,e,P,r,o,f,i,l,e);
+const XMLCh AttributeService::LOCAL_NAME[] =            UNICODE_LITERAL_16(A,t,t,r,i,b,u,t,e,S,e,r,v,i,c,e);
+const XMLCh AuthnAuthorityDescriptor::LOCAL_NAME[] =    UNICODE_LITERAL_24(A,u,t,h,n,A,u,t,h,o,r,i,t,y,D,e,s,c,r,i,p,t,o,r);
+const XMLCh AuthnAuthorityDescriptor::TYPE_NAME[] =     UNICODE_LITERAL_28(A,u,t,h,n,A,u,t,h,o,r,i,t,y,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
+const XMLCh AuthnQueryService::LOCAL_NAME[] =           UNICODE_LITERAL_17(A,u,t,h,n,Q,u,e,r,y,S,e,r,v,i,c,e);
+const XMLCh AuthzService::LOCAL_NAME[] =                UNICODE_LITERAL_12(A,u,t,h,z,S,e,r,v,i,c,e);
+const XMLCh Company::LOCAL_NAME[] =                     UNICODE_LITERAL_7(C,o,m,p,a,n,y);
+const XMLCh ContactPerson::LOCAL_NAME[] =               UNICODE_LITERAL_13(C,o,n,t,a,c,t,P,e,r,s,o,n);
+const XMLCh ContactPerson::TYPE_NAME[] =                UNICODE_LITERAL_11(C,o,n,t,a,c,t,T,y,p,e);
+const XMLCh ContactPerson::CONTACTTYPE_ATTRIB_NAME[] =  UNICODE_LITERAL_11(c,o,n,t,a,c,t,T,y,p,e);
+const XMLCh ContactPerson::CONTACT_TECHNICAL[] =        UNICODE_LITERAL_9(t,e,c,h,n,i,c,a,l);
+const XMLCh ContactPerson::CONTACT_SUPPORT[] =          UNICODE_LITERAL_7(s,u,p,p,o,r,t);
+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 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);
+const XMLCh EndpointType::BINDING_ATTRIB_NAME[] =       UNICODE_LITERAL_7(B,i,n,d,i,n,g);
+const XMLCh EndpointType::LOCATION_ATTRIB_NAME[] =      UNICODE_LITERAL_8(L,o,c,a,t,i,o,n);
+const XMLCh EndpointType::RESPONSELOCATION_ATTRIB_NAME[] =  UNICODE_LITERAL_16(R,e,s,p,o,n,s,e,L,o,c,a,t,i,o,n);
+const XMLCh EntitiesDescriptor::LOCAL_NAME[] =          UNICODE_LITERAL_18(E,n,t,i,t,i,e,s,D,e,s,c,r,i,p,t,o,r);
+const XMLCh EntitiesDescriptor::TYPE_NAME[] =           UNICODE_LITERAL_22(E,n,t,i,t,i,e,s,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
+const XMLCh EntitiesDescriptor::ID_ATTRIB_NAME[] =      UNICODE_LITERAL_2(I,D);
+const XMLCh EntitiesDescriptor::VALIDUNTIL_ATTRIB_NAME[] =    UNICODE_LITERAL_10(v,a,l,i,d,U,n,t,i,l);
+const XMLCh EntitiesDescriptor::CACHEDURATION_ATTRIB_NAME[] = UNICODE_LITERAL_13(c,a,c,h,e,D,u,r,a,t,i,o,n);
+const XMLCh EntitiesDescriptor::NAME_ATTRIB_NAME[] =    UNICODE_LITERAL_4(N,a,m,e);
+const XMLCh EntityDescriptor::LOCAL_NAME[] =            UNICODE_LITERAL_16(E,n,t,i,t,y,D,e,s,c,r,i,p,t,o,r);
+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::VALIDUNTIL_ATTRIB_NAME[] =    UNICODE_LITERAL_10(v,a,l,i,d,U,n,t,i,l);
+const XMLCh EntityDescriptor::CACHEDURATION_ATTRIB_NAME[] = UNICODE_LITERAL_13(c,a,c,h,e,D,u,r,a,t,i,o,n);
+const XMLCh EntityDescriptor::ENTITYID_ATTRIB_NAME[] =  UNICODE_LITERAL_8(e,n,t,i,t,y,I,D);
+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 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);
+const XMLCh IDPSSODescriptor::WANTAUTHNREQUESTSSIGNED_ATTRIB_NAME[] =   UNICODE_LITERAL_23(W,a,n,t,A,u,t,h,n,R,e,q,u,e,s,t,s,S,i,g,n,e,d);
+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 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 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);
+const XMLCh localizedURIType::LOCAL_NAME[] =            {chNull};
+const XMLCh localizedURIType::TYPE_NAME[] =             UNICODE_LITERAL_16(l,o,c,a,l,i,z,e,d,U,R,I,T,y,p,e);
+const XMLCh localizedURIType::LANG_ATTRIB_NAME[] =      UNICODE_LITERAL_4(l,a,n,g);
+const XMLCh ManageNameIDService::LOCAL_NAME[] =         UNICODE_LITERAL_19(M,a,n,a,g,e,N,a,m,e,I,D,S,e,r,v,i,c,e);
+const XMLCh NameIDFormat::LOCAL_NAME[] =                UNICODE_LITERAL_12(N,a,m,e,I,D,F,o,r,m,a,t);
+const XMLCh NameIDMappingService::LOCAL_NAME[] =        UNICODE_LITERAL_20(N,a,m,e,I,D,M,a,p,p,i,n,g,S,e,r,v,i,c,e);
+const XMLCh Organization::LOCAL_NAME[] =                UNICODE_LITERAL_12(O,r,g,a,n,i,z,a,t,i,o,n);
+const XMLCh Organization::TYPE_NAME[] =                 UNICODE_LITERAL_16(O,r,g,a,n,i,z,a,t,i,o,n,T,y,p,e);
+const XMLCh OrganizationName::LOCAL_NAME[] =            UNICODE_LITERAL_16(O,r,g,a,n,i,z,a,t,i,o,n,N,a,m,e);
+const XMLCh OrganizationDisplayName::LOCAL_NAME[] =     UNICODE_LITERAL_23(O,r,g,a,n,i,z,a,t,i,o,n,D,i,s,p,l,a,y,N,a,m,e);
+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 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 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::VALIDUNTIL_ATTRIB_NAME[] =  UNICODE_LITERAL_10(v,a,l,i,d,U,n,t,i,l);
+const XMLCh RoleDescriptor::CACHEDURATION_ATTRIB_NAME[] =   UNICODE_LITERAL_13(c,a,c,h,e,D,u,r,a,t,i,o,n);
+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 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 SPSSODescriptor::LOCAL_NAME[] =             UNICODE_LITERAL_15(S,P,S,S,O,D,e,s,c,r,i,p,t,o,r);
+const XMLCh SPSSODescriptor::TYPE_NAME[] =              UNICODE_LITERAL_19(S,P,S,S,O,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
+const XMLCh SPSSODescriptor::AUTHNREQUESTSSIGNED_ATTRIB_NAME[] =    UNICODE_LITERAL_19(A,u,t,h,n,R,e,q,u,e,s,t,s,S,i,g,n,e,d);
+const XMLCh SPSSODescriptor::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 SSODescriptorType::LOCAL_NAME[] =           {chNull};
+const XMLCh SSODescriptorType::TYPE_NAME[] =            UNICODE_LITERAL_17(S,S,O,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
+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);
diff --git a/saml/saml2/metadata/impl/MetadataSchemaValidators.cpp b/saml/saml2/metadata/impl/MetadataSchemaValidators.cpp
new file mode 100644 (file)
index 0000000..21dffda
--- /dev/null
@@ -0,0 +1,322 @@
+/*
+*  Copyright 2001-2006 Internet2
+ * 
+* Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     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.
+ */
+
+/**
+ * MetadataSchemaValidators.cpp
+ * 
+ * Schema-based validators for SAML 2.0 Metadata classes
+ */
+
+#include "internal.h"
+#include "exceptions.h"
+#include "saml2/metadata/Metadata.h"
+
+using namespace opensaml::saml2md;
+using namespace opensaml::saml2;
+using namespace opensaml;
+using namespace xmltooling;
+using namespace std;
+
+namespace opensaml {
+    namespace saml2md {
+        
+        XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,AffiliateMember);
+        XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,AttributeProfile);
+        XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,Company);
+        XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,EmailAddress);
+        XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,GivenName);
+        XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,NameIDFormat);
+        XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,SurName);
+        XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,TelephoneNumber);
+
+        BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,localizedNameType);
+            XMLOBJECTVALIDATOR_REQUIRE(localizedNameType,TextContent);
+            XMLOBJECTVALIDATOR_REQUIRE(localizedNameType,Lang);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,localizedURIType);
+            XMLOBJECTVALIDATOR_REQUIRE(localizedNameType,TextContent);
+            XMLOBJECTVALIDATOR_REQUIRE(localizedURIType,Lang);
+        END_XMLOBJECTVALIDATOR;
+        
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,OrganizationName,localizedNameType);
+            localizedNameTypeSchemaValidator::validate(xmlObject);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,OrganizationDisplayName,localizedNameType);
+            localizedNameTypeSchemaValidator::validate(xmlObject);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,OrganizationURL,localizedURIType);
+            localizedURITypeSchemaValidator::validate(xmlObject);
+        END_XMLOBJECTVALIDATOR;
+
+        class SAML_DLLLOCAL checkWildcardNS {
+        public:
+            void operator()(const XMLObject* xmlObject) const {
+                const XMLCh* ns=xmlObject->getElementQName().getNamespaceURI();
+                if (XMLString::equals(ns,SAMLConstants::SAML20MD_NS) || !ns || !*ns) {
+                    throw ValidationException(
+                        "Object contains an illegal extension child element ($1).",
+                        params(1,xmlObject->getElementQName().toString().c_str())
+                        );
+                }
+            }
+        };
+
+        BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,Extensions);
+            if (!ptr->hasChildren())
+                throw ValidationException("Extensions must have at least one child element.");
+            const list<XMLObject*>& anys=ptr->getXMLObjects();
+            for_each(anys.begin(),anys.end(),checkWildcardNS());
+        END_XMLOBJECTVALIDATOR;
+        
+        BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,Organization);
+            XMLOBJECTVALIDATOR_NONEMPTY(Organization,OrganizationName);
+            XMLOBJECTVALIDATOR_NONEMPTY(Organization,OrganizationDisplayName);
+            XMLOBJECTVALIDATOR_NONEMPTY(Organization,OrganizationURL);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,ContactPerson);
+            if (!ptr->hasChildren())
+                throw ValidationException("ContactPerson must have at least one child element.");
+            if (!XMLString::equals(ptr->getContactType(),ContactPerson::CONTACT_TECHNICAL) &&
+                !XMLString::equals(ptr->getContactType(),ContactPerson::CONTACT_SUPPORT) &&
+                !XMLString::equals(ptr->getContactType(),ContactPerson::CONTACT_ADMINISTRATIVE) &&
+                !XMLString::equals(ptr->getContactType(),ContactPerson::CONTACT_BILLING) &&
+                !XMLString::equals(ptr->getContactType(),ContactPerson::CONTACT_OTHER))
+                throw ValidationException("ContactPerson contactType must be one of the defined values.");
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,AdditionalMetadataLocation);
+            XMLOBJECTVALIDATOR_REQUIRE(AdditionalMetadataLocation,Namespace);
+            XMLOBJECTVALIDATOR_REQUIRE(AdditionalMetadataLocation,Location);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,KeyDescriptor);
+            XMLOBJECTVALIDATOR_REQUIRE(KeyDescriptor,KeyInfo);
+            if (ptr->getUse() &&
+                !XMLString::equals(ptr->getUse(),KeyDescriptor::KEYTYPE_ENCRYPTION) &&
+                !XMLString::equals(ptr->getUse(),KeyDescriptor::KEYTYPE_SIGNING))
+                throw ValidationException("KeyDescriptor use must be empty or one of the defined values.");
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,RoleDescriptor);
+            XMLOBJECTVALIDATOR_REQUIRE(RoleDescriptor,ProtocolSupportEnumeration);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,EndpointType);
+            XMLOBJECTVALIDATOR_REQUIRE(EndpointType,Binding);
+            XMLOBJECTVALIDATOR_REQUIRE(EndpointType,Location);
+            const list<XMLObject*>& anys=ptr->getXMLObjects();
+            for_each(anys.begin(),anys.end(),checkWildcardNS());
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,IndexedEndpointType,EndpointType);
+            EndpointTypeSchemaValidator::validate(xmlObject);
+            XMLOBJECTVALIDATOR_REQUIRE(IndexedEndpointType,Index);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,ArtifactResolutionService,IndexedEndpointType);
+            IndexedEndpointTypeSchemaValidator::validate(xmlObject);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,SingleLogoutService,EndpointType);
+            EndpointTypeSchemaValidator::validate(xmlObject);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,ManageNameIDService,EndpointType);
+            EndpointTypeSchemaValidator::validate(xmlObject);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,SingleSignOnService,EndpointType);
+            EndpointTypeSchemaValidator::validate(xmlObject);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,NameIDMappingService,EndpointType);
+            EndpointTypeSchemaValidator::validate(xmlObject);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,AssertionIDRequestService,EndpointType);
+            EndpointTypeSchemaValidator::validate(xmlObject);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,IDPSSODescriptor,RoleDescriptor);
+            RoleDescriptorSchemaValidator::validate(xmlObject);
+            XMLOBJECTVALIDATOR_NONEMPTY(IDPSSODescriptor,SingleSignOnService);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,ServiceName,localizedNameType);
+            localizedNameTypeSchemaValidator::validate(xmlObject);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,ServiceDescription,localizedNameType);
+            localizedNameTypeSchemaValidator::validate(xmlObject);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,RequestedAttribute);
+            XMLOBJECTVALIDATOR_REQUIRE(RequestedAttribute,Name);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,AttributeConsumingService);
+            XMLOBJECTVALIDATOR_REQUIRE(AttributeConsumingService,Index);
+            XMLOBJECTVALIDATOR_NONEMPTY(AttributeConsumingService,ServiceName);
+            XMLOBJECTVALIDATOR_NONEMPTY(AttributeConsumingService,RequestedAttribute);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,AssertionConsumerService,IndexedEndpointType);
+            IndexedEndpointTypeSchemaValidator::validate(xmlObject);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,SPSSODescriptor,RoleDescriptor);
+            RoleDescriptorSchemaValidator::validate(xmlObject);
+            XMLOBJECTVALIDATOR_NONEMPTY(SPSSODescriptor,AssertionConsumerService);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,AuthnQueryService,EndpointType);
+            EndpointTypeSchemaValidator::validate(xmlObject);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,AuthnAuthorityDescriptor,RoleDescriptor);
+            RoleDescriptorSchemaValidator::validate(xmlObject);
+            XMLOBJECTVALIDATOR_NONEMPTY(AuthnAuthorityDescriptor,AuthnQueryService);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,AuthzService,EndpointType);
+            EndpointTypeSchemaValidator::validate(xmlObject);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,PDPDescriptor,RoleDescriptor);
+            RoleDescriptorSchemaValidator::validate(xmlObject);
+            XMLOBJECTVALIDATOR_NONEMPTY(PDPDescriptor,AuthzService);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,AttributeService,EndpointType);
+            EndpointTypeSchemaValidator::validate(xmlObject);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,AttributeAuthorityDescriptor,RoleDescriptor);
+            RoleDescriptorSchemaValidator::validate(xmlObject);
+            XMLOBJECTVALIDATOR_NONEMPTY(AttributeAuthorityDescriptor,AttributeService);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,AffiliationDescriptor);
+            XMLOBJECTVALIDATOR_REQUIRE(AffiliationDescriptor,AffiliationOwnerID);
+            XMLOBJECTVALIDATOR_NONEMPTY(AffiliationDescriptor,AffiliateMember);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,EntityDescriptor);
+            XMLOBJECTVALIDATOR_REQUIRE(EntityDescriptor,EntityID);
+            if (ptr->getRoleDescriptors().empty() &&
+                ptr->getIDPSSODescriptors().empty() &&
+                ptr->getSPSSODescriptors().empty() &&
+                ptr->getAuthnAuthorityDescriptors().empty() &&
+                ptr->getAttributeAuthorityDescriptors().empty() &&
+                ptr->getPDPDescriptors().empty()) {
+                    
+                if (!ptr->getAffiliationDescriptor())
+                    throw ValidationException("EntityDescriptor must have at least one child role or affiliation descriptor.");
+            }
+            else if (ptr->getAffiliationDescriptor()) {
+                throw ValidationException("EntityDescriptor cannot have both an AffiliationDescriptor and role descriptors.");
+            }
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,EntitiesDescriptor);
+            if (ptr->getEntityDescriptors().empty() && ptr->getEntitiesDescriptors().empty())
+                throw ValidationException("EntitiesDescriptor must contain at least one child descriptor."); 
+        END_XMLOBJECTVALIDATOR;
+    };
+};
+
+#define REGISTER_ELEMENT(cname) \
+    q=QName(SAMLConstants::SAML20MD_NS,cname::LOCAL_NAME); \
+    XMLObjectBuilder::registerBuilder(q,new cname##Builder()); \
+    Validator::registerValidator(q,new cname##SchemaValidator())
+    
+#define REGISTER_TYPE(cname) \
+    q=QName(SAMLConstants::SAML20MD_NS,cname::TYPE_NAME); \
+    XMLObjectBuilder::registerBuilder(q,new cname##Builder()); \
+    Validator::registerValidator(q,new cname##SchemaValidator())
+
+#define REGISTER_ELEMENT_NOVAL(cname) \
+    q=QName(SAMLConstants::SAML20MD_NS,cname::LOCAL_NAME); \
+    XMLObjectBuilder::registerBuilder(q,new cname##Builder());
+    
+#define REGISTER_TYPE_NOVAL(cname) \
+    q=QName(SAMLConstants::SAML20MD_NS,cname::TYPE_NAME); \
+    XMLObjectBuilder::registerBuilder(q,new cname##Builder());
+
+void opensaml::saml2md::registerMetadataClasses() {
+    QName q;
+    REGISTER_ELEMENT(AdditionalMetadataLocation);
+    REGISTER_ELEMENT(AffiliateMember);
+    REGISTER_ELEMENT(AffiliationDescriptor);
+    REGISTER_ELEMENT(ArtifactResolutionService);
+    REGISTER_ELEMENT(AssertionConsumerService);
+    REGISTER_ELEMENT(AssertionIDRequestService);
+    REGISTER_ELEMENT(AttributeAuthorityDescriptor);;
+    REGISTER_ELEMENT(AttributeConsumingService);
+    REGISTER_ELEMENT(AttributeProfile);
+    REGISTER_ELEMENT(AttributeService);
+    REGISTER_ELEMENT(AuthnAuthorityDescriptor);
+    REGISTER_ELEMENT(AuthnQueryService);
+    REGISTER_ELEMENT(AuthzService);
+    REGISTER_ELEMENT(Company);
+    REGISTER_ELEMENT(ContactPerson);
+    REGISTER_ELEMENT(EmailAddress);
+    REGISTER_ELEMENT(EntitiesDescriptor);
+    REGISTER_ELEMENT(EntityDescriptor);
+    REGISTER_ELEMENT(Extensions);
+    REGISTER_ELEMENT(GivenName);
+    REGISTER_ELEMENT(IDPSSODescriptor);
+    REGISTER_ELEMENT(KeyDescriptor);
+    REGISTER_ELEMENT(ManageNameIDService);
+    REGISTER_ELEMENT(NameIDFormat);
+    REGISTER_ELEMENT(NameIDMappingService);
+    REGISTER_ELEMENT(Organization);
+    REGISTER_ELEMENT(OrganizationDisplayName);
+    REGISTER_ELEMENT(OrganizationName);
+    REGISTER_ELEMENT(OrganizationURL);
+    REGISTER_ELEMENT(PDPDescriptor);
+    REGISTER_ELEMENT(RequestedAttribute);
+    REGISTER_ELEMENT(ServiceDescription);
+    REGISTER_ELEMENT(ServiceName);
+    REGISTER_ELEMENT(SingleLogoutService);
+    REGISTER_ELEMENT(SingleSignOnService);
+    REGISTER_ELEMENT(SPSSODescriptor);
+    REGISTER_ELEMENT(SurName);
+    REGISTER_ELEMENT(TelephoneNumber);
+    REGISTER_TYPE(AdditionalMetadataLocation);
+    REGISTER_TYPE(AffiliationDescriptor);
+    REGISTER_TYPE(AttributeAuthorityDescriptor);;
+    REGISTER_TYPE(AttributeConsumingService);
+    REGISTER_TYPE(AuthnAuthorityDescriptor);
+    REGISTER_TYPE(ContactPerson);
+    REGISTER_TYPE(EndpointType);
+    REGISTER_TYPE(EntitiesDescriptor);
+    REGISTER_TYPE(EntityDescriptor);
+    REGISTER_TYPE(Extensions);
+    REGISTER_TYPE(IDPSSODescriptor);
+    REGISTER_TYPE(IndexedEndpointType);
+    REGISTER_TYPE(KeyDescriptor);
+    REGISTER_TYPE(localizedNameType);
+    REGISTER_TYPE(localizedURIType);
+    REGISTER_TYPE(Organization);
+    REGISTER_TYPE(PDPDescriptor);
+    REGISTER_TYPE(RequestedAttribute);
+    REGISTER_TYPE(SPSSODescriptor);
+}
index 6cf5a59..886c43f 100644 (file)
@@ -135,7 +135,7 @@ public:
         \r
         try {\r
             assertion->getSignature()->registerValidator(new SignatureProfileValidator());\r
-            assertion->getSignature()->registerValidator(new SignatureValidator(m_key->clone()));\r
+            assertion->getSignature()->registerValidator(new SignatureValidator(new KeyResolver(m_key->clone())));\r
             assertion->getSignature()->validate(true);\r
         }\r
         catch (XMLToolingException& e) {\r
index 5cd2778..2d1fb8f 100644 (file)
@@ -134,7 +134,7 @@ public:
         \r
         try {\r
             request->getSignature()->registerValidator(new SignatureProfileValidator());\r
-            request->getSignature()->registerValidator(new SignatureValidator(m_key->clone()));\r
+            request->getSignature()->registerValidator(new SignatureValidator(new KeyResolver(m_key->clone())));\r
             request->getSignature()->validate(true);\r
         }\r
         catch (XMLToolingException& e) {\r
index ac26175..cc8f2ba 100644 (file)
@@ -163,10 +163,10 @@ public:
         \r
         try {\r
             assertion->getSignature()->registerValidator(new SignatureProfileValidator());\r
-            assertion->getSignature()->registerValidator(new SignatureValidator(m_key->clone()));\r
+            assertion->getSignature()->registerValidator(new SignatureValidator(new KeyResolver(m_key->clone())));\r
             assertion->getSignature()->validate(true);\r
             response->getSignature()->registerValidator(new SignatureProfileValidator());\r
-            response->getSignature()->registerValidator(new SignatureValidator(m_key->clone()));\r
+            response->getSignature()->registerValidator(new SignatureValidator(new KeyResolver(m_key->clone())));\r
             response->getSignature()->validate(true);\r
         }\r
         catch (XMLToolingException& e) {\r