https://issues.shibboleth.net/jira/browse/CPPOST-71
[shibboleth/cpp-opensaml.git] / saml / saml2 / metadata / impl / MetadataImpl.cpp
1 /**
2  * Licensed to the University Corporation for Advanced Internet
3  * Development, Inc. (UCAID) under one or more contributor license
4  * agreements. See the NOTICE file distributed with this work for
5  * additional information regarding copyright ownership.
6  *
7  * UCAID licenses this file to you under the Apache License,
8  * Version 2.0 (the "License"); you may not use this file except
9  * in compliance with the License. You may obtain a copy of the
10  * License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing,
15  * software distributed under the License is distributed on an
16  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
17  * either express or implied. See the License for the specific
18  * language governing permissions and limitations under the License.
19  */
20
21 /**
22  * MetadataImpl.cpp
23  *
24  * Implementation classes for SAML 2.0 Metadata schema.
25  */
26
27 #include "internal.h"
28 #include "exceptions.h"
29 #include "saml2/metadata/Metadata.h"
30 #include "signature/ContentReference.h"
31
32 #include <xmltooling/AbstractComplexElement.h>
33 #include <xmltooling/AbstractSimpleElement.h>
34 #include <xmltooling/XMLToolingConfig.h>
35 #include <xmltooling/encryption/Encryption.h>
36 #include <xmltooling/impl/AnyElement.h>
37 #include <xmltooling/io/AbstractXMLObjectMarshaller.h>
38 #include <xmltooling/io/AbstractXMLObjectUnmarshaller.h>
39 #include <xmltooling/security/CredentialCriteria.h>
40 #include <xmltooling/security/CredentialResolver.h>
41 #include <xmltooling/signature/KeyInfo.h>
42 #include <xmltooling/signature/Signature.h>
43 #include <xmltooling/util/DateTime.h>
44 #include <xmltooling/util/XMLHelper.h>
45
46 #include <ctime>
47 #include <xercesc/util/XMLUniDefs.hpp>
48 #include <xsec/framework/XSECDefs.hpp>
49
50 using namespace samlconstants;
51 using namespace opensaml::saml2md;
52 using namespace opensaml::saml2;
53 using namespace xmlencryption;
54 using namespace xmlsignature;
55 using namespace xmltooling;
56 using namespace std;
57 using xmlconstants::XMLSIG_NS;
58 using xmlconstants::XML_BOOL_NULL;
59
60 #if defined (_MSC_VER)
61     #pragma warning( push )
62     #pragma warning( disable : 4250 4251 )
63 #endif
64
65 namespace opensaml {
66     namespace saml2md {
67
68         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,AffiliateMember);
69         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,AttributeProfile);
70         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,Company);
71         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,EmailAddress);
72         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,GivenName);
73         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,NameIDFormat);
74         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,SurName);
75         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,TelephoneNumber);
76
77         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,ActionNamespace);
78         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,SourceID);
79         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,IPHint);
80         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,DomainHint);
81         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,GeolocationHint);
82
83         class SAML_DLLLOCAL localizedNameTypeImpl : public virtual localizedNameType,
84             public AbstractSimpleElement,
85             public AbstractDOMCachingXMLObject,
86             public AbstractXMLObjectMarshaller,
87             public AbstractXMLObjectUnmarshaller
88         {
89             void init() {
90                 m_Lang=nullptr;
91                 m_LangPrefix=nullptr;
92             }
93
94         protected:
95             localizedNameTypeImpl() {
96                 init();
97             }
98
99         public:
100             virtual ~localizedNameTypeImpl() {
101                 XMLString::release(&m_Lang);
102                 XMLString::release(&m_LangPrefix);
103             }
104
105             localizedNameTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
106                     : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
107                 init();
108             }
109
110             localizedNameTypeImpl(const localizedNameTypeImpl& src)
111                     : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
112                 init();
113             }
114
115             void _clone(const localizedNameTypeImpl& src) {
116                 setLang(src.getLang());
117                 if (src.m_LangPrefix)
118                     m_LangPrefix = XMLString::replicate(src.m_LangPrefix);
119             }
120
121             IMPL_XMLOBJECT_CLONE_EX(localizedNameType);
122             IMPL_XMLOBJECT_FOREIGN_ATTRIB(Lang,XMLCh);
123
124         protected:
125             void marshallAttributes(DOMElement* domElement) const {
126                 if (m_Lang && *m_Lang) {
127                     DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(xmlconstants::XML_NS, LANG_ATTRIB_NAME);
128                     if (m_LangPrefix && *m_LangPrefix)
129                         attr->setPrefix(m_LangPrefix);
130                     else
131                         attr->setPrefix(xmlconstants::XML_PREFIX);
132                     attr->setNodeValue(m_Lang);
133                     domElement->setAttributeNodeNS(attr);
134                 }
135             }
136
137             void processAttribute(const DOMAttr* attribute) {
138                 if (XMLHelper::isNodeNamed(attribute, xmlconstants::XML_NS, LANG_ATTRIB_NAME)) {
139                     setLang(attribute->getValue());
140                     const XMLCh* temp = attribute->getPrefix();
141                     if (temp && *temp && !XMLString::equals(temp, xmlconstants::XML_NS))
142                         m_LangPrefix = XMLString::replicate(temp);
143                     return;
144                 }
145                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
146             }
147         };
148
149         class SAML_DLLLOCAL localizedURITypeImpl : public virtual localizedURIType,
150             public AbstractSimpleElement,
151             public AbstractDOMCachingXMLObject,
152             public AbstractXMLObjectMarshaller,
153             public AbstractXMLObjectUnmarshaller
154         {
155             void init() {
156                 m_Lang=nullptr;
157                 m_LangPrefix=nullptr;
158             }
159
160         protected:
161             localizedURITypeImpl() {
162                 init();
163             }
164
165         public:
166             virtual ~localizedURITypeImpl() {
167                 XMLString::release(&m_Lang);
168                 XMLString::release(&m_LangPrefix);
169             }
170
171             localizedURITypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
172                     : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
173                 init();
174             }
175
176             localizedURITypeImpl(const localizedURITypeImpl& src)
177                     : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
178                 init();
179             }
180
181             void _clone(const localizedURITypeImpl& src) {
182                 setLang(src.getLang());
183                 if (src.m_LangPrefix)
184                     m_LangPrefix = XMLString::replicate(src.m_LangPrefix);
185             }
186
187             IMPL_XMLOBJECT_CLONE_EX(localizedURIType);
188             IMPL_XMLOBJECT_FOREIGN_ATTRIB(Lang,XMLCh);
189
190         protected:
191             void marshallAttributes(DOMElement* domElement) const {
192                 if (m_Lang && *m_Lang) {
193                     DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(xmlconstants::XML_NS, LANG_ATTRIB_NAME);
194                     if (m_LangPrefix && *m_LangPrefix)
195                         attr->setPrefix(m_LangPrefix);
196                     else
197                         attr->setPrefix(xmlconstants::XML_PREFIX);
198                     attr->setNodeValue(m_Lang);
199                     domElement->setAttributeNodeNS(attr);
200                 }
201             }
202
203             void processAttribute(const DOMAttr* attribute) {
204                 if (XMLHelper::isNodeNamed(attribute, xmlconstants::XML_NS, LANG_ATTRIB_NAME)) {
205                     setLang(attribute->getValue());
206                     const XMLCh* temp = attribute->getPrefix();
207                     if (temp && *temp && !XMLString::equals(temp, xmlconstants::XML_NS))
208                         m_LangPrefix = XMLString::replicate(temp);
209                     return;
210                 }
211                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
212             }
213         };
214
215         class SAML_DLLLOCAL OrganizationNameImpl : public virtual OrganizationName, public localizedNameTypeImpl
216         {
217         public:
218             virtual ~OrganizationNameImpl() {}
219
220             OrganizationNameImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
221                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
222
223             OrganizationNameImpl(const OrganizationNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
224
225             IMPL_XMLOBJECT_CLONE_EX(OrganizationName);
226         };
227
228         class SAML_DLLLOCAL OrganizationDisplayNameImpl : public virtual OrganizationDisplayName, public localizedNameTypeImpl
229         {
230         public:
231             virtual ~OrganizationDisplayNameImpl() {}
232
233             OrganizationDisplayNameImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
234                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
235
236             OrganizationDisplayNameImpl(const OrganizationDisplayNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
237
238             IMPL_XMLOBJECT_CLONE_EX(OrganizationDisplayName);
239         };
240
241         class SAML_DLLLOCAL OrganizationURLImpl : public virtual OrganizationURL, public localizedURITypeImpl
242         {
243         public:
244             virtual ~OrganizationURLImpl() {}
245
246             OrganizationURLImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
247                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
248
249             OrganizationURLImpl(const OrganizationURLImpl& src) : AbstractXMLObject(src), localizedURITypeImpl(src) {}
250
251             IMPL_XMLOBJECT_CLONE_EX(OrganizationURL);
252         };
253
254         class SAML_DLLLOCAL ServiceNameImpl : public virtual ServiceName, public localizedNameTypeImpl
255         {
256         public:
257             virtual ~ServiceNameImpl() {}
258
259             ServiceNameImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
260                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
261
262             ServiceNameImpl(const ServiceNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
263
264             IMPL_XMLOBJECT_CLONE_EX(ServiceName);
265         };
266
267         class SAML_DLLLOCAL ServiceDescriptionImpl : public virtual ServiceDescription, public localizedNameTypeImpl
268         {
269         public:
270             virtual ~ServiceDescriptionImpl() {}
271
272             ServiceDescriptionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
273                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
274
275             ServiceDescriptionImpl(const ServiceDescriptionImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
276
277             IMPL_XMLOBJECT_CLONE_EX(ServiceDescription);
278         };
279
280         class SAML_DLLLOCAL ExtensionsImpl : public virtual Extensions,
281             public AbstractComplexElement,
282             public AbstractDOMCachingXMLObject,
283             public AbstractXMLObjectMarshaller,
284             public AbstractXMLObjectUnmarshaller
285         {
286         public:
287             virtual ~ExtensionsImpl() {}
288
289             ExtensionsImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
290                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
291             }
292
293             ExtensionsImpl(const ExtensionsImpl& src)
294                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
295                 for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) {
296                     if (*i) {
297                         getUnknownXMLObjects().push_back((*i)->clone());
298                     }
299                 }
300             }
301
302             IMPL_XMLOBJECT_CLONE(Extensions);
303             IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
304
305         protected:
306             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
307                 // Unknown child.
308                 const XMLCh* nsURI=root->getNamespaceURI();
309                 if (!XMLString::equals(nsURI,SAML20MD_NS) && nsURI && *nsURI) {
310                     getUnknownXMLObjects().push_back(childXMLObject);
311                     return;
312                 }
313
314                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
315             }
316         };
317
318         class SAML_DLLLOCAL OrganizationImpl : public virtual Organization,
319             public AbstractComplexElement,
320             public AbstractAttributeExtensibleXMLObject,
321             public AbstractDOMCachingXMLObject,
322             public AbstractXMLObjectMarshaller,
323             public AbstractXMLObjectUnmarshaller
324         {
325             list<XMLObject*>::iterator m_pos_OrganizationDisplayName;
326             list<XMLObject*>::iterator m_pos_OrganizationURL;
327
328             void init() {
329                 m_children.push_back(nullptr);
330                 m_children.push_back(nullptr);
331                 m_children.push_back(nullptr);
332                 m_Extensions=nullptr;
333                 m_pos_Extensions=m_children.begin();
334                 m_pos_OrganizationDisplayName=m_pos_Extensions;
335                 ++m_pos_OrganizationDisplayName;
336                 m_pos_OrganizationURL=m_pos_OrganizationDisplayName;
337                 ++m_pos_OrganizationURL;
338             }
339
340         public:
341             virtual ~OrganizationImpl() {}
342
343             OrganizationImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
344                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
345                 init();
346             }
347
348             OrganizationImpl(const OrganizationImpl& src)
349                     : AbstractXMLObject(src), AbstractComplexElement(src),
350                         AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
351                 init();
352                 if (src.getExtensions())
353                     setExtensions(src.getExtensions()->cloneExtensions());
354                 for (vector<OrganizationName*>::const_iterator i=src.m_OrganizationNames.begin(); i!=src.m_OrganizationNames.end(); i++) {
355                     if (*i) {
356                         getOrganizationNames().push_back((*i)->cloneOrganizationName());
357                     }
358                 }
359                 for (vector<OrganizationDisplayName*>::const_iterator j=src.m_OrganizationDisplayNames.begin(); j!=src.m_OrganizationDisplayNames.end(); j++) {
360                     if (*j) {
361                         getOrganizationDisplayNames().push_back((*j)->cloneOrganizationDisplayName());
362                     }
363                 }
364                 for (vector<OrganizationURL*>::const_iterator k=src.m_OrganizationURLs.begin(); k!=src.m_OrganizationURLs.end(); k++) {
365                     if (*k) {
366                         getOrganizationURLs().push_back((*k)->cloneOrganizationURL());
367                     }
368                 }
369             }
370
371             IMPL_XMLOBJECT_CLONE(Organization);
372             IMPL_TYPED_CHILD(Extensions);
373             IMPL_TYPED_CHILDREN(OrganizationName,m_pos_OrganizationDisplayName);
374             IMPL_TYPED_CHILDREN(OrganizationDisplayName,m_pos_OrganizationURL);
375             IMPL_TYPED_CHILDREN(OrganizationURL,m_children.end());
376
377         protected:
378             void marshallAttributes(DOMElement* domElement) const {
379                 marshallExtensionAttributes(domElement);
380             }
381
382             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
383                 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
384                 PROC_TYPED_CHILDREN(OrganizationName,SAML20MD_NS,false);
385                 PROC_TYPED_CHILDREN(OrganizationDisplayName,SAML20MD_NS,false);
386                 PROC_TYPED_CHILDREN(OrganizationURL,SAML20MD_NS,false);
387                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
388             }
389
390             void processAttribute(const DOMAttr* attribute) {
391                 unmarshallExtensionAttribute(attribute);
392             }
393         };
394
395         class SAML_DLLLOCAL ContactPersonImpl : public virtual ContactPerson,
396             public AbstractComplexElement,
397             public AbstractAttributeExtensibleXMLObject,
398             public AbstractDOMCachingXMLObject,
399             public AbstractXMLObjectMarshaller,
400             public AbstractXMLObjectUnmarshaller
401         {
402             list<XMLObject*>::iterator m_pos_TelephoneNumber;
403
404             void init() {
405                 m_ContactType=nullptr;
406                 m_children.push_back(nullptr);
407                 m_children.push_back(nullptr);
408                 m_children.push_back(nullptr);
409                 m_children.push_back(nullptr);
410                 m_children.push_back(nullptr);
411                 m_Extensions=nullptr;
412                 m_Company=nullptr;
413                 m_GivenName=nullptr;
414                 m_SurName=nullptr;
415                 m_pos_Extensions=m_children.begin();
416                 m_pos_Company=m_pos_Extensions;
417                 ++m_pos_Company;
418                 m_pos_GivenName=m_pos_Company;
419                 ++m_pos_GivenName;
420                 m_pos_SurName=m_pos_GivenName;
421                 ++m_pos_SurName;
422                 m_pos_TelephoneNumber=m_pos_SurName;
423                 ++m_pos_TelephoneNumber;
424             }
425
426         public:
427             virtual ~ContactPersonImpl() {
428                 XMLString::release(&m_ContactType);
429             }
430
431             ContactPersonImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
432                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
433                 init();
434             }
435
436             ContactPersonImpl(const ContactPersonImpl& src)
437                     : AbstractXMLObject(src), AbstractComplexElement(src),
438                         AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
439                 init();
440                 if (src.getExtensions())
441                     setExtensions(src.getExtensions()->cloneExtensions());
442                 if (src.getCompany())
443                     setCompany(src.getCompany()->cloneCompany());
444                 if (src.getGivenName())
445                     setGivenName(src.getGivenName()->cloneGivenName());
446                 if (src.getSurName())
447                     setSurName(src.getSurName()->cloneSurName());
448
449                 for (vector<EmailAddress*>::const_iterator i=src.m_EmailAddresss.begin(); i!=src.m_EmailAddresss.end(); i++) {
450                     if (*i) {
451                         getEmailAddresss().push_back((*i)->cloneEmailAddress());
452                     }
453                 }
454                 for (vector<TelephoneNumber*>::const_iterator j=src.m_TelephoneNumbers.begin(); j!=src.m_TelephoneNumbers.end(); j++) {
455                     if (*j) {
456                         getTelephoneNumbers().push_back((*j)->cloneTelephoneNumber());
457                     }
458                 }
459             }
460
461             IMPL_XMLOBJECT_CLONE(ContactPerson);
462             IMPL_STRING_ATTRIB(ContactType);
463             IMPL_TYPED_CHILD(Extensions);
464             IMPL_TYPED_CHILD(Company);
465             IMPL_TYPED_CHILD(GivenName);
466             IMPL_TYPED_CHILD(SurName);
467             IMPL_TYPED_CHILDREN(EmailAddress,m_pos_TelephoneNumber);
468             IMPL_TYPED_CHILDREN(TelephoneNumber,m_children.end());
469
470             void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
471                 if (!qualifiedName.hasNamespaceURI()) {
472                     if (XMLString::equals(qualifiedName.getLocalPart(),CONTACTTYPE_ATTRIB_NAME)) {
473                         setContactType(value);
474                         return;
475                     }
476                 }
477                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
478             }
479
480         protected:
481             void marshallAttributes(DOMElement* domElement) const {
482                 MARSHALL_STRING_ATTRIB(ContactType,CONTACTTYPE,nullptr);
483                 marshallExtensionAttributes(domElement);
484             }
485
486             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
487                 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
488                 PROC_TYPED_CHILD(Company,SAML20MD_NS,false);
489                 PROC_TYPED_CHILD(GivenName,SAML20MD_NS,false);
490                 PROC_TYPED_CHILD(SurName,SAML20MD_NS,false);
491                 PROC_TYPED_CHILDREN(EmailAddress,SAML20MD_NS,false);
492                 PROC_TYPED_CHILDREN(TelephoneNumber,SAML20MD_NS,false);
493                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
494             }
495
496             void processAttribute(const DOMAttr* attribute) {
497                 unmarshallExtensionAttribute(attribute);
498             }
499         };
500
501         class SAML_DLLLOCAL AdditionalMetadataLocationImpl : public virtual AdditionalMetadataLocation,
502             public AbstractSimpleElement,
503             public AbstractDOMCachingXMLObject,
504             public AbstractXMLObjectMarshaller,
505             public AbstractXMLObjectUnmarshaller
506         {
507             void init() {
508                 m_Namespace=nullptr;
509             }
510
511         public:
512             virtual ~AdditionalMetadataLocationImpl() {
513                 XMLString::release(&m_Namespace);
514             }
515
516             AdditionalMetadataLocationImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
517                     : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
518                 init();
519             }
520
521             AdditionalMetadataLocationImpl(const AdditionalMetadataLocationImpl& src)
522                     : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
523                 init();
524                 setNamespace(src.getNamespace());
525             }
526
527             IMPL_XMLOBJECT_CLONE(AdditionalMetadataLocation);
528             IMPL_STRING_ATTRIB(Namespace);
529
530         protected:
531             void marshallAttributes(DOMElement* domElement) const {
532                 MARSHALL_STRING_ATTRIB(Namespace,NAMESPACE,nullptr);
533             }
534
535             void processAttribute(const DOMAttr* attribute) {
536                 PROC_STRING_ATTRIB(Namespace,NAMESPACE,nullptr);
537                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
538             }
539         };
540
541         class SAML_DLLLOCAL KeyDescriptorImpl : public virtual KeyDescriptor,
542             public AbstractComplexElement,
543             public AbstractDOMCachingXMLObject,
544             public AbstractXMLObjectMarshaller,
545             public AbstractXMLObjectUnmarshaller
546         {
547                 void init() {
548                 m_Use=nullptr;
549                 m_KeyInfo=nullptr;
550                 m_children.push_back(nullptr);
551                 m_pos_KeyInfo=m_children.begin();
552             }
553
554         public:
555             virtual ~KeyDescriptorImpl() {
556                 XMLString::release(&m_Use);
557             }
558
559             KeyDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
560                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
561                 init();
562             }
563
564             KeyDescriptorImpl(const KeyDescriptorImpl& src)
565                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
566                 init();
567                 setUse(src.getUse());
568                 if (src.getKeyInfo())
569                     setKeyInfo(src.getKeyInfo()->cloneKeyInfo());
570                 for (vector<EncryptionMethod*>::const_iterator i=src.m_EncryptionMethods.begin(); i!=src.m_EncryptionMethods.end(); i++) {
571                     if (*i) {
572                         getEncryptionMethods().push_back((*i)->cloneEncryptionMethod());
573                     }
574                 }
575             }
576
577             IMPL_XMLOBJECT_CLONE(KeyDescriptor);
578             IMPL_STRING_ATTRIB(Use);
579             IMPL_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature);
580             IMPL_TYPED_FOREIGN_CHILDREN(EncryptionMethod,xmlencryption,m_children.end());
581
582         protected:
583             void marshallAttributes(DOMElement* domElement) const {
584                 MARSHALL_STRING_ATTRIB(Use,USE,nullptr);
585             }
586
587             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
588                 PROC_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature,XMLSIG_NS,false);
589                 PROC_TYPED_FOREIGN_CHILDREN(EncryptionMethod,xmlencryption,SAML20MD_NS,false);
590                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
591             }
592
593             void processAttribute(const DOMAttr* attribute) {
594                 PROC_STRING_ATTRIB(Use,USE,nullptr);
595                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
596             }
597         };
598
599         class SAML_DLLLOCAL EndpointTypeImpl : public virtual EndpointType,
600             public AbstractAttributeExtensibleXMLObject,
601             public AbstractComplexElement,
602             public AbstractDOMCachingXMLObject,
603             public AbstractXMLObjectMarshaller,
604             public AbstractXMLObjectUnmarshaller
605         {
606             void init() {
607                 m_Binding=m_Location=m_ResponseLocation=nullptr;
608             }
609
610         protected:
611             EndpointTypeImpl() {
612                 init();
613             }
614
615         public:
616             virtual ~EndpointTypeImpl() {
617                 XMLString::release(&m_Binding);
618                 XMLString::release(&m_Location);
619                 XMLString::release(&m_ResponseLocation);
620             }
621
622             EndpointTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
623                     : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
624                 init();
625             }
626
627             EndpointTypeImpl(const EndpointTypeImpl& src)
628                     : AbstractXMLObject(src),
629                         AbstractAttributeExtensibleXMLObject(src),
630                         AbstractComplexElement(src),
631                         AbstractDOMCachingXMLObject(src) {
632                 init();
633             }
634
635             void _clone(const EndpointTypeImpl& src) {
636                 setBinding(src.getBinding());
637                 setLocation(src.getLocation());
638                 setResponseLocation(src.getResponseLocation());
639                 for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) {
640                     if (*i) {
641                         getUnknownXMLObjects().push_back((*i)->clone());
642                     }
643                 }
644             }
645
646             IMPL_XMLOBJECT_CLONE_EX(EndpointType);
647             IMPL_STRING_ATTRIB(Binding);
648             IMPL_STRING_ATTRIB(Location);
649             IMPL_STRING_ATTRIB(ResponseLocation);
650             IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
651
652             void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
653                 if (!qualifiedName.hasNamespaceURI()) {
654                     if (XMLString::equals(qualifiedName.getLocalPart(),BINDING_ATTRIB_NAME)) {
655                         setBinding(value);
656                         return;
657                     }
658                     else if (XMLString::equals(qualifiedName.getLocalPart(),LOCATION_ATTRIB_NAME)) {
659                         setLocation(value);
660                         return;
661                     }
662                     else if (XMLString::equals(qualifiedName.getLocalPart(),RESPONSELOCATION_ATTRIB_NAME)) {
663                         setResponseLocation(value);
664                         return;
665                     }
666                 }
667                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
668             }
669         protected:
670             void marshallAttributes(DOMElement* domElement) const {
671                 MARSHALL_STRING_ATTRIB(Binding,BINDING,nullptr);
672                 MARSHALL_STRING_ATTRIB(Location,LOCATION,nullptr);
673                 MARSHALL_STRING_ATTRIB(ResponseLocation,RESPONSELOCATION,nullptr);
674                 marshallExtensionAttributes(domElement);
675             }
676
677             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
678                 // Unknown child.
679                 const XMLCh* nsURI=root->getNamespaceURI();
680                 if (!XMLString::equals(nsURI,SAML20MD_NS) && nsURI && *nsURI) {
681                     getUnknownXMLObjects().push_back(childXMLObject);
682                     return;
683                 }
684                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
685             }
686
687             void processAttribute(const DOMAttr* attribute) {
688                 unmarshallExtensionAttribute(attribute);
689             }
690         };
691
692         class SAML_DLLLOCAL IndexedEndpointTypeImpl : public virtual IndexedEndpointType, public EndpointTypeImpl
693         {
694             void init() {
695                 m_Index=nullptr;
696                 m_isDefault=XML_BOOL_NULL;
697             }
698
699         protected:
700             IndexedEndpointTypeImpl() {
701                 init();
702             }
703         public:
704             virtual ~IndexedEndpointTypeImpl() {
705                 XMLString::release(&m_Index);
706             }
707
708             IndexedEndpointTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
709                     : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
710                 init();
711             }
712
713             IndexedEndpointTypeImpl(const IndexedEndpointTypeImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {
714                 init();
715             }
716
717             void _clone(const IndexedEndpointTypeImpl& src) {
718                 EndpointTypeImpl::_clone(src);
719                 setIndex(src.m_Index);
720                 isDefault(src.m_isDefault);
721             }
722
723             IMPL_XMLOBJECT_CLONE_EX(IndexedEndpointType);
724             IMPL_INTEGER_ATTRIB(Index);
725             IMPL_BOOLEAN_ATTRIB(isDefault);
726
727             void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
728                 if (!qualifiedName.hasNamespaceURI()) {
729                     if (XMLString::equals(qualifiedName.getLocalPart(),INDEX_ATTRIB_NAME)) {
730                         setIndex(value);
731                         return;
732                     }
733                     else if (XMLString::equals(qualifiedName.getLocalPart(),ISDEFAULT_ATTRIB_NAME)) {
734                         setisDefault(value);
735                         return;
736                     }
737                 }
738                 EndpointTypeImpl::setAttribute(qualifiedName, value, ID);
739             }
740
741         protected:
742             void marshallAttributes(DOMElement* domElement) const {
743                 MARSHALL_INTEGER_ATTRIB(Index,INDEX,nullptr);
744                 MARSHALL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,nullptr);
745                 EndpointTypeImpl::marshallAttributes(domElement);
746             }
747         };
748
749         class SAML_DLLLOCAL ArtifactResolutionServiceImpl : public virtual ArtifactResolutionService, public IndexedEndpointTypeImpl
750         {
751         public:
752             virtual ~ArtifactResolutionServiceImpl() {}
753
754             ArtifactResolutionServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
755                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
756
757             ArtifactResolutionServiceImpl(const ArtifactResolutionServiceImpl& src) : AbstractXMLObject(src), IndexedEndpointTypeImpl(src) {}
758
759             IMPL_XMLOBJECT_CLONE_EX(ArtifactResolutionService);
760         };
761
762         class SAML_DLLLOCAL SingleLogoutServiceImpl : public virtual SingleLogoutService, public EndpointTypeImpl
763         {
764         public:
765             virtual ~SingleLogoutServiceImpl() {}
766
767             SingleLogoutServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
768                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
769
770             SingleLogoutServiceImpl(const SingleLogoutServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
771
772             IMPL_XMLOBJECT_CLONE_EX(SingleLogoutService);
773         };
774
775         class SAML_DLLLOCAL ManageNameIDServiceImpl : public virtual ManageNameIDService, public EndpointTypeImpl
776         {
777         public:
778             virtual ~ManageNameIDServiceImpl() {}
779
780             ManageNameIDServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
781                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
782
783             ManageNameIDServiceImpl(const ManageNameIDServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
784
785             IMPL_XMLOBJECT_CLONE_EX(ManageNameIDService);
786         };
787
788         class SAML_DLLLOCAL SingleSignOnServiceImpl : public virtual SingleSignOnService, public EndpointTypeImpl
789         {
790         public:
791             virtual ~SingleSignOnServiceImpl() {}
792
793             SingleSignOnServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
794                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
795
796             SingleSignOnServiceImpl(const SingleSignOnServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
797
798             IMPL_XMLOBJECT_CLONE_EX(SingleSignOnService);
799         };
800
801         class SAML_DLLLOCAL NameIDMappingServiceImpl : public virtual NameIDMappingService, public EndpointTypeImpl
802         {
803         public:
804             virtual ~NameIDMappingServiceImpl() {}
805
806             NameIDMappingServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
807                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
808
809             NameIDMappingServiceImpl(const NameIDMappingServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
810
811             IMPL_XMLOBJECT_CLONE_EX(NameIDMappingService);
812         };
813
814         class SAML_DLLLOCAL AssertionIDRequestServiceImpl : public virtual AssertionIDRequestService, public EndpointTypeImpl
815         {
816         public:
817             virtual ~AssertionIDRequestServiceImpl() {}
818
819             AssertionIDRequestServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
820                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
821
822             AssertionIDRequestServiceImpl(const AssertionIDRequestServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
823
824             IMPL_XMLOBJECT_CLONE_EX(AssertionIDRequestService);
825         };
826
827         class SAML_DLLLOCAL AssertionConsumerServiceImpl : public virtual AssertionConsumerService, public IndexedEndpointTypeImpl
828         {
829         public:
830             virtual ~AssertionConsumerServiceImpl() {}
831
832             AssertionConsumerServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
833                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
834
835             AssertionConsumerServiceImpl(const AssertionConsumerServiceImpl& src) : AbstractXMLObject(src), IndexedEndpointTypeImpl(src) {}
836
837             IMPL_XMLOBJECT_CLONE_EX(AssertionConsumerService);
838         };
839
840         class SAML_DLLLOCAL AuthnQueryServiceImpl : public virtual AuthnQueryService, public EndpointTypeImpl
841         {
842         public:
843             virtual ~AuthnQueryServiceImpl() {}
844
845             AuthnQueryServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
846                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
847
848             AuthnQueryServiceImpl(const AuthnQueryServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
849
850             IMPL_XMLOBJECT_CLONE_EX(AuthnQueryService);
851         };
852
853         class SAML_DLLLOCAL AuthzServiceImpl : public virtual AuthzService, public EndpointTypeImpl
854         {
855         public:
856             virtual ~AuthzServiceImpl() {}
857
858             AuthzServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
859                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
860
861             AuthzServiceImpl(const AuthzServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
862
863             IMPL_XMLOBJECT_CLONE_EX(AuthzService);
864         };
865
866         class SAML_DLLLOCAL AttributeServiceImpl : public virtual AttributeService, public EndpointTypeImpl
867         {
868         public:
869             virtual ~AttributeServiceImpl() {}
870
871             AttributeServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
872                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
873
874             AttributeServiceImpl(const AttributeServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
875
876             IMPL_XMLOBJECT_CLONE_EX(AttributeService);
877         };
878
879         class SAML_DLLLOCAL RoleDescriptorImpl : public virtual RoleDescriptor,
880             public virtual SignableObject,
881             public AbstractComplexElement,
882             public AbstractAttributeExtensibleXMLObject,
883             public AbstractDOMCachingXMLObject,
884             public AbstractXMLObjectMarshaller,
885             public AbstractXMLObjectUnmarshaller
886         {
887             void init() {
888                 m_ID=m_ProtocolSupportEnumeration=m_ErrorURL=nullptr;
889                 m_ValidUntil=m_CacheDuration=nullptr;
890                 m_children.push_back(nullptr);
891                 m_children.push_back(nullptr);
892                 m_children.push_back(nullptr);
893                 m_children.push_back(nullptr);
894                 m_Signature=nullptr;
895                 m_Extensions=nullptr;
896                 m_Organization=nullptr;
897                 m_pos_Signature=m_children.begin();
898                 m_pos_Extensions=m_pos_Signature;
899                 ++m_pos_Extensions;
900                 m_pos_Organization=m_pos_Extensions;
901                 ++m_pos_Organization;
902                 m_pos_ContactPerson=m_pos_Organization;
903                 ++m_pos_ContactPerson;
904             }
905
906         protected:
907             list<XMLObject*>::iterator m_pos_ContactPerson;
908
909             RoleDescriptorImpl() {
910                 init();
911             }
912
913         public:
914             virtual ~RoleDescriptorImpl() {
915                 XMLString::release(&m_ID);
916                 XMLString::release(&m_ProtocolSupportEnumeration);
917                 XMLString::release(&m_ErrorURL);
918                 delete m_ValidUntil;
919                 delete m_CacheDuration;
920             }
921
922             RoleDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
923                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
924                 init();
925             }
926
927             RoleDescriptorImpl(const RoleDescriptorImpl& src)
928                     : AbstractXMLObject(src), AbstractComplexElement(src),
929                         AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
930                 init();
931             }
932
933             void _clone(const RoleDescriptorImpl& src) {
934                 setID(src.getID());
935                 setProtocolSupportEnumeration(src.getProtocolSupportEnumeration());
936                 setErrorURL(src.getErrorURL());
937                 setValidUntil(src.getValidUntil());
938                 setCacheDuration(src.getCacheDuration());
939                 if (src.getSignature())
940                     setSignature(src.getSignature()->cloneSignature());
941                 if (src.getExtensions())
942                     setExtensions(src.getExtensions()->cloneExtensions());
943                 if (src.getOrganization())
944                     setOrganization(src.getOrganization()->cloneOrganization());
945
946                 for (vector<KeyDescriptor*>::const_iterator i=src.m_KeyDescriptors.begin(); i!=src.m_KeyDescriptors.end(); i++) {
947                     if (*i) {
948                         getKeyDescriptors().push_back((*i)->cloneKeyDescriptor());
949                     }
950                 }
951                 for (vector<ContactPerson*>::const_iterator j=src.m_ContactPersons.begin(); j!=src.m_ContactPersons.end(); j++) {
952                     if (*j) {
953                         getContactPersons().push_back((*j)->cloneContactPerson());
954                     }
955                 }
956             }
957
958             //IMPL_TYPED_CHILD(Signature);
959             // Need customized setter.
960         protected:
961             Signature* m_Signature;
962             list<XMLObject*>::iterator m_pos_Signature;
963         public:
964             Signature* getSignature() const {
965                 return m_Signature;
966             }
967
968             void setSignature(Signature* sig) {
969                 prepareForAssignment(m_Signature,sig);
970                 *m_pos_Signature=m_Signature=sig;
971                 // Sync content reference back up.
972                 if (m_Signature)
973                     m_Signature->setContentReference(new opensaml::ContentReference(*this));
974             }
975
976             RoleDescriptor* cloneRoleDescriptor() const {
977                 return dynamic_cast<RoleDescriptor*>(clone());
978             }
979
980             IMPL_ID_ATTRIB_EX(ID,ID,nullptr);
981             IMPL_STRING_ATTRIB(ProtocolSupportEnumeration);
982             IMPL_STRING_ATTRIB(ErrorURL);
983             IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
984             IMPL_DURATION_ATTRIB(CacheDuration,0);
985             IMPL_TYPED_CHILD(Extensions);
986             IMPL_TYPED_CHILDREN(KeyDescriptor,m_pos_Organization);
987             IMPL_TYPED_CHILD(Organization);
988             IMPL_TYPED_CHILDREN(ContactPerson,m_pos_ContactPerson);
989
990             bool hasSupport(const XMLCh* protocol) const {
991                 if (!protocol || !*protocol)
992                     return true;
993                 if (m_ProtocolSupportEnumeration) {
994                     // Look for first character.
995                     xsecsize_t len=XMLString::stringLen(protocol);
996                     xsecsize_t pos=0;
997                     int index=XMLString::indexOf(m_ProtocolSupportEnumeration,protocol[0],pos);
998                     while (index>=0) {
999                         // Only possible match is if it's the first character or a space comes before it.
1000                         if (index==0 || m_ProtocolSupportEnumeration[index-1]==chSpace) {
1001                             // See if rest of protocol string is present.
1002                             if (0==XMLString::compareNString(m_ProtocolSupportEnumeration+index+1,protocol+1,len-1)) {
1003                                 // Only possible match is if it's the last character or a space comes after it.
1004                                 if (m_ProtocolSupportEnumeration[index+len]==chNull || m_ProtocolSupportEnumeration[index+len]==chSpace)
1005                                     return true;
1006                                 else
1007                                     pos=index+len;
1008                             }
1009                             else {
1010                                 // Move past last search and start again.
1011                                 pos=index+1;
1012                             }
1013                         }
1014                         else {
1015                             // Move past last search and start again.
1016                             pos=index+1;
1017                         }
1018                         index=XMLString::indexOf(m_ProtocolSupportEnumeration,protocol[0],pos);
1019                     }
1020                 }
1021                 return false;
1022             }
1023
1024             void addSupport(const XMLCh* protocol) {
1025                 if (hasSupport(protocol))
1026                     return;
1027                 if (m_ProtocolSupportEnumeration && *m_ProtocolSupportEnumeration) {
1028 #ifdef HAVE_GOOD_STL
1029                     xstring pse(m_ProtocolSupportEnumeration);
1030                     pse = pse + chSpace + protocol;
1031                     setProtocolSupportEnumeration(pse.c_str());
1032 #else
1033                     auto_ptr_char temp(m_ProtocolSupportEnumeration);
1034                     auto_ptr_char temp2(protocol);
1035                     string pse(temp.get());
1036                     pse = pse + ' ' + temp2.get();
1037                     auto_ptr_XMLCh temp3(pse.c_str());
1038                     setProtocolSupportEnumeration(temp3.get());
1039 #endif
1040                 }
1041                 else {
1042                     setProtocolSupportEnumeration(protocol);
1043                 }
1044             }
1045
1046             void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
1047                 if (!qualifiedName.hasNamespaceURI()) {
1048                     if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) {
1049                         setID(value);
1050                         return;
1051                     }
1052                     else if (XMLString::equals(qualifiedName.getLocalPart(),PROTOCOLSUPPORTENUMERATION_ATTRIB_NAME)) {
1053                         setProtocolSupportEnumeration(value);
1054                         return;
1055                     }
1056                     else if (XMLString::equals(qualifiedName.getLocalPart(),ERRORURL_ATTRIB_NAME)) {
1057                         setErrorURL(value);
1058                         return;
1059                     }
1060                     else if (XMLString::equals(qualifiedName.getLocalPart(),VALIDUNTIL_ATTRIB_NAME)) {
1061                         setValidUntil(value);
1062                         return;
1063                     }
1064                     else if (XMLString::equals(qualifiedName.getLocalPart(),CACHEDURATION_ATTRIB_NAME)) {
1065                         setCacheDuration(value);
1066                         return;
1067                     }
1068                 }
1069                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
1070             }
1071
1072         protected:
1073             void prepareForMarshalling() const {
1074                 if (m_Signature)
1075                     declareNonVisibleNamespaces();
1076             }
1077
1078             void marshallAttributes(DOMElement* domElement) const {
1079                 MARSHALL_ID_ATTRIB(ID,ID,nullptr);
1080                 MARSHALL_STRING_ATTRIB(ProtocolSupportEnumeration,PROTOCOLSUPPORTENUMERATION,nullptr);
1081                 MARSHALL_STRING_ATTRIB(ErrorURL,ERRORURL,nullptr);
1082                 MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,nullptr);
1083                 MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,nullptr);
1084                 marshallExtensionAttributes(domElement);
1085             }
1086
1087             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1088                 PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLSIG_NS,false);
1089                 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
1090                 PROC_TYPED_CHILDREN(KeyDescriptor,SAML20MD_NS,false);
1091                 PROC_TYPED_CHILD(Organization,SAML20MD_NS,false);
1092                 PROC_TYPED_CHILDREN(ContactPerson,SAML20MD_NS,false);
1093                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
1094             }
1095
1096             void processAttribute(const DOMAttr* attribute) {
1097                 PROC_ID_ATTRIB(ID,ID,nullptr);
1098                 unmarshallExtensionAttribute(attribute);
1099             }
1100         };
1101
1102         class SAML_DLLLOCAL RoleDescriptorTypeImpl : public virtual RoleDescriptorType, public RoleDescriptorImpl
1103         {
1104         public:
1105             virtual ~RoleDescriptorTypeImpl() {}
1106
1107             RoleDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1108                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1109             }
1110
1111             RoleDescriptorTypeImpl(const RoleDescriptorTypeImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1112             }
1113
1114             void _clone(const RoleDescriptorTypeImpl& src) {
1115                 RoleDescriptorImpl::_clone(src);
1116                 for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) {
1117                     if (*i) {
1118                         getUnknownXMLObjects().push_back((*i)->clone());
1119                     }
1120                 }
1121             }
1122
1123             IMPL_XMLOBJECT_CLONE_EX(RoleDescriptorType);
1124             IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
1125
1126         protected:
1127             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1128                 getUnknownXMLObjects().push_back(childXMLObject);
1129             }
1130         };
1131
1132         class SAML_DLLLOCAL SSODescriptorTypeImpl : public virtual SSODescriptorType, public RoleDescriptorImpl
1133         {
1134             void init() {
1135                 m_children.push_back(nullptr);
1136                 m_children.push_back(nullptr);
1137                 m_children.push_back(nullptr);
1138                 m_children.push_back(nullptr);
1139                 m_pos_ArtifactResolutionService=m_pos_ContactPerson;
1140                 ++m_pos_ArtifactResolutionService;
1141                 m_pos_SingleLogoutService=m_pos_ArtifactResolutionService;
1142                 ++m_pos_SingleLogoutService;
1143                 m_pos_ManageNameIDService=m_pos_SingleLogoutService;
1144                 ++m_pos_ManageNameIDService;
1145                 m_pos_NameIDFormat=m_pos_ManageNameIDService;
1146                 ++m_pos_NameIDFormat;
1147             }
1148
1149         protected:
1150             list<XMLObject*>::iterator m_pos_ArtifactResolutionService;
1151             list<XMLObject*>::iterator m_pos_SingleLogoutService;
1152             list<XMLObject*>::iterator m_pos_ManageNameIDService;
1153             list<XMLObject*>::iterator m_pos_NameIDFormat;
1154
1155             SSODescriptorTypeImpl() {
1156                 init();
1157             }
1158
1159         public:
1160             virtual ~SSODescriptorTypeImpl() {}
1161
1162             SSODescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1163                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1164                 init();
1165             }
1166
1167             SSODescriptorTypeImpl(const SSODescriptorTypeImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1168                 init();
1169             }
1170
1171             void _clone(const SSODescriptorTypeImpl& src) {
1172                 RoleDescriptorImpl::_clone(src);
1173                 for (vector<ArtifactResolutionService*>::const_iterator i=src.m_ArtifactResolutionServices.begin(); i!=src.m_ArtifactResolutionServices.end(); i++) {
1174                     if (*i) {
1175                         getArtifactResolutionServices().push_back((*i)->cloneArtifactResolutionService());
1176                     }
1177                 }
1178                 for (vector<SingleLogoutService*>::const_iterator j=src.m_SingleLogoutServices.begin(); j!=src.m_SingleLogoutServices.end(); j++) {
1179                     if (*j) {
1180                         getSingleLogoutServices().push_back((*j)->cloneSingleLogoutService());
1181                     }
1182                 }
1183                 for (vector<ManageNameIDService*>::const_iterator k=src.m_ManageNameIDServices.begin(); k!=src.m_ManageNameIDServices.end(); k++) {
1184                     if (*k) {
1185                         getManageNameIDServices().push_back((*k)->cloneManageNameIDService());
1186                     }
1187                 }
1188                 for (vector<NameIDFormat*>::const_iterator m=src.m_NameIDFormats.begin(); m!=src.m_NameIDFormats.end(); m++) {
1189                     if (*m) {
1190                         getNameIDFormats().push_back((*m)->cloneNameIDFormat());
1191                     }
1192                 }
1193             }
1194
1195             SSODescriptorType* cloneSSODescriptorType() const {
1196                 return dynamic_cast<SSODescriptorType*>(clone());
1197             }
1198
1199             IMPL_TYPED_CHILDREN(ArtifactResolutionService,m_pos_ArtifactResolutionService);
1200             IMPL_TYPED_CHILDREN(SingleLogoutService,m_pos_SingleLogoutService);
1201             IMPL_TYPED_CHILDREN(ManageNameIDService,m_pos_ManageNameIDService);
1202             IMPL_TYPED_CHILDREN(NameIDFormat,m_pos_NameIDFormat);
1203
1204         protected:
1205             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1206                 PROC_TYPED_CHILDREN(ArtifactResolutionService,SAML20MD_NS,false);
1207                 PROC_TYPED_CHILDREN(SingleLogoutService,SAML20MD_NS,false);
1208                 PROC_TYPED_CHILDREN(ManageNameIDService,SAML20MD_NS,false);
1209                 PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
1210                 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1211             }
1212         };
1213
1214         class SAML_DLLLOCAL IDPSSODescriptorImpl : public virtual IDPSSODescriptor, public SSODescriptorTypeImpl
1215         {
1216             list<XMLObject*>::iterator m_pos_SingleSignOnService;
1217             list<XMLObject*>::iterator m_pos_NameIDMappingService;
1218             list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
1219             list<XMLObject*>::iterator m_pos_AttributeProfile;
1220
1221             void init() {
1222                 m_WantAuthnRequestsSigned=XML_BOOL_NULL;
1223                 m_children.push_back(nullptr);
1224                 m_children.push_back(nullptr);
1225                 m_children.push_back(nullptr);
1226                 m_children.push_back(nullptr);
1227                 m_pos_SingleSignOnService=m_pos_NameIDFormat;
1228                 ++m_pos_SingleSignOnService;
1229                 m_pos_NameIDMappingService=m_pos_SingleSignOnService;
1230                 ++m_pos_NameIDMappingService;
1231                 m_pos_AssertionIDRequestService=m_pos_NameIDMappingService;
1232                 ++m_pos_AssertionIDRequestService;
1233                 m_pos_AttributeProfile=m_pos_AssertionIDRequestService;
1234                 ++m_pos_AttributeProfile;
1235             }
1236
1237         public:
1238             virtual ~IDPSSODescriptorImpl() {}
1239
1240             IDPSSODescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1241                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1242                 init();
1243             }
1244
1245             IDPSSODescriptorImpl(const IDPSSODescriptorImpl& src) : AbstractXMLObject(src), SSODescriptorTypeImpl(src) {
1246                 init();
1247             }
1248
1249             void _clone(const IDPSSODescriptorImpl& src) {
1250                 SSODescriptorTypeImpl::_clone(src);
1251                 WantAuthnRequestsSigned(src.m_WantAuthnRequestsSigned);
1252                 for (vector<SingleSignOnService*>::const_iterator i=src.m_SingleSignOnServices.begin(); i!=src.m_SingleSignOnServices.end(); i++) {
1253                     if (*i) {
1254                         getSingleSignOnServices().push_back((*i)->cloneSingleSignOnService());
1255                     }
1256                 }
1257                 for (vector<NameIDMappingService*>::const_iterator j=src.m_NameIDMappingServices.begin(); j!=src.m_NameIDMappingServices.end(); j++) {
1258                     if (*j) {
1259                         getNameIDMappingServices().push_back((*j)->cloneNameIDMappingService());
1260                     }
1261                 }
1262                 for (vector<AssertionIDRequestService*>::const_iterator k=src.m_AssertionIDRequestServices.begin(); k!=src.m_AssertionIDRequestServices.end(); k++) {
1263                     if (*k) {
1264                         getAssertionIDRequestServices().push_back((*k)->cloneAssertionIDRequestService());
1265                     }
1266                 }
1267                 for (vector<AttributeProfile*>::const_iterator m=src.m_AttributeProfiles.begin(); m!=src.m_AttributeProfiles.end(); m++) {
1268                     if (*m) {
1269                         getAttributeProfiles().push_back((*m)->cloneAttributeProfile());
1270                     }
1271                 }
1272                 for (vector<Attribute*>::const_iterator n=src.m_Attributes.begin(); n!=src.m_Attributes.end(); n++) {
1273                     if (*n) {
1274                         getAttributes().push_back((*n)->cloneAttribute());
1275                     }
1276                 }
1277             }
1278
1279             IMPL_XMLOBJECT_CLONE_EX(IDPSSODescriptor);
1280             IMPL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned);
1281             IMPL_TYPED_CHILDREN(SingleSignOnService,m_pos_SingleSignOnService);
1282             IMPL_TYPED_CHILDREN(NameIDMappingService,m_pos_NameIDMappingService);
1283             IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
1284             IMPL_TYPED_CHILDREN(AttributeProfile,m_pos_AttributeProfile);
1285             IMPL_TYPED_FOREIGN_CHILDREN(Attribute,saml2,m_children.end());
1286
1287             void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
1288                 if (!qualifiedName.hasNamespaceURI()) {
1289                     if (XMLString::equals(qualifiedName.getLocalPart(),WANTAUTHNREQUESTSSIGNED_ATTRIB_NAME)) {
1290                         setWantAuthnRequestsSigned(value);
1291                         return;
1292                     }
1293                 }
1294                 RoleDescriptorImpl::setAttribute(qualifiedName, value, ID);
1295             }
1296
1297         protected:
1298             void marshallAttributes(DOMElement* domElement) const {
1299                 MARSHALL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned,WANTAUTHNREQUESTSSIGNED,nullptr);
1300                 RoleDescriptorImpl::marshallAttributes(domElement);
1301             }
1302
1303             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1304                 PROC_TYPED_CHILDREN(SingleSignOnService,SAML20MD_NS,false);
1305                 PROC_TYPED_CHILDREN(NameIDMappingService,SAML20MD_NS,false);
1306                 PROC_TYPED_CHILDREN(AssertionIDRequestService,SAML20MD_NS,false);
1307                 PROC_TYPED_CHILDREN(AttributeProfile,SAML20MD_NS,false);
1308                 PROC_TYPED_FOREIGN_CHILDREN(Attribute,saml2,SAML20_NS,false);
1309                 SSODescriptorTypeImpl::processChildElement(childXMLObject,root);
1310             }
1311         };
1312
1313         class SAML_DLLLOCAL RequestedAttributeImpl : public virtual RequestedAttribute,
1314             public AbstractComplexElement,
1315             public AbstractAttributeExtensibleXMLObject,
1316             public AbstractDOMCachingXMLObject,
1317             public AbstractXMLObjectMarshaller,
1318             public AbstractXMLObjectUnmarshaller
1319         {
1320             void init() {
1321                 m_Name=m_NameFormat=m_FriendlyName=nullptr;
1322                 m_isRequired=XML_BOOL_NULL;
1323             }
1324
1325         public:
1326             virtual ~RequestedAttributeImpl() {
1327                 XMLString::release(&m_Name);
1328                 XMLString::release(&m_NameFormat);
1329                 XMLString::release(&m_FriendlyName);
1330             }
1331
1332             RequestedAttributeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1333                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1334                 init();
1335             }
1336
1337             RequestedAttributeImpl(const RequestedAttributeImpl& src)
1338                     : AbstractXMLObject(src), AbstractComplexElement(src),
1339                         AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
1340                 init();
1341                 setName(src.getName());
1342                 setNameFormat(src.getNameFormat());
1343                 setFriendlyName(src.getFriendlyName());
1344                 isRequired(src.m_isRequired);
1345                 for (vector<XMLObject*>::const_iterator i=src.m_AttributeValues.begin(); i!=src.m_AttributeValues.end(); i++) {
1346                     if (*i) {
1347                         getAttributeValues().push_back((*i)->clone());
1348                     }
1349                 }
1350             }
1351
1352             IMPL_XMLOBJECT_CLONE2(RequestedAttribute,Attribute);
1353             IMPL_STRING_ATTRIB(Name);
1354             IMPL_STRING_ATTRIB(NameFormat);
1355             IMPL_STRING_ATTRIB(FriendlyName);
1356             IMPL_BOOLEAN_ATTRIB(isRequired);
1357             IMPL_XMLOBJECT_CHILDREN(AttributeValue,m_children.end());
1358
1359             void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
1360                 if (!qualifiedName.hasNamespaceURI()) {
1361                     if (XMLString::equals(qualifiedName.getLocalPart(),NAME_ATTRIB_NAME)) {
1362                         setName(value);
1363                         return;
1364                     }
1365                     else if (XMLString::equals(qualifiedName.getLocalPart(),NAMEFORMAT_ATTRIB_NAME)) {
1366                         setNameFormat(value);
1367                         return;
1368                     }
1369                     else if (XMLString::equals(qualifiedName.getLocalPart(),FRIENDLYNAME_ATTRIB_NAME)) {
1370                         setFriendlyName(value);
1371                         return;
1372                     }
1373                     else if (XMLString::equals(qualifiedName.getLocalPart(),ISREQUIRED_ATTRIB_NAME)) {
1374                         setisRequired(value);
1375                         return;
1376                     }
1377                 }
1378                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
1379             }
1380
1381         protected:
1382             void marshallAttributes(DOMElement* domElement) const {
1383                 MARSHALL_STRING_ATTRIB(Name,NAME,nullptr);
1384                 MARSHALL_STRING_ATTRIB(NameFormat,NAMEFORMAT,nullptr);
1385                 MARSHALL_STRING_ATTRIB(FriendlyName,FRIENDLYNAME,nullptr);
1386                 MARSHALL_BOOLEAN_ATTRIB(isRequired,ISREQUIRED,nullptr);
1387                 marshallExtensionAttributes(domElement);
1388             }
1389
1390             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1391                 getAttributeValues().push_back(childXMLObject);
1392             }
1393
1394             void processAttribute(const DOMAttr* attribute) {
1395                 unmarshallExtensionAttribute(attribute);
1396             }
1397         };
1398
1399         class SAML_DLLLOCAL AttributeConsumingServiceImpl : public virtual AttributeConsumingService,
1400             public AbstractComplexElement,
1401             public AbstractDOMCachingXMLObject,
1402             public AbstractXMLObjectMarshaller,
1403             public AbstractXMLObjectUnmarshaller
1404         {
1405             list<XMLObject*>::iterator m_pos_ServiceDescription;
1406             list<XMLObject*>::iterator m_pos_RequestedAttribute;
1407
1408                 void init() {
1409                 m_Index=nullptr;
1410                 m_isDefault=XML_BOOL_NULL;
1411                 m_children.push_back(nullptr);
1412                 m_children.push_back(nullptr);
1413                 m_pos_ServiceDescription=m_children.begin();
1414                 m_pos_RequestedAttribute=m_pos_ServiceDescription;
1415                 ++m_pos_RequestedAttribute;
1416             }
1417
1418         public:
1419             virtual ~AttributeConsumingServiceImpl() {
1420                 XMLString::release(&m_Index);
1421             }
1422
1423             AttributeConsumingServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1424                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1425                 init();
1426             }
1427
1428             AttributeConsumingServiceImpl(const AttributeConsumingServiceImpl& src)
1429                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
1430                 init();
1431                 setIndex(src.m_Index);
1432                 isDefault(src.m_isDefault);
1433                 for (vector<ServiceName*>::const_iterator i=src.m_ServiceNames.begin(); i!=src.m_ServiceNames.end(); i++) {
1434                     if (*i) {
1435                         getServiceNames().push_back((*i)->cloneServiceName());
1436                     }
1437                 }
1438                 for (vector<ServiceDescription*>::const_iterator j=src.m_ServiceDescriptions.begin(); j!=src.m_ServiceDescriptions.end(); j++) {
1439                     if (*j) {
1440                         getServiceDescriptions().push_back((*j)->cloneServiceDescription());
1441                     }
1442                 }
1443                 for (vector<RequestedAttribute*>::const_iterator k=src.m_RequestedAttributes.begin(); k!=src.m_RequestedAttributes.end(); k++) {
1444                     if (*k) {
1445                         getRequestedAttributes().push_back((*k)->cloneRequestedAttribute());
1446                     }
1447                 }
1448             }
1449
1450             IMPL_XMLOBJECT_CLONE(AttributeConsumingService);
1451             IMPL_INTEGER_ATTRIB(Index);
1452             IMPL_BOOLEAN_ATTRIB(isDefault);
1453             IMPL_TYPED_CHILDREN(ServiceName,m_pos_ServiceDescription);
1454             IMPL_TYPED_CHILDREN(ServiceDescription,m_pos_RequestedAttribute);
1455             IMPL_TYPED_CHILDREN(RequestedAttribute,m_children.end());
1456
1457         protected:
1458             void marshallAttributes(DOMElement* domElement) const {
1459                 MARSHALL_INTEGER_ATTRIB(Index,INDEX,nullptr);
1460                 MARSHALL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,nullptr);
1461             }
1462
1463             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1464                 PROC_TYPED_CHILDREN(ServiceName,SAML20MD_NS,false);
1465                 PROC_TYPED_CHILDREN(ServiceDescription,SAML20MD_NS,false);
1466                 PROC_TYPED_CHILDREN(RequestedAttribute,SAML20MD_NS,false);
1467                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
1468             }
1469
1470             void processAttribute(const DOMAttr* attribute) {
1471                 PROC_INTEGER_ATTRIB(Index,INDEX,nullptr);
1472                 PROC_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,nullptr);
1473                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
1474             }
1475         };
1476
1477         class SAML_DLLLOCAL SPSSODescriptorImpl : public virtual SPSSODescriptor, public SSODescriptorTypeImpl
1478         {
1479             list<XMLObject*>::iterator m_pos_AssertionConsumerService;
1480
1481             void init() {
1482                 m_AuthnRequestsSigned=XML_BOOL_NULL;
1483                 m_WantAssertionsSigned=XML_BOOL_NULL;
1484                 m_children.push_back(nullptr);
1485                 m_pos_AssertionConsumerService=m_pos_NameIDFormat;
1486                 ++m_pos_AssertionConsumerService;
1487             }
1488
1489         public:
1490             virtual ~SPSSODescriptorImpl() {}
1491
1492             SPSSODescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1493                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1494                 init();
1495             }
1496
1497             SPSSODescriptorImpl(const SPSSODescriptorImpl& src) : AbstractXMLObject(src), SSODescriptorTypeImpl(src) {
1498                 init();
1499             }
1500
1501             void _clone(const SPSSODescriptorImpl& src) {
1502                 SSODescriptorTypeImpl::_clone(src);
1503                 AuthnRequestsSigned(src.m_AuthnRequestsSigned);
1504                 WantAssertionsSigned(src.m_WantAssertionsSigned);
1505                 for (vector<AssertionConsumerService*>::const_iterator i=src.m_AssertionConsumerServices.begin(); i!=src.m_AssertionConsumerServices.end(); i++) {
1506                     if (*i) {
1507                         getAssertionConsumerServices().push_back((*i)->cloneAssertionConsumerService());
1508                     }
1509                 }
1510                 for (vector<AttributeConsumingService*>::const_iterator j=src.m_AttributeConsumingServices.begin(); j!=src.m_AttributeConsumingServices.end(); j++) {
1511                     if (*j) {
1512                         getAttributeConsumingServices().push_back((*j)->cloneAttributeConsumingService());
1513                     }
1514                 }
1515             }
1516
1517             IMPL_XMLOBJECT_CLONE_EX(SPSSODescriptor);
1518             IMPL_BOOLEAN_ATTRIB(AuthnRequestsSigned);
1519             IMPL_BOOLEAN_ATTRIB(WantAssertionsSigned);
1520             IMPL_TYPED_CHILDREN(AssertionConsumerService,m_pos_AssertionConsumerService);
1521             IMPL_TYPED_CHILDREN(AttributeConsumingService,m_children.end());
1522
1523             void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
1524                 if (!qualifiedName.hasNamespaceURI()) {
1525                     if (XMLString::equals(qualifiedName.getLocalPart(),AUTHNREQUESTSSIGNED_ATTRIB_NAME)) {
1526                         setAuthnRequestsSigned(value);
1527                         return;
1528                     }
1529                     else if (XMLString::equals(qualifiedName.getLocalPart(),WANTASSERTIONSSIGNED_ATTRIB_NAME)) {
1530                         setWantAssertionsSigned(value);
1531                         return;
1532                     }
1533                 }
1534                 RoleDescriptorImpl::setAttribute(qualifiedName, value, ID);
1535             }
1536
1537         protected:
1538             void marshallAttributes(DOMElement* domElement) const {
1539                 MARSHALL_BOOLEAN_ATTRIB(AuthnRequestsSigned,AUTHNREQUESTSSIGNED,nullptr);
1540                 MARSHALL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,nullptr);
1541                 RoleDescriptorImpl::marshallAttributes(domElement);
1542             }
1543
1544             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1545                 PROC_TYPED_CHILDREN(AssertionConsumerService,SAML20MD_NS,false);
1546                 PROC_TYPED_CHILDREN(AttributeConsumingService,SAML20MD_NS,false);
1547                 SSODescriptorTypeImpl::processChildElement(childXMLObject,root);
1548             }
1549         };
1550
1551         class SAML_DLLLOCAL AuthnAuthorityDescriptorImpl : public virtual AuthnAuthorityDescriptor, public RoleDescriptorImpl
1552         {
1553             list<XMLObject*>::iterator m_pos_AuthnQueryService;
1554             list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
1555
1556             void init() {
1557                 m_children.push_back(nullptr);
1558                 m_children.push_back(nullptr);
1559                 m_pos_AuthnQueryService=m_pos_ContactPerson;
1560                 ++m_pos_AuthnQueryService;
1561                 m_pos_AssertionIDRequestService=m_pos_AuthnQueryService;
1562                 ++m_pos_AssertionIDRequestService;
1563             }
1564
1565         public:
1566             virtual ~AuthnAuthorityDescriptorImpl() {}
1567
1568             AuthnAuthorityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1569                     : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1570                 init();
1571             }
1572
1573             AuthnAuthorityDescriptorImpl(const AuthnAuthorityDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1574                 init();
1575             }
1576
1577             void _clone(const AuthnAuthorityDescriptorImpl& src) {
1578                 RoleDescriptorImpl::_clone(src);
1579                 for (vector<AuthnQueryService*>::const_iterator i=src.m_AuthnQueryServices.begin(); i!=src.m_AuthnQueryServices.end(); i++) {
1580                     if (*i) {
1581                         getAuthnQueryServices().push_back((*i)->cloneAuthnQueryService());
1582                     }
1583                 }
1584                 for (vector<AssertionIDRequestService*>::const_iterator j=src.m_AssertionIDRequestServices.begin(); j!=src.m_AssertionIDRequestServices.end(); j++) {
1585                     if (*j) {
1586                         getAssertionIDRequestServices().push_back((*j)->cloneAssertionIDRequestService());
1587                     }
1588                 }
1589                 for (vector<NameIDFormat*>::const_iterator k=src.m_NameIDFormats.begin(); k!=src.m_NameIDFormats.end(); k++) {
1590                     if (*k) {
1591                         getNameIDFormats().push_back((*k)->cloneNameIDFormat());
1592                     }
1593                 }
1594             }
1595
1596             IMPL_XMLOBJECT_CLONE_EX(AuthnAuthorityDescriptor);
1597             IMPL_TYPED_CHILDREN(AuthnQueryService,m_pos_AuthnQueryService);
1598             IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
1599             IMPL_TYPED_CHILDREN(NameIDFormat,m_children.end());
1600
1601         protected:
1602             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1603                 PROC_TYPED_CHILDREN(AuthnQueryService,SAML20MD_NS,false);
1604                 PROC_TYPED_CHILDREN(AssertionIDRequestService,SAML20MD_NS,false);
1605                 PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
1606                 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1607             }
1608         };
1609
1610         class SAML_DLLLOCAL PDPDescriptorImpl : public virtual PDPDescriptor, public RoleDescriptorImpl
1611         {
1612             list<XMLObject*>::iterator m_pos_AuthzService;
1613             list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
1614
1615             void init() {
1616                 m_children.push_back(nullptr);
1617                 m_children.push_back(nullptr);
1618                 m_pos_AuthzService=m_pos_ContactPerson;
1619                 ++m_pos_AuthzService;
1620                 m_pos_AssertionIDRequestService=m_pos_AuthzService;
1621                 ++m_pos_AssertionIDRequestService;
1622             }
1623
1624         public:
1625             virtual ~PDPDescriptorImpl() {}
1626
1627             PDPDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1628                     : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1629                 init();
1630             }
1631
1632             PDPDescriptorImpl(const PDPDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1633                 init();
1634             }
1635
1636             void _clone(const PDPDescriptorImpl& src) {
1637                 RoleDescriptorImpl::_clone(src);
1638                 for (vector<AuthzService*>::const_iterator i=src.m_AuthzServices.begin(); i!=src.m_AuthzServices.end(); i++) {
1639                     if (*i) {
1640                         getAuthzServices().push_back((*i)->cloneAuthzService());
1641                     }
1642                 }
1643                 for (vector<AssertionIDRequestService*>::const_iterator j=src.m_AssertionIDRequestServices.begin(); j!=src.m_AssertionIDRequestServices.end(); j++) {
1644                     if (*j) {
1645                         getAssertionIDRequestServices().push_back((*j)->cloneAssertionIDRequestService());
1646                     }
1647                 }
1648                 for (vector<NameIDFormat*>::const_iterator k=src.m_NameIDFormats.begin(); k!=src.m_NameIDFormats.end(); k++) {
1649                     if (*k) {
1650                         getNameIDFormats().push_back((*k)->cloneNameIDFormat());
1651                     }
1652                 }
1653             }
1654
1655             IMPL_XMLOBJECT_CLONE_EX(PDPDescriptor);
1656             IMPL_TYPED_CHILDREN(AuthzService,m_pos_AuthzService);
1657             IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
1658             IMPL_TYPED_CHILDREN(NameIDFormat,m_children.end());
1659
1660         protected:
1661             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1662                 PROC_TYPED_CHILDREN(AuthzService,SAML20MD_NS,false);
1663                 PROC_TYPED_CHILDREN(AssertionIDRequestService,SAML20MD_NS,false);
1664                 PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
1665                 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1666             }
1667         };
1668
1669         class SAML_DLLLOCAL AttributeAuthorityDescriptorImpl : public virtual AttributeAuthorityDescriptor, public RoleDescriptorImpl
1670         {
1671             list<XMLObject*>::iterator m_pos_AttributeService;
1672             list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
1673             list<XMLObject*>::iterator m_pos_NameIDFormat;
1674             list<XMLObject*>::iterator m_pos_AttributeProfile;
1675
1676             void init() {
1677                 m_children.push_back(nullptr);
1678                 m_children.push_back(nullptr);
1679                 m_children.push_back(nullptr);
1680                 m_children.push_back(nullptr);
1681                 m_pos_AttributeService=m_pos_ContactPerson;
1682                 ++m_pos_AttributeService;
1683                 m_pos_AssertionIDRequestService=m_pos_AttributeService;
1684                 ++m_pos_AssertionIDRequestService;
1685                 m_pos_NameIDFormat=m_pos_AssertionIDRequestService;
1686                 ++m_pos_NameIDFormat;
1687                 m_pos_AttributeProfile=m_pos_NameIDFormat;
1688                 ++m_pos_AttributeProfile;
1689             }
1690
1691         public:
1692             virtual ~AttributeAuthorityDescriptorImpl() {}
1693
1694             AttributeAuthorityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1695                     : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1696                 init();
1697             }
1698
1699             AttributeAuthorityDescriptorImpl(const AttributeAuthorityDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1700                 init();
1701             }
1702
1703             void _clone(const AttributeAuthorityDescriptorImpl& src) {
1704                 RoleDescriptorImpl::_clone(src);
1705                 for (vector<AttributeService*>::const_iterator i=src.m_AttributeServices.begin(); i!=src.m_AttributeServices.end(); i++) {
1706                     if (*i) {
1707                         getAttributeServices().push_back((*i)->cloneAttributeService());
1708                     }
1709                 }
1710                 for (vector<AssertionIDRequestService*>::const_iterator j=src.m_AssertionIDRequestServices.begin(); j!=src.m_AssertionIDRequestServices.end(); j++) {
1711                     if (*j) {
1712                         getAssertionIDRequestServices().push_back((*j)->cloneAssertionIDRequestService());
1713                     }
1714                 }
1715                 for (vector<NameIDFormat*>::const_iterator k=src.m_NameIDFormats.begin(); k!=src.m_NameIDFormats.end(); k++) {
1716                     if (*k) {
1717                         getNameIDFormats().push_back((*k)->cloneNameIDFormat());
1718                     }
1719                 }
1720                 for (vector<AttributeProfile*>::const_iterator m=src.m_AttributeProfiles.begin(); m!=src.m_AttributeProfiles.end(); m++) {
1721                     if (*m) {
1722                         getAttributeProfiles().push_back((*m)->cloneAttributeProfile());
1723                     }
1724                 }
1725                 for (vector<Attribute*>::const_iterator n=src.m_Attributes.begin(); n!=src.m_Attributes.end(); n++) {
1726                     if (*n) {
1727                         getAttributes().push_back((*n)->cloneAttribute());
1728                     }
1729                 }
1730             }
1731
1732             IMPL_XMLOBJECT_CLONE_EX(AttributeAuthorityDescriptor);
1733             IMPL_TYPED_CHILDREN(AttributeService,m_pos_AttributeService);
1734             IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
1735             IMPL_TYPED_CHILDREN(NameIDFormat,m_pos_NameIDFormat);
1736             IMPL_TYPED_CHILDREN(AttributeProfile,m_pos_AttributeProfile);
1737             IMPL_TYPED_FOREIGN_CHILDREN(Attribute,saml2,m_children.end());
1738
1739         protected:
1740             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1741                 PROC_TYPED_CHILDREN(AttributeService,SAML20MD_NS,false);
1742                 PROC_TYPED_CHILDREN(AssertionIDRequestService,SAML20MD_NS,false);
1743                 PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
1744                 PROC_TYPED_CHILDREN(AttributeProfile,SAML20MD_NS,false);
1745                 PROC_TYPED_FOREIGN_CHILDREN(Attribute,saml2,SAML20_NS,false);
1746                 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1747             }
1748         };
1749
1750         class SAML_DLLLOCAL QueryDescriptorTypeImpl : public virtual QueryDescriptorType, public RoleDescriptorImpl
1751         {
1752             void init() {
1753                 m_WantAssertionsSigned=XML_BOOL_NULL;
1754                 m_children.push_back(nullptr);
1755                 m_pos_NameIDFormat=m_pos_ContactPerson;
1756                 ++m_pos_NameIDFormat;
1757             }
1758
1759         protected:
1760             list<XMLObject*>::iterator m_pos_NameIDFormat;
1761
1762             QueryDescriptorTypeImpl() {
1763                 init();
1764             }
1765
1766         public:
1767             virtual ~QueryDescriptorTypeImpl() {}
1768
1769             QueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1770                     : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1771                 init();
1772             }
1773
1774             QueryDescriptorTypeImpl(const QueryDescriptorTypeImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1775                 init();
1776             }
1777
1778             void _clone(const QueryDescriptorTypeImpl& src) {
1779                 RoleDescriptorImpl::_clone(src);
1780                 WantAssertionsSigned(src.m_WantAssertionsSigned);
1781                 for (vector<NameIDFormat*>::const_iterator m=src.m_NameIDFormats.begin(); m!=src.m_NameIDFormats.end(); m++) {
1782                     if (*m) {
1783                         getNameIDFormats().push_back((*m)->cloneNameIDFormat());
1784                     }
1785                 }
1786             }
1787
1788             QueryDescriptorType* cloneQueryDescriptorType() const {
1789                 return dynamic_cast<QueryDescriptorType*>(clone());
1790             }
1791
1792             IMPL_BOOLEAN_ATTRIB(WantAssertionsSigned);
1793             IMPL_TYPED_CHILDREN(NameIDFormat,m_pos_NameIDFormat);
1794
1795             void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
1796                 if (!qualifiedName.hasNamespaceURI()) {
1797                     if (XMLString::equals(qualifiedName.getLocalPart(),WANTASSERTIONSSIGNED_ATTRIB_NAME)) {
1798                         setWantAssertionsSigned(value);
1799                         return;
1800                     }
1801                 }
1802                 RoleDescriptorImpl::setAttribute(qualifiedName, value, ID);
1803             }
1804
1805         protected:
1806             void marshallAttributes(DOMElement* domElement) const {
1807                 MARSHALL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,nullptr);
1808                 RoleDescriptorImpl::marshallAttributes(domElement);
1809             }
1810
1811             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1812                 PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
1813                 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1814             }
1815         };
1816
1817         class SAML_DLLLOCAL AuthnQueryDescriptorTypeImpl : public virtual AuthnQueryDescriptorType, public QueryDescriptorTypeImpl
1818         {
1819         public:
1820             virtual ~AuthnQueryDescriptorTypeImpl() {}
1821
1822             AuthnQueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1823                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
1824
1825             AuthnQueryDescriptorTypeImpl(const AuthnQueryDescriptorTypeImpl& src) : AbstractXMLObject(src), QueryDescriptorTypeImpl(src) {}
1826
1827             IMPL_XMLOBJECT_CLONE_EX(AuthnQueryDescriptorType);
1828         };
1829
1830         class SAML_DLLLOCAL AttributeQueryDescriptorTypeImpl : public virtual AttributeQueryDescriptorType, public QueryDescriptorTypeImpl
1831         {
1832         public:
1833             virtual ~AttributeQueryDescriptorTypeImpl() {}
1834
1835             AttributeQueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1836                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
1837
1838             AttributeQueryDescriptorTypeImpl(const AttributeQueryDescriptorTypeImpl& src) : AbstractXMLObject(src), QueryDescriptorTypeImpl(src) {
1839             }
1840
1841             void _clone(const AttributeQueryDescriptorTypeImpl& src) {
1842                 QueryDescriptorTypeImpl::_clone(src);
1843                 for (vector<AttributeConsumingService*>::const_iterator j=src.m_AttributeConsumingServices.begin(); j!=src.m_AttributeConsumingServices.end(); j++) {
1844                     if (*j) {
1845                         getAttributeConsumingServices().push_back((*j)->cloneAttributeConsumingService());
1846                     }
1847                 }
1848             }
1849
1850             IMPL_XMLOBJECT_CLONE_EX(AttributeQueryDescriptorType);
1851             IMPL_TYPED_CHILDREN(AttributeConsumingService,m_children.end());
1852
1853         protected:
1854             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1855                 PROC_TYPED_CHILDREN(AttributeConsumingService,SAML20MD_NS,false);
1856                 QueryDescriptorTypeImpl::processChildElement(childXMLObject,root);
1857             }
1858         };
1859
1860         class SAML_DLLLOCAL AuthzDecisionQueryDescriptorTypeImpl : public virtual AuthzDecisionQueryDescriptorType, public QueryDescriptorTypeImpl
1861         {
1862         public:
1863             virtual ~AuthzDecisionQueryDescriptorTypeImpl() {}
1864
1865             AuthzDecisionQueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1866                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
1867
1868             AuthzDecisionQueryDescriptorTypeImpl(const AuthzDecisionQueryDescriptorTypeImpl& src) : AbstractXMLObject(src), QueryDescriptorTypeImpl(src) {
1869             }
1870
1871             void _clone(const AuthzDecisionQueryDescriptorTypeImpl& src) {
1872                 QueryDescriptorTypeImpl::_clone(src);
1873                 for (vector<ActionNamespace*>::const_iterator j=src.m_ActionNamespaces.begin(); j!=src.m_ActionNamespaces.end(); j++) {
1874                     if (*j) {
1875                         getActionNamespaces().push_back((*j)->cloneActionNamespace());
1876                     }
1877                 }
1878             }
1879
1880             IMPL_XMLOBJECT_CLONE_EX(AuthzDecisionQueryDescriptorType);
1881             IMPL_TYPED_CHILDREN(ActionNamespace,m_children.end());
1882
1883         protected:
1884             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1885                 PROC_TYPED_CHILDREN(ActionNamespace,samlconstants::SAML20MD_QUERY_EXT_NS,false);
1886                 QueryDescriptorTypeImpl::processChildElement(childXMLObject,root);
1887             }
1888         };
1889
1890         class SAML_DLLLOCAL AffiliationDescriptorImpl : public virtual AffiliationDescriptor,
1891             public virtual SignableObject,
1892             public AbstractComplexElement,
1893             public AbstractAttributeExtensibleXMLObject,
1894             public AbstractDOMCachingXMLObject,
1895             public AbstractXMLObjectMarshaller,
1896             public AbstractXMLObjectUnmarshaller
1897         {
1898             list<XMLObject*>::iterator m_pos_AffiliateMember;
1899
1900             void init() {
1901                 m_ID=m_AffiliationOwnerID=nullptr;
1902                 m_ValidUntil=m_CacheDuration=nullptr;
1903                 m_children.push_back(nullptr);
1904                 m_children.push_back(nullptr);
1905                 m_children.push_back(nullptr);
1906                 m_Signature=nullptr;
1907                 m_Extensions=nullptr;
1908                 m_pos_Signature=m_children.begin();
1909                 m_pos_Extensions=m_pos_Signature;
1910                 ++m_pos_Extensions;
1911                 m_pos_AffiliateMember=m_pos_Extensions;
1912                 ++m_pos_AffiliateMember;
1913             }
1914
1915         public:
1916             virtual ~AffiliationDescriptorImpl() {
1917                 XMLString::release(&m_ID);
1918                 XMLString::release(&m_AffiliationOwnerID);
1919                 delete m_ValidUntil;
1920                 delete m_CacheDuration;
1921             }
1922
1923             AffiliationDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1924                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1925                 init();
1926             }
1927
1928             AffiliationDescriptorImpl(const AffiliationDescriptorImpl& src)
1929                     : AbstractXMLObject(src), AbstractComplexElement(src),
1930                         AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
1931                 init();
1932                 setID(src.getID());
1933                 setAffiliationOwnerID(src.getAffiliationOwnerID());
1934                 setValidUntil(src.getValidUntil());
1935                 setCacheDuration(src.getCacheDuration());
1936                 if (src.getSignature())
1937                     setSignature(src.getSignature()->cloneSignature());
1938                 if (src.getExtensions())
1939                     setExtensions(src.getExtensions()->cloneExtensions());
1940
1941                 for (vector<KeyDescriptor*>::const_iterator i=src.m_KeyDescriptors.begin(); i!=src.m_KeyDescriptors.end(); i++) {
1942                     if (*i) {
1943                         getKeyDescriptors().push_back((*i)->cloneKeyDescriptor());
1944                     }
1945                 }
1946                 for (vector<AffiliateMember*>::const_iterator j=src.m_AffiliateMembers.begin(); j!=src.m_AffiliateMembers.end(); j++) {
1947                     if (*j) {
1948                         getAffiliateMembers().push_back((*j)->cloneAffiliateMember());
1949                     }
1950                 }
1951             }
1952
1953             IMPL_XMLOBJECT_CLONE(AffiliationDescriptor);
1954
1955             //IMPL_TYPED_CHILD(Signature);
1956             // Need customized setter.
1957         protected:
1958             Signature* m_Signature;
1959             list<XMLObject*>::iterator m_pos_Signature;
1960         public:
1961             Signature* getSignature() const {
1962                 return m_Signature;
1963             }
1964
1965             void setSignature(Signature* sig) {
1966                 prepareForAssignment(m_Signature,sig);
1967                 *m_pos_Signature=m_Signature=sig;
1968                 // Sync content reference back up.
1969                 if (m_Signature)
1970                     m_Signature->setContentReference(new opensaml::ContentReference(*this));
1971             }
1972
1973             IMPL_ID_ATTRIB_EX(ID,ID,nullptr);
1974             IMPL_STRING_ATTRIB(AffiliationOwnerID);
1975             IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
1976             IMPL_DURATION_ATTRIB(CacheDuration,0);
1977             IMPL_TYPED_CHILD(Extensions);
1978             IMPL_TYPED_CHILDREN(AffiliateMember,m_pos_AffiliateMember);
1979             IMPL_TYPED_CHILDREN(KeyDescriptor,m_children.end());
1980
1981             void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
1982                 if (!qualifiedName.hasNamespaceURI()) {
1983                     if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) {
1984                         setID(value);
1985                         return;
1986                     }
1987                     else if (XMLString::equals(qualifiedName.getLocalPart(),AFFILIATIONOWNERID_ATTRIB_NAME)) {
1988                         setAffiliationOwnerID(value);
1989                         return;
1990                     }
1991                     else if (XMLString::equals(qualifiedName.getLocalPart(),VALIDUNTIL_ATTRIB_NAME)) {
1992                         setValidUntil(value);
1993                         return;
1994                     }
1995                     else if (XMLString::equals(qualifiedName.getLocalPart(),CACHEDURATION_ATTRIB_NAME)) {
1996                         setCacheDuration(value);
1997                         return;
1998                     }
1999                 }
2000                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
2001             }
2002
2003         protected:
2004             void prepareForMarshalling() const {
2005                 if (m_Signature)
2006                     declareNonVisibleNamespaces();
2007             }
2008
2009             void marshallAttributes(DOMElement* domElement) const {
2010                 MARSHALL_ID_ATTRIB(ID,ID,nullptr);
2011                 MARSHALL_STRING_ATTRIB(AffiliationOwnerID,AFFILIATIONOWNERID,nullptr);
2012                 MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,nullptr);
2013                 MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,nullptr);
2014                 marshallExtensionAttributes(domElement);
2015             }
2016
2017             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
2018                 PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLSIG_NS,false);
2019                 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
2020                 PROC_TYPED_CHILDREN(AffiliateMember,SAML20MD_NS,false);
2021                 PROC_TYPED_CHILDREN(KeyDescriptor,SAML20MD_NS,false);
2022                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
2023             }
2024
2025             void processAttribute(const DOMAttr* attribute) {
2026                 PROC_ID_ATTRIB(ID,ID,nullptr);
2027                 unmarshallExtensionAttribute(attribute);
2028             }
2029         };
2030
2031         class SAML_DLLLOCAL EntityDescriptorImpl : public virtual EntityDescriptor,
2032             public virtual SignableObject,
2033             public AbstractComplexElement,
2034             public AbstractAttributeExtensibleXMLObject,
2035             public AbstractDOMCachingXMLObject,
2036             public AbstractXMLObjectMarshaller,
2037             public AbstractXMLObjectUnmarshaller
2038         {
2039             list<XMLObject*>::iterator m_pos_ContactPerson;
2040
2041             void init() {
2042                 m_ID=m_EntityID=nullptr;
2043                 m_ValidUntil=m_CacheDuration=nullptr;
2044                 m_children.push_back(nullptr);
2045                 m_children.push_back(nullptr);
2046                 m_children.push_back(nullptr);
2047                 m_children.push_back(nullptr);
2048                 m_children.push_back(nullptr);
2049                 m_Signature=nullptr;
2050                 m_Extensions=nullptr;
2051                 m_AffiliationDescriptor=nullptr;
2052                 m_Organization=nullptr;
2053                 m_pos_Signature=m_children.begin();
2054                 m_pos_Extensions=m_pos_Signature;
2055                 ++m_pos_Extensions;
2056                 m_pos_AffiliationDescriptor=m_pos_Extensions;
2057                 ++m_pos_AffiliationDescriptor;
2058                 m_pos_Organization=m_pos_AffiliationDescriptor;
2059                 ++m_pos_Organization;
2060                 m_pos_ContactPerson=m_pos_Organization;
2061                 ++m_pos_ContactPerson;
2062             }
2063
2064         public:
2065             virtual ~EntityDescriptorImpl() {
2066                 XMLString::release(&m_ID);
2067                 XMLString::release(&m_EntityID);
2068                 delete m_ValidUntil;
2069                 delete m_CacheDuration;
2070             }
2071
2072             EntityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
2073                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
2074                 init();
2075             }
2076
2077             EntityDescriptorImpl(const EntityDescriptorImpl& src)
2078                     : AbstractXMLObject(src), AbstractComplexElement(src),
2079                         AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
2080                 init();
2081                 setID(src.getID());
2082                 setEntityID(src.getEntityID());
2083                 setValidUntil(src.getValidUntil());
2084                 setCacheDuration(src.getCacheDuration());
2085                 if (src.getSignature())
2086                     setSignature(src.getSignature()->cloneSignature());
2087                 if (src.getExtensions())
2088                     setExtensions(src.getExtensions()->cloneExtensions());
2089                 if (src.getAffiliationDescriptor())
2090                     setAffiliationDescriptor(src.getAffiliationDescriptor()->cloneAffiliationDescriptor());
2091                 if (src.getOrganization())
2092                     setOrganization(src.getOrganization()->cloneOrganization());
2093
2094                 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
2095                     if (*i) {
2096                         IDPSSODescriptor* idp=dynamic_cast<IDPSSODescriptor*>(*i);
2097                         if (idp) {
2098                             getIDPSSODescriptors().push_back(idp->cloneIDPSSODescriptor());
2099                             continue;
2100                         }
2101
2102                         SPSSODescriptor* sp=dynamic_cast<SPSSODescriptor*>(*i);
2103                         if (sp) {
2104                             getSPSSODescriptors().push_back(sp->cloneSPSSODescriptor());
2105                             continue;
2106                         }
2107
2108                         AuthnAuthorityDescriptor* authn=dynamic_cast<AuthnAuthorityDescriptor*>(*i);
2109                         if (authn) {
2110                             getAuthnAuthorityDescriptors().push_back(authn->cloneAuthnAuthorityDescriptor());
2111                             continue;
2112                         }
2113
2114                         AttributeAuthorityDescriptor* attr=dynamic_cast<AttributeAuthorityDescriptor*>(*i);
2115                         if (attr) {
2116                             getAttributeAuthorityDescriptors().push_back(attr->cloneAttributeAuthorityDescriptor());
2117                             continue;
2118                         }
2119
2120                         PDPDescriptor* pdp=dynamic_cast<PDPDescriptor*>(*i);
2121                         if (pdp) {
2122                             getPDPDescriptors().push_back(pdp->clonePDPDescriptor());
2123                             continue;
2124                         }
2125
2126                         AuthnQueryDescriptorType* authnq=dynamic_cast<AuthnQueryDescriptorType*>(*i);
2127                         if (authnq) {
2128                             getAuthnQueryDescriptorTypes().push_back(authnq->cloneAuthnQueryDescriptorType());
2129                             continue;
2130                         }
2131
2132                         AttributeQueryDescriptorType* attrq=dynamic_cast<AttributeQueryDescriptorType*>(*i);
2133                         if (attrq) {
2134                             getAttributeQueryDescriptorTypes().push_back(attrq->cloneAttributeQueryDescriptorType());
2135                             continue;
2136                         }
2137
2138                         AuthzDecisionQueryDescriptorType* authzq=dynamic_cast<AuthzDecisionQueryDescriptorType*>(*i);
2139                         if (authzq) {
2140                             getAuthzDecisionQueryDescriptorTypes().push_back(authzq->cloneAuthzDecisionQueryDescriptorType());
2141                             continue;
2142                         }
2143
2144                         RoleDescriptor* role=dynamic_cast<RoleDescriptor*>(*i);
2145                         if (role) {
2146                             getRoleDescriptors().push_back(role->cloneRoleDescriptor());
2147                             continue;
2148                         }
2149                     }
2150                 }
2151
2152                 for (vector<ContactPerson*>::const_iterator j=src.m_ContactPersons.begin(); j!=src.m_ContactPersons.end(); j++) {
2153                     if (*j) {
2154                         getContactPersons().push_back((*j)->cloneContactPerson());
2155                     }
2156                 }
2157                 for (vector<AdditionalMetadataLocation*>::const_iterator k=src.m_AdditionalMetadataLocations.begin(); k!=src.m_AdditionalMetadataLocations.end(); k++) {
2158                     if (*k) {
2159                         getAdditionalMetadataLocations().push_back((*k)->cloneAdditionalMetadataLocation());
2160                     }
2161                 }
2162             }
2163
2164             IMPL_XMLOBJECT_CLONE(EntityDescriptor);
2165
2166             //IMPL_TYPED_CHILD(Signature);
2167             // Need customized setter.
2168         protected:
2169             Signature* m_Signature;
2170             list<XMLObject*>::iterator m_pos_Signature;
2171         public:
2172             Signature* getSignature() const {
2173                 return m_Signature;
2174             }
2175
2176             void setSignature(Signature* sig) {
2177                 prepareForAssignment(m_Signature,sig);
2178                 *m_pos_Signature=m_Signature=sig;
2179                 // Sync content reference back up.
2180                 if (m_Signature)
2181                     m_Signature->setContentReference(new opensaml::ContentReference(*this));
2182             }
2183
2184             IMPL_ID_ATTRIB_EX(ID,ID,nullptr);
2185             IMPL_STRING_ATTRIB(EntityID);
2186             IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
2187             IMPL_DURATION_ATTRIB(CacheDuration,0);
2188             IMPL_TYPED_CHILD(Extensions);
2189             IMPL_TYPED_CHILDREN(RoleDescriptor,m_pos_AffiliationDescriptor);
2190             IMPL_TYPED_CHILDREN(IDPSSODescriptor,m_pos_AffiliationDescriptor);
2191             IMPL_TYPED_CHILDREN(SPSSODescriptor,m_pos_AffiliationDescriptor);
2192             IMPL_TYPED_CHILDREN(AuthnAuthorityDescriptor,m_pos_AffiliationDescriptor);
2193             IMPL_TYPED_CHILDREN(AttributeAuthorityDescriptor,m_pos_AffiliationDescriptor);
2194             IMPL_TYPED_CHILDREN(PDPDescriptor,m_pos_AffiliationDescriptor);
2195             IMPL_TYPED_CHILDREN(AuthnQueryDescriptorType,m_pos_AffiliationDescriptor);
2196             IMPL_TYPED_CHILDREN(AttributeQueryDescriptorType,m_pos_AffiliationDescriptor);
2197             IMPL_TYPED_CHILDREN(AuthzDecisionQueryDescriptorType,m_pos_AffiliationDescriptor);
2198             IMPL_TYPED_CHILD(AffiliationDescriptor);
2199             IMPL_TYPED_CHILD(Organization);
2200             IMPL_TYPED_CHILDREN(ContactPerson,m_pos_ContactPerson);
2201             IMPL_TYPED_CHILDREN(AdditionalMetadataLocation,m_children.end());
2202
2203             void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
2204                 if (!qualifiedName.hasNamespaceURI()) {
2205                     if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) {
2206                         setID(value);
2207                         return;
2208                     }
2209                     else if (XMLString::equals(qualifiedName.getLocalPart(),ENTITYID_ATTRIB_NAME)) {
2210                         setEntityID(value);
2211                         return;
2212                     }
2213                     else if (XMLString::equals(qualifiedName.getLocalPart(),VALIDUNTIL_ATTRIB_NAME)) {
2214                         setValidUntil(value);
2215                         return;
2216                     }
2217                     else if (XMLString::equals(qualifiedName.getLocalPart(),CACHEDURATION_ATTRIB_NAME)) {
2218                         setCacheDuration(value);
2219                         return;
2220                     }
2221                 }
2222                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
2223             }
2224
2225             const RoleDescriptor* getRoleDescriptor(const xmltooling::QName& qname, const XMLCh* protocol) const {
2226                 // Check for "known" elements/types.
2227                 if (qname == IDPSSODescriptor::ELEMENT_QNAME)
2228                     return find_if(m_IDPSSODescriptors, isValidForProtocol(protocol));
2229                 if (qname == SPSSODescriptor::ELEMENT_QNAME)
2230                     return find_if(m_SPSSODescriptors, isValidForProtocol(protocol));
2231                 if (qname == AuthnAuthorityDescriptor::ELEMENT_QNAME)
2232                     return find_if(m_AuthnAuthorityDescriptors, isValidForProtocol(protocol));
2233                 if (qname == AttributeAuthorityDescriptor::ELEMENT_QNAME)
2234                     return find_if(m_AttributeAuthorityDescriptors, isValidForProtocol(protocol));
2235                 if (qname == PDPDescriptor::ELEMENT_QNAME)
2236                     return find_if(m_PDPDescriptors, isValidForProtocol(protocol));
2237                 if (qname == AuthnQueryDescriptorType::TYPE_QNAME)
2238                     return find_if(m_AuthnQueryDescriptorTypes, isValidForProtocol(protocol));
2239                 if (qname == AttributeQueryDescriptorType::TYPE_QNAME)
2240                     return find_if(m_AttributeQueryDescriptorTypes, isValidForProtocol(protocol));
2241                 if (qname == AuthzDecisionQueryDescriptorType::TYPE_QNAME)
2242                     return find_if(m_AuthzDecisionQueryDescriptorTypes, isValidForProtocol(protocol));
2243
2244                 vector<RoleDescriptor*>::const_iterator i =
2245                     find_if(m_RoleDescriptors.begin(), m_RoleDescriptors.end(), ofTypeValidForProtocol(qname,protocol));
2246                 return (i!=m_RoleDescriptors.end()) ? *i : nullptr;
2247             }
2248
2249         protected:
2250             void prepareForMarshalling() const {
2251                 if (m_Signature)
2252                     declareNonVisibleNamespaces();
2253             }
2254
2255             void marshallAttributes(DOMElement* domElement) const {
2256                 MARSHALL_ID_ATTRIB(ID,ID,nullptr);
2257                 MARSHALL_STRING_ATTRIB(EntityID,ENTITYID,nullptr);
2258                 MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,nullptr);
2259                 MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,nullptr);
2260                 marshallExtensionAttributes(domElement);
2261             }
2262
2263             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
2264                 PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLSIG_NS,false);
2265                 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
2266                 PROC_TYPED_CHILDREN(IDPSSODescriptor,SAML20MD_NS,false);
2267                 PROC_TYPED_CHILDREN(SPSSODescriptor,SAML20MD_NS,false);
2268                 PROC_TYPED_CHILDREN(AuthnAuthorityDescriptor,SAML20MD_NS,false);
2269                 PROC_TYPED_CHILDREN(AttributeAuthorityDescriptor,SAML20MD_NS,false);
2270                 PROC_TYPED_CHILDREN(PDPDescriptor,SAML20MD_NS,false);
2271                 PROC_TYPED_CHILDREN(AuthnQueryDescriptorType,samlconstants::SAML20MD_QUERY_EXT_NS,false);
2272                 PROC_TYPED_CHILDREN(AttributeQueryDescriptorType,samlconstants::SAML20MD_QUERY_EXT_NS,false);
2273                 PROC_TYPED_CHILDREN(AuthzDecisionQueryDescriptorType,samlconstants::SAML20MD_QUERY_EXT_NS,false);
2274                 PROC_TYPED_CHILDREN(RoleDescriptor,SAML20MD_NS,false);
2275                 PROC_TYPED_CHILD(AffiliationDescriptor,SAML20MD_NS,false);
2276                 PROC_TYPED_CHILD(Organization,SAML20MD_NS,false);
2277                 PROC_TYPED_CHILDREN(ContactPerson,SAML20MD_NS,false);
2278                 PROC_TYPED_CHILDREN(AdditionalMetadataLocation,SAML20MD_NS,false);
2279                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
2280             }
2281
2282             void processAttribute(const DOMAttr* attribute) {
2283                 PROC_ID_ATTRIB(ID,ID,nullptr);
2284                 unmarshallExtensionAttribute(attribute);
2285             }
2286         };
2287
2288         class SAML_DLLLOCAL EntitiesDescriptorImpl : public virtual EntitiesDescriptor,
2289             public virtual SignableObject,
2290             public AbstractComplexElement,
2291             public AbstractDOMCachingXMLObject,
2292             public AbstractXMLObjectMarshaller,
2293             public AbstractXMLObjectUnmarshaller
2294         {
2295             void init() {
2296                 m_ID=m_Name=nullptr;
2297                 m_ValidUntil=m_CacheDuration=nullptr;
2298                 m_children.push_back(nullptr);
2299                 m_children.push_back(nullptr);
2300                 m_Signature=nullptr;
2301                 m_Extensions=nullptr;
2302                 m_pos_Signature=m_children.begin();
2303                 m_pos_Extensions=m_pos_Signature;
2304                 ++m_pos_Extensions;
2305             }
2306
2307         public:
2308             virtual ~EntitiesDescriptorImpl() {
2309                 XMLString::release(&m_ID);
2310                 XMLString::release(&m_Name);
2311                 delete m_ValidUntil;
2312                 delete m_CacheDuration;
2313             }
2314
2315             EntitiesDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
2316                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
2317                 init();
2318             }
2319
2320             EntitiesDescriptorImpl(const EntitiesDescriptorImpl& src)
2321                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
2322                 init();
2323                 setID(src.getID());
2324                 setName(src.getName());
2325                 setValidUntil(src.getValidUntil());
2326                 setCacheDuration(src.getCacheDuration());
2327                 if (src.getSignature())
2328                     setSignature(src.getSignature()->cloneSignature());
2329                 if (src.getExtensions())
2330                     setExtensions(src.getExtensions()->cloneExtensions());
2331
2332                 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
2333                     if (*i) {
2334                         EntityDescriptor* e=dynamic_cast<EntityDescriptor*>(*i);
2335                         if (e) {
2336                             getEntityDescriptors().push_back(e->cloneEntityDescriptor());
2337                             continue;
2338                         }
2339
2340                         EntitiesDescriptor* es=dynamic_cast<EntitiesDescriptor*>(*i);
2341                         if (es) {
2342                             getEntitiesDescriptors().push_back(es->cloneEntitiesDescriptor());
2343                             continue;
2344                         }
2345                     }
2346                 }
2347             }
2348
2349             IMPL_XMLOBJECT_CLONE(EntitiesDescriptor);
2350
2351             //IMPL_TYPED_CHILD(Signature);
2352             // Need customized setter.
2353         protected:
2354             Signature* m_Signature;
2355             list<XMLObject*>::iterator m_pos_Signature;
2356         public:
2357             Signature* getSignature() const {
2358                 return m_Signature;
2359             }
2360
2361             void setSignature(Signature* sig) {
2362                 prepareForAssignment(m_Signature,sig);
2363                 *m_pos_Signature=m_Signature=sig;
2364                 // Sync content reference back up.
2365                 if (m_Signature)
2366                     m_Signature->setContentReference(new opensaml::ContentReference(*this));
2367             }
2368
2369             IMPL_ID_ATTRIB_EX(ID,ID,nullptr);
2370             IMPL_STRING_ATTRIB(Name);
2371             IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
2372             IMPL_DURATION_ATTRIB(CacheDuration,0);
2373             IMPL_TYPED_CHILD(Extensions);
2374             IMPL_TYPED_CHILDREN(EntityDescriptor,m_children.end());
2375             IMPL_TYPED_CHILDREN(EntitiesDescriptor,m_children.end());
2376
2377         protected:
2378             void prepareForMarshalling() const {
2379                 if (m_Signature)
2380                     declareNonVisibleNamespaces();
2381             }
2382
2383             void marshallAttributes(DOMElement* domElement) const {
2384                 MARSHALL_ID_ATTRIB(ID,ID,nullptr);
2385                 MARSHALL_STRING_ATTRIB(Name,NAME,nullptr);
2386                 MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,nullptr);
2387                 MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,nullptr);
2388             }
2389
2390             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
2391                 PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLSIG_NS,false);
2392                 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
2393                 PROC_TYPED_CHILDREN(EntityDescriptor,SAML20MD_NS,false);
2394                 PROC_TYPED_CHILDREN(EntitiesDescriptor,SAML20MD_NS,false);
2395                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
2396             }
2397
2398             void processAttribute(const DOMAttr* attribute) {
2399                 PROC_ID_ATTRIB(ID,ID,nullptr);
2400                 PROC_STRING_ATTRIB(Name,NAME,nullptr);
2401                 PROC_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,nullptr);
2402                 PROC_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,nullptr);
2403             }
2404         };
2405
2406         class SAML_DLLLOCAL DiscoveryResponseImpl : public virtual DiscoveryResponse, public IndexedEndpointTypeImpl
2407         {
2408         public:
2409             virtual ~DiscoveryResponseImpl() {}
2410
2411             DiscoveryResponseImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
2412                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
2413
2414             DiscoveryResponseImpl(const DiscoveryResponseImpl& src) : AbstractXMLObject(src), IndexedEndpointTypeImpl(src) {}
2415
2416             IMPL_XMLOBJECT_CLONE_EX(DiscoveryResponse);
2417         };
2418
2419         class SAML_DLLLOCAL RequestInitiatorImpl : public virtual RequestInitiator, public EndpointTypeImpl
2420         {
2421         public:
2422             virtual ~RequestInitiatorImpl() {}
2423
2424             RequestInitiatorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
2425                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
2426
2427             RequestInitiatorImpl(const RequestInitiatorImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
2428
2429             IMPL_XMLOBJECT_CLONE_EX(RequestInitiator);
2430         };
2431
2432         class SAML_DLLLOCAL EntityAttributesImpl : public virtual EntityAttributes,
2433             public AbstractComplexElement,
2434             public AbstractDOMCachingXMLObject,
2435             public AbstractXMLObjectMarshaller,
2436             public AbstractXMLObjectUnmarshaller
2437         {
2438         public:
2439             virtual ~EntityAttributesImpl() {}
2440
2441             EntityAttributesImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
2442                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
2443             }
2444
2445             EntityAttributesImpl(const EntityAttributesImpl& src)
2446                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
2447                 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
2448                     if (*i) {
2449                         Attribute* a=dynamic_cast<Attribute*>(*i);
2450                         if (a) {
2451                             getAttributes().push_back(a->cloneAttribute());
2452                             continue;
2453                         }
2454
2455                         saml2::Assertion* as=dynamic_cast<saml2::Assertion*>(*i);
2456                         if (as) {
2457                             getAssertions().push_back(as->cloneAssertion());
2458                             continue;
2459                         }
2460                     }
2461                 }
2462             }
2463
2464             IMPL_XMLOBJECT_CLONE(EntityAttributes);
2465             IMPL_TYPED_FOREIGN_CHILDREN(Attribute,saml2,m_children.end());
2466             IMPL_TYPED_FOREIGN_CHILDREN(Assertion,saml2,m_children.end());
2467
2468         protected:
2469             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
2470                 PROC_TYPED_FOREIGN_CHILDREN(Attribute,saml2,SAML20_NS,false);
2471                 PROC_TYPED_FOREIGN_CHILDREN(Assertion,saml2,SAML20_NS,false);
2472                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
2473             }
2474         };
2475
2476         class SAML_DLLLOCAL DigestMethodImpl : public virtual DigestMethod,
2477             public AbstractComplexElement,
2478             public AbstractDOMCachingXMLObject,
2479             public AbstractXMLObjectMarshaller,
2480             public AbstractXMLObjectUnmarshaller
2481         {
2482         public:
2483             virtual ~DigestMethodImpl() {
2484                 XMLString::release(&m_Algorithm);
2485             }
2486
2487             DigestMethodImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
2488                 : AbstractXMLObject(nsURI, localName, prefix, schemaType), m_Algorithm(nullptr) {
2489             }
2490
2491             DigestMethodImpl(const DigestMethodImpl& src)
2492                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src), m_Algorithm(nullptr) {
2493                 setAlgorithm(src.getAlgorithm());
2494                 for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) {
2495                     if (*i) {
2496                         getUnknownXMLObjects().push_back((*i)->clone());
2497                     }
2498                 }
2499             }
2500
2501             IMPL_XMLOBJECT_CLONE(DigestMethod);
2502             IMPL_STRING_ATTRIB(Algorithm);
2503             IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
2504
2505         protected:
2506             void marshallAttributes(DOMElement* domElement) const {
2507                 MARSHALL_STRING_ATTRIB(Algorithm,ALGORITHM,nullptr);
2508             }
2509
2510             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
2511                 // Unknown child.
2512                 getUnknownXMLObjects().push_back(childXMLObject);
2513             }
2514
2515             void processAttribute(const DOMAttr* attribute) {
2516                 PROC_STRING_ATTRIB(Algorithm,ALGORITHM,nullptr);
2517             }
2518         };
2519
2520         class SAML_DLLLOCAL SigningMethodImpl : public virtual SigningMethod,
2521             public AbstractComplexElement,
2522             public AbstractDOMCachingXMLObject,
2523             public AbstractXMLObjectMarshaller,
2524             public AbstractXMLObjectUnmarshaller
2525         {
2526             void init() {
2527                 m_Algorithm = m_MinKeySize = m_MaxKeySize = nullptr;
2528             }
2529
2530         public:
2531             virtual ~SigningMethodImpl() {
2532                 XMLString::release(&m_Algorithm);
2533                 XMLString::release(&m_MinKeySize);
2534                 XMLString::release(&m_MaxKeySize);
2535             }
2536
2537             SigningMethodImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
2538                     : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
2539                 init();
2540             }
2541
2542             SigningMethodImpl(const SigningMethodImpl& src)
2543                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
2544                 init();
2545                 setAlgorithm(src.getAlgorithm());
2546                 setMinKeySize(src.m_MinKeySize);
2547                 setMaxKeySize(src.m_MaxKeySize);
2548                 for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) {
2549                     if (*i) {
2550                         getUnknownXMLObjects().push_back((*i)->clone());
2551                     }
2552                 }
2553             }
2554
2555             IMPL_XMLOBJECT_CLONE(SigningMethod);
2556             IMPL_STRING_ATTRIB(Algorithm);
2557             IMPL_INTEGER_ATTRIB(MinKeySize);
2558             IMPL_INTEGER_ATTRIB(MaxKeySize);
2559             IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
2560
2561         protected:
2562             void marshallAttributes(DOMElement* domElement) const {
2563                 MARSHALL_STRING_ATTRIB(Algorithm,ALGORITHM,nullptr);
2564                 MARSHALL_INTEGER_ATTRIB(MinKeySize,MINKEYSIZE,nullptr);
2565                 MARSHALL_INTEGER_ATTRIB(MaxKeySize,MAXKEYSIZE,nullptr);
2566             }
2567
2568             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
2569                 // Unknown child.
2570                 getUnknownXMLObjects().push_back(childXMLObject);
2571             }
2572
2573             void processAttribute(const DOMAttr* attribute) {
2574                 PROC_STRING_ATTRIB(Algorithm,ALGORITHM,nullptr);
2575                 PROC_INTEGER_ATTRIB(MinKeySize,MINKEYSIZE,nullptr);
2576                 PROC_INTEGER_ATTRIB(MaxKeySize,MAXKEYSIZE,nullptr);
2577             }
2578         };
2579
2580         class SAML_DLLLOCAL DisplayNameImpl : public virtual DisplayName, public localizedNameTypeImpl
2581         {
2582         public:
2583             virtual ~DisplayNameImpl() {}
2584
2585             DisplayNameImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
2586                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
2587
2588             DisplayNameImpl(const DisplayNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
2589
2590             IMPL_XMLOBJECT_CLONE_EX(DisplayName);
2591         };
2592
2593         class SAML_DLLLOCAL DescriptionImpl : public virtual Description, public localizedNameTypeImpl
2594         {
2595         public:
2596             virtual ~DescriptionImpl() {}
2597
2598             DescriptionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
2599                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
2600
2601             DescriptionImpl(const DescriptionImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
2602
2603             IMPL_XMLOBJECT_CLONE_EX(Description);
2604         };
2605
2606         class SAML_DLLLOCAL InformationURLImpl : public virtual InformationURL, public localizedURITypeImpl
2607         {
2608         public:
2609             virtual ~InformationURLImpl() {}
2610
2611             InformationURLImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
2612                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
2613
2614             InformationURLImpl(const InformationURLImpl& src) : AbstractXMLObject(src), localizedURITypeImpl(src) {}
2615
2616             IMPL_XMLOBJECT_CLONE_EX(InformationURL);
2617         };
2618
2619         class SAML_DLLLOCAL PrivacyStatementURLImpl : public virtual PrivacyStatementURL, public localizedURITypeImpl
2620         {
2621         public:
2622             virtual ~PrivacyStatementURLImpl() {}
2623
2624             PrivacyStatementURLImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
2625                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
2626
2627             PrivacyStatementURLImpl(const PrivacyStatementURLImpl& src) : AbstractXMLObject(src), localizedURITypeImpl(src) {}
2628
2629             IMPL_XMLOBJECT_CLONE_EX(PrivacyStatementURL);
2630         };
2631
2632         class SAML_DLLLOCAL KeywordsImpl : public virtual Keywords,
2633             public AbstractSimpleElement,
2634             public AbstractDOMCachingXMLObject,
2635             public AbstractXMLObjectMarshaller,
2636             public AbstractXMLObjectUnmarshaller
2637         {
2638             void init() {
2639                 m_Lang=nullptr;
2640                 m_LangPrefix=nullptr;
2641             }
2642
2643         protected:
2644             KeywordsImpl() {
2645                 init();
2646             }
2647
2648         public:
2649             virtual ~KeywordsImpl() {
2650                 XMLString::release(&m_Lang);
2651                 XMLString::release(&m_LangPrefix);
2652             }
2653
2654             KeywordsImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
2655                     : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
2656                 init();
2657             }
2658
2659             KeywordsImpl(const KeywordsImpl& src)
2660                     : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
2661                 init();
2662                 setLang(src.getLang());
2663                 if (src.m_LangPrefix)
2664                     m_LangPrefix = XMLString::replicate(src.m_LangPrefix);
2665             }
2666
2667             IMPL_XMLOBJECT_CLONE(Keywords);
2668             IMPL_XMLOBJECT_FOREIGN_ATTRIB(Lang,XMLCh);
2669
2670         protected:
2671             void marshallAttributes(DOMElement* domElement) const {
2672                 if (m_Lang && *m_Lang) {
2673                     DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(xmlconstants::XML_NS, LANG_ATTRIB_NAME);
2674                     if (m_LangPrefix && *m_LangPrefix)
2675                         attr->setPrefix(m_LangPrefix);
2676                     else
2677                         attr->setPrefix(xmlconstants::XML_PREFIX);
2678                     attr->setNodeValue(m_Lang);
2679                     domElement->setAttributeNodeNS(attr);
2680                 }
2681             }
2682
2683             void processAttribute(const DOMAttr* attribute) {
2684                 if (XMLHelper::isNodeNamed(attribute, xmlconstants::XML_NS, LANG_ATTRIB_NAME)) {
2685                     setLang(attribute->getValue());
2686                     const XMLCh* temp = attribute->getPrefix();
2687                     if (temp && *temp && !XMLString::equals(temp, xmlconstants::XML_NS))
2688                         m_LangPrefix = XMLString::replicate(temp);
2689                     return;
2690                 }
2691                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
2692             }
2693         };
2694
2695         class SAML_DLLLOCAL LogoImpl : public virtual Logo,
2696             public AbstractSimpleElement,
2697             public AbstractDOMCachingXMLObject,
2698             public AbstractXMLObjectMarshaller,
2699             public AbstractXMLObjectUnmarshaller
2700         {
2701             void init() {
2702                 m_Lang=nullptr;
2703                 m_LangPrefix=nullptr;
2704                 m_Height=nullptr;
2705                 m_Width=nullptr;
2706             }
2707
2708         protected:
2709             LogoImpl() {
2710                 init();
2711             }
2712
2713         public:
2714             virtual ~LogoImpl() {
2715                 XMLString::release(&m_Lang);
2716                 XMLString::release(&m_LangPrefix);
2717                 XMLString::release(&m_Height);
2718                 XMLString::release(&m_Width);
2719             }
2720
2721             LogoImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
2722                     : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
2723                 init();
2724             }
2725
2726             LogoImpl(const LogoImpl& src) : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
2727                 init();
2728                 setLang(src.getLang());
2729                 if (src.m_LangPrefix)
2730                     m_LangPrefix = XMLString::replicate(src.m_LangPrefix);
2731                 setHeight(src.m_Height);
2732                 setWidth(src.m_Width);
2733             }
2734
2735             IMPL_XMLOBJECT_CLONE(Logo);
2736             IMPL_XMLOBJECT_FOREIGN_ATTRIB(Lang,XMLCh);
2737             IMPL_INTEGER_ATTRIB(Height);
2738             IMPL_INTEGER_ATTRIB(Width);
2739
2740         protected:
2741             void marshallAttributes(DOMElement* domElement) const {
2742                 if (m_Lang && *m_Lang) {
2743                     DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(xmlconstants::XML_NS, LANG_ATTRIB_NAME);
2744                     if (m_LangPrefix && *m_LangPrefix)
2745                         attr->setPrefix(m_LangPrefix);
2746                     else
2747                         attr->setPrefix(xmlconstants::XML_PREFIX);
2748                     attr->setNodeValue(m_Lang);
2749                     domElement->setAttributeNodeNS(attr);
2750                 }
2751                 MARSHALL_INTEGER_ATTRIB(Height,HEIGHT,nullptr);
2752                 MARSHALL_INTEGER_ATTRIB(Width,WIDTH,nullptr);
2753             }
2754
2755             void processAttribute(const DOMAttr* attribute) {
2756                 if (XMLHelper::isNodeNamed(attribute, xmlconstants::XML_NS, LANG_ATTRIB_NAME)) {
2757                     setLang(attribute->getValue());
2758                     const XMLCh* temp = attribute->getPrefix();
2759                     if (temp && *temp && !XMLString::equals(temp, xmlconstants::XML_NS))
2760                         m_LangPrefix = XMLString::replicate(temp);
2761                     return;
2762                 }
2763                 PROC_INTEGER_ATTRIB(Height,HEIGHT,nullptr);
2764                 PROC_INTEGER_ATTRIB(Width,WIDTH,nullptr);
2765                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
2766             }
2767         };
2768
2769         class SAML_DLLLOCAL UIInfoImpl : public virtual UIInfo,
2770             public AbstractComplexElement,
2771             public AbstractDOMCachingXMLObject,
2772             public AbstractXMLObjectMarshaller,
2773             public AbstractXMLObjectUnmarshaller
2774         {
2775         public:
2776             virtual ~UIInfoImpl() {}
2777
2778             UIInfoImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
2779                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
2780             }
2781
2782             UIInfoImpl(const UIInfoImpl& src)
2783                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
2784                 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
2785                     if (*i) {
2786                         DisplayName* dn=dynamic_cast<DisplayName*>(*i);
2787                         if (dn) {
2788                             getDisplayNames().push_back(dn->cloneDisplayName());
2789                             continue;
2790                         }
2791
2792                         Description* des=dynamic_cast<Description*>(*i);
2793                         if (des) {
2794                             getDescriptions().push_back(des->cloneDescription());
2795                             continue;
2796                         }
2797
2798                         Keywords* key=dynamic_cast<Keywords*>(*i);
2799                         if (key) {
2800                             getKeywordss().push_back(key->cloneKeywords());
2801                             continue;
2802                         }
2803
2804                                                 Logo* logo=dynamic_cast<Logo*>(*i);
2805                         if (logo) {
2806                             getLogos().push_back(logo->cloneLogo());
2807                             continue;
2808                         }
2809
2810                         InformationURL* inf=dynamic_cast<InformationURL*>(*i);
2811                         if (inf) {
2812                             getInformationURLs().push_back(inf->cloneInformationURL());
2813                             continue;
2814                         }
2815
2816                         PrivacyStatementURL* priv=dynamic_cast<PrivacyStatementURL*>(*i);
2817                         if (priv) {
2818                             getPrivacyStatementURLs().push_back(priv->clonePrivacyStatementURL());
2819                             continue;
2820                         }
2821
2822                         if (*i) {
2823                             getUnknownXMLObjects().push_back((*i)->clone());
2824                         }
2825                     }
2826                 }
2827             }
2828
2829             IMPL_XMLOBJECT_CLONE(UIInfo);
2830             IMPL_TYPED_CHILDREN(DisplayName,m_children.end());
2831             IMPL_TYPED_CHILDREN(Description,m_children.end());
2832                         IMPL_TYPED_CHILDREN(Keywords,m_children.end());
2833             IMPL_TYPED_CHILDREN(Logo,m_children.end());
2834             IMPL_TYPED_CHILDREN(InformationURL,m_children.end());
2835             IMPL_TYPED_CHILDREN(PrivacyStatementURL,m_children.end());
2836             IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
2837
2838         protected:
2839             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
2840                 PROC_TYPED_CHILDREN(DisplayName,SAML20MD_UI_NS,false);
2841                 PROC_TYPED_CHILDREN(Description,SAML20MD_UI_NS,false);
2842                                 PROC_TYPED_CHILDREN(Keywords,SAML20MD_UI_NS,false);
2843                 PROC_TYPED_CHILDREN(Logo,SAML20MD_UI_NS,false);
2844                 PROC_TYPED_CHILDREN(InformationURL,SAML20MD_UI_NS,false);
2845                 PROC_TYPED_CHILDREN(PrivacyStatementURL,SAML20MD_UI_NS,false);
2846
2847                 // Unknown child.
2848                 const XMLCh* nsURI=root->getNamespaceURI();
2849                 if (!XMLString::equals(nsURI,SAML20MD_UI_NS) && nsURI && *nsURI) {
2850                     getUnknownXMLObjects().push_back(childXMLObject);
2851                     return;
2852                 }
2853
2854                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
2855             }
2856         };
2857
2858         class SAML_DLLLOCAL DiscoHintsImpl : public virtual DiscoHints,
2859             public AbstractComplexElement,
2860             public AbstractDOMCachingXMLObject,
2861             public AbstractXMLObjectMarshaller,
2862             public AbstractXMLObjectUnmarshaller
2863         {
2864         public:
2865             virtual ~DiscoHintsImpl() {}
2866
2867             DiscoHintsImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
2868                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
2869             }
2870
2871             DiscoHintsImpl(const DiscoHintsImpl& src)
2872                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
2873                 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
2874                     if (*i) {
2875                         IPHint* ip=dynamic_cast<IPHint*>(*i);
2876                         if (ip) {
2877                             getIPHints().push_back(ip->cloneIPHint());
2878                             continue;
2879                         }
2880
2881                         DomainHint* dom=dynamic_cast<DomainHint*>(*i);
2882                         if (dom) {
2883                             getDomainHints().push_back(dom->cloneDomainHint());
2884                             continue;
2885                         }
2886
2887                         GeolocationHint* geo=dynamic_cast<GeolocationHint*>(*i);
2888                         if (geo) {
2889                             getGeolocationHints().push_back(geo->cloneGeolocationHint());
2890                             continue;
2891                         }
2892
2893                         if (*i) {
2894                             getUnknownXMLObjects().push_back((*i)->clone());
2895                         }
2896                     }
2897                 }
2898             }
2899
2900             IMPL_XMLOBJECT_CLONE(DiscoHints);
2901             IMPL_TYPED_CHILDREN(IPHint,m_children.end());
2902             IMPL_TYPED_CHILDREN(DomainHint,m_children.end());
2903             IMPL_TYPED_CHILDREN(GeolocationHint,m_children.end());
2904             IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
2905
2906         protected:
2907             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
2908                 PROC_TYPED_CHILDREN(IPHint,SAML20MD_UI_NS,false);
2909                 PROC_TYPED_CHILDREN(DomainHint,SAML20MD_UI_NS,false);
2910                 PROC_TYPED_CHILDREN(GeolocationHint,SAML20MD_UI_NS,false);
2911
2912                 // Unknown child.
2913                 const XMLCh* nsURI=root->getNamespaceURI();
2914                 if (!XMLString::equals(nsURI,SAML20MD_UI_NS) && nsURI && *nsURI) {
2915                     getUnknownXMLObjects().push_back(childXMLObject);
2916                     return;
2917                 }
2918
2919                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
2920             }
2921         };
2922
2923     };
2924 };
2925
2926 #if defined (_MSC_VER)
2927     #pragma warning( pop )
2928 #endif
2929
2930 IMPL_ELEMENT_QNAME(IDPSSODescriptor, SAML20MD_NS, SAML20MD_PREFIX);
2931 IMPL_ELEMENT_QNAME(SPSSODescriptor, SAML20MD_NS, SAML20MD_PREFIX);
2932 IMPL_ELEMENT_QNAME(AuthnAuthorityDescriptor, SAML20MD_NS, SAML20MD_PREFIX);
2933 IMPL_ELEMENT_QNAME(AttributeAuthorityDescriptor, SAML20MD_NS, SAML20MD_PREFIX);
2934 IMPL_ELEMENT_QNAME(PDPDescriptor, SAML20MD_NS, SAML20MD_PREFIX);
2935 IMPL_TYPE_QNAME(AuthnQueryDescriptorType, SAML20MD_QUERY_EXT_NS, SAML20MD_QUERY_EXT_PREFIX);
2936 IMPL_TYPE_QNAME(AttributeQueryDescriptorType, SAML20MD_QUERY_EXT_NS, SAML20MD_QUERY_EXT_PREFIX);
2937 IMPL_TYPE_QNAME(AuthzDecisionQueryDescriptorType, SAML20MD_QUERY_EXT_NS, SAML20MD_QUERY_EXT_PREFIX);
2938
2939 // Builder Implementations
2940
2941 IMPL_XMLOBJECTBUILDER(AdditionalMetadataLocation);
2942 IMPL_XMLOBJECTBUILDER(AffiliateMember);
2943 IMPL_XMLOBJECTBUILDER(AffiliationDescriptor);
2944 IMPL_XMLOBJECTBUILDER(ArtifactResolutionService);
2945 IMPL_XMLOBJECTBUILDER(AssertionConsumerService);
2946 IMPL_XMLOBJECTBUILDER(AssertionIDRequestService);
2947 IMPL_XMLOBJECTBUILDER(AttributeAuthorityDescriptor);
2948 IMPL_XMLOBJECTBUILDER(AttributeConsumingService);
2949 IMPL_XMLOBJECTBUILDER(AttributeProfile);
2950 IMPL_XMLOBJECTBUILDER(AttributeQueryDescriptorType);
2951 IMPL_XMLOBJECTBUILDER(AttributeService);
2952 IMPL_XMLOBJECTBUILDER(AuthnAuthorityDescriptor);
2953 IMPL_XMLOBJECTBUILDER(AuthnQueryDescriptorType);
2954 IMPL_XMLOBJECTBUILDER(AuthnQueryService);
2955 IMPL_XMLOBJECTBUILDER(AuthzDecisionQueryDescriptorType);
2956 IMPL_XMLOBJECTBUILDER(AuthzService);
2957 IMPL_XMLOBJECTBUILDER(Company);
2958 IMPL_XMLOBJECTBUILDER(ContactPerson);
2959 IMPL_XMLOBJECTBUILDER(EmailAddress);
2960 IMPL_XMLOBJECTBUILDER(EndpointType);
2961 IMPL_XMLOBJECTBUILDER(EntitiesDescriptor);
2962 IMPL_XMLOBJECTBUILDER(EntityDescriptor);
2963 IMPL_XMLOBJECTBUILDER(Extensions);
2964 IMPL_XMLOBJECTBUILDER(GivenName);
2965 IMPL_XMLOBJECTBUILDER(IDPSSODescriptor);
2966 IMPL_XMLOBJECTBUILDER(IndexedEndpointType);
2967 IMPL_XMLOBJECTBUILDER(KeyDescriptor);
2968 IMPL_XMLOBJECTBUILDER(localizedNameType);
2969 IMPL_XMLOBJECTBUILDER(localizedURIType);
2970 IMPL_XMLOBJECTBUILDER(ManageNameIDService);
2971 IMPL_XMLOBJECTBUILDER(NameIDFormat);
2972 IMPL_XMLOBJECTBUILDER(NameIDMappingService);
2973 IMPL_XMLOBJECTBUILDER(Organization);
2974 IMPL_XMLOBJECTBUILDER(OrganizationName);
2975 IMPL_XMLOBJECTBUILDER(OrganizationDisplayName);
2976 IMPL_XMLOBJECTBUILDER(OrganizationURL);
2977 IMPL_XMLOBJECTBUILDER(PDPDescriptor);
2978 IMPL_XMLOBJECTBUILDER(RequestedAttribute);
2979 IMPL_XMLOBJECTBUILDER(ServiceDescription);
2980 IMPL_XMLOBJECTBUILDER(ServiceName);
2981 IMPL_XMLOBJECTBUILDER(SingleLogoutService);
2982 IMPL_XMLOBJECTBUILDER(SingleSignOnService);
2983 IMPL_XMLOBJECTBUILDER(SPSSODescriptor);
2984 IMPL_XMLOBJECTBUILDER(SurName);
2985 IMPL_XMLOBJECTBUILDER(TelephoneNumber);
2986
2987 IMPL_XMLOBJECTBUILDER(ActionNamespace);
2988 IMPL_XMLOBJECTBUILDER(SourceID);
2989 IMPL_XMLOBJECTBUILDER(DiscoveryResponse);
2990 IMPL_XMLOBJECTBUILDER(RequestInitiator);
2991 IMPL_XMLOBJECTBUILDER(EntityAttributes);
2992 IMPL_XMLOBJECTBUILDER(DigestMethod);
2993 IMPL_XMLOBJECTBUILDER(SigningMethod);
2994 IMPL_XMLOBJECTBUILDER(DisplayName);
2995 IMPL_XMLOBJECTBUILDER(Description);
2996 IMPL_XMLOBJECTBUILDER(Keywords);
2997 IMPL_XMLOBJECTBUILDER(Logo);
2998 IMPL_XMLOBJECTBUILDER(InformationURL);
2999 IMPL_XMLOBJECTBUILDER(PrivacyStatementURL);
3000 IMPL_XMLOBJECTBUILDER(UIInfo);
3001 IMPL_XMLOBJECTBUILDER(IPHint);
3002 IMPL_XMLOBJECTBUILDER(DomainHint);
3003 IMPL_XMLOBJECTBUILDER(GeolocationHint);
3004 IMPL_XMLOBJECTBUILDER(DiscoHints);
3005
3006 #ifdef HAVE_COVARIANT_RETURNS
3007 RoleDescriptor* RoleDescriptorBuilder::buildObject(
3008 #else
3009 xmltooling::XMLObject* RoleDescriptorBuilder::buildObject(
3010 #endif
3011     const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType
3012     ) const
3013 {
3014     return new RoleDescriptorTypeImpl(nsURI,localName,prefix,schemaType);
3015 }
3016
3017 const DigestMethod* RoleDescriptor::getDigestMethod() const
3018 {
3019     bool roleLevel = false;
3020     XMLToolingConfig& conf = XMLToolingConfig::getConfig();
3021
3022     if (getExtensions()) {
3023         const vector<XMLObject*>& exts = const_cast<const Extensions*>(getExtensions())->getUnknownXMLObjects();
3024         for (vector<XMLObject*>::const_iterator i = exts.begin(); i != exts.end(); ++i) {
3025             const opensaml::saml2md::DigestMethod* dm = dynamic_cast<opensaml::saml2md::DigestMethod*>(*i);
3026             if (dm) {
3027                 if (dm->getAlgorithm() && conf.isXMLAlgorithmSupported(dm->getAlgorithm(), XMLToolingConfig::ALGTYPE_DIGEST))
3028                     return dm;
3029                 roleLevel = true;
3030             }
3031         }
3032     }
3033
3034     if (!roleLevel) {
3035         const EntityDescriptor* entity = dynamic_cast<EntityDescriptor*>(getParent());
3036         if (entity && entity->getExtensions()) {
3037             const vector<XMLObject*>& exts = const_cast<const Extensions*>(entity->getExtensions())->getUnknownXMLObjects();
3038             for (vector<XMLObject*>::const_iterator i = exts.begin(); i != exts.end(); ++i) {
3039                 const opensaml::saml2md::DigestMethod* dm = dynamic_cast<opensaml::saml2md::DigestMethod*>(*i);
3040                 if (dm && dm->getAlgorithm() && conf.isXMLAlgorithmSupported(dm->getAlgorithm(), XMLToolingConfig::ALGTYPE_DIGEST))
3041                     return dm;
3042             }
3043         }
3044     }
3045
3046     return nullptr;
3047 }
3048
3049 pair<const SigningMethod*,const Credential*> RoleDescriptor::getSigningMethod(const CredentialResolver& resolver, CredentialCriteria& cc) const
3050 {
3051     bool roleLevel = false;
3052     XMLToolingConfig& conf = XMLToolingConfig::getConfig();
3053
3054     if (getExtensions()) {
3055         const vector<XMLObject*>& exts = const_cast<const Extensions*>(getExtensions())->getUnknownXMLObjects();
3056         for (vector<XMLObject*>::const_iterator i = exts.begin(); i != exts.end(); ++i) {
3057             const SigningMethod* sm = dynamic_cast<SigningMethod*>(*i);
3058             if (sm) {
3059                 roleLevel = true;
3060                 if (sm->getAlgorithm() && conf.isXMLAlgorithmSupported(sm->getAlgorithm(), XMLToolingConfig::ALGTYPE_SIGN)) {
3061                     cc.setXMLAlgorithm(sm->getAlgorithm());
3062                     pair<bool,int> minsize = sm->getMinKeySize(), maxsize = sm->getMaxKeySize();
3063                     if (minsize.first || maxsize.first) {
3064                         cc.setKeySize(minsize.first ? minsize.second : 0);
3065                         cc.setMaxKeySize(maxsize.first ? maxsize.second : UINT_MAX);
3066                     }
3067                     else {
3068                         cc.setKeySize(0);
3069                         cc.setMaxKeySize(0);
3070                     }
3071                     const Credential* cred = resolver.resolve(&cc);
3072                     if (cred)
3073                         return make_pair(sm, cred);
3074                 }
3075             }
3076         }
3077     }
3078
3079     if (!roleLevel) {
3080         const EntityDescriptor* entity = dynamic_cast<EntityDescriptor*>(getParent());
3081         if (entity && entity->getExtensions()) {
3082             const vector<XMLObject*>& exts = const_cast<const Extensions*>(entity->getExtensions())->getUnknownXMLObjects();
3083             for (vector<XMLObject*>::const_iterator i = exts.begin(); i != exts.end(); ++i) {
3084                 const SigningMethod* sm = dynamic_cast<SigningMethod*>(*i);
3085                 if (sm) {
3086                     if (sm->getAlgorithm() && conf.isXMLAlgorithmSupported(sm->getAlgorithm(), XMLToolingConfig::ALGTYPE_SIGN)) {
3087                         cc.setXMLAlgorithm(sm->getAlgorithm());
3088                         pair<bool,int> minsize = sm->getMinKeySize(), maxsize = sm->getMaxKeySize();
3089                         if (minsize.first || maxsize.first) {
3090                             cc.setKeySize(minsize.first ? minsize.second : 0);
3091                             cc.setMaxKeySize(maxsize.first ? maxsize.second : UINT_MAX);
3092                         }
3093                         else {
3094                             cc.setKeySize(0);
3095                             cc.setMaxKeySize(0);
3096                         }
3097                         const Credential* cred = resolver.resolve(&cc);
3098                         if (cred)
3099                             return make_pair(sm, cred);
3100                     }
3101                 }
3102             }
3103         }
3104     }
3105
3106     cc.setKeySize(0);
3107     cc.setMaxKeySize(0);
3108     cc.setXMLAlgorithm(nullptr);
3109     return pair<const SigningMethod*,const Credential*>(nullptr, resolver.resolve(&cc));
3110 }
3111
3112 const XMLCh ActionNamespace::LOCAL_NAME[] =             UNICODE_LITERAL_15(A,c,t,i,o,n,N,a,m,e,s,p,a,c,e);
3113 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);
3114 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);
3115 const XMLCh AdditionalMetadataLocation::NAMESPACE_ATTRIB_NAME[] =   UNICODE_LITERAL_9(n,a,m,e,s,p,a,c,e);
3116 const XMLCh AffiliateMember::LOCAL_NAME[] =             UNICODE_LITERAL_15(A,f,f,i,l,i,a,t,e,M,e,m,b,e,r);
3117 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);
3118 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);
3119 const XMLCh AffiliationDescriptor::ID_ATTRIB_NAME[] =   UNICODE_LITERAL_2(I,D);
3120 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);
3121 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);
3122 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);
3123 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);
3124 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);
3125 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);
3126 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);
3127 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);
3128 const XMLCh AttributeConsumingService::INDEX_ATTRIB_NAME[] =    UNICODE_LITERAL_5(i,n,d,e,x);
3129 const XMLCh AttributeConsumingService::ISDEFAULT_ATTRIB_NAME[] =    UNICODE_LITERAL_9(i,s,D,e,f,a,u,l,t);
3130 const XMLCh AttributeProfile::LOCAL_NAME[] =            UNICODE_LITERAL_16(A,t,t,r,i,b,u,t,e,P,r,o,f,i,l,e);
3131 const XMLCh AttributeQueryDescriptorType::LOCAL_NAME[] =UNICODE_LITERAL_14(R,o,l,e,D,e,s,c,r,i,p,t,o,r);
3132 const XMLCh AttributeQueryDescriptorType::TYPE_NAME[] = UNICODE_LITERAL_28(A,t,t,r,i,b,u,t,e,Q,u,e,r,y,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
3133 const XMLCh AttributeService::LOCAL_NAME[] =            UNICODE_LITERAL_16(A,t,t,r,i,b,u,t,e,S,e,r,v,i,c,e);
3134 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);
3135 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);
3136 const XMLCh AuthnQueryDescriptorType::LOCAL_NAME[] =    UNICODE_LITERAL_14(R,o,l,e,D,e,s,c,r,i,p,t,o,r);
3137 const XMLCh AuthnQueryDescriptorType::TYPE_NAME[] =     UNICODE_LITERAL_24(A,u,t,h,n,Q,u,e,r,y,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
3138 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);
3139 const XMLCh AuthzDecisionQueryDescriptorType::LOCAL_NAME[] =    UNICODE_LITERAL_14(R,o,l,e,D,e,s,c,r,i,p,t,o,r);
3140 const XMLCh AuthzDecisionQueryDescriptorType::TYPE_NAME[] = UNICODE_LITERAL_32(A,u,t,h,z,D,e,c,i,s,i,o,n,Q,u,e,r,y,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
3141 const XMLCh AuthzService::LOCAL_NAME[] =                UNICODE_LITERAL_12(A,u,t,h,z,S,e,r,v,i,c,e);
3142 const XMLCh CacheableSAMLObject::CACHEDURATION_ATTRIB_NAME[] =  UNICODE_LITERAL_13(c,a,c,h,e,D,u,r,a,t,i,o,n);
3143 const XMLCh Company::LOCAL_NAME[] =                     UNICODE_LITERAL_7(C,o,m,p,a,n,y);
3144 const XMLCh ContactPerson::LOCAL_NAME[] =               UNICODE_LITERAL_13(C,o,n,t,a,c,t,P,e,r,s,o,n);
3145 const XMLCh ContactPerson::TYPE_NAME[] =                UNICODE_LITERAL_11(C,o,n,t,a,c,t,T,y,p,e);
3146 const XMLCh ContactPerson::CONTACTTYPE_ATTRIB_NAME[] =  UNICODE_LITERAL_11(c,o,n,t,a,c,t,T,y,p,e);
3147 const XMLCh ContactPerson::CONTACT_TECHNICAL[] =        UNICODE_LITERAL_9(t,e,c,h,n,i,c,a,l);
3148 const XMLCh ContactPerson::CONTACT_SUPPORT[] =          UNICODE_LITERAL_7(s,u,p,p,o,r,t);
3149 const XMLCh ContactPerson::CONTACT_ADMINISTRATIVE[] =   UNICODE_LITERAL_14(a,d,m,i,n,i,s,t,r,a,t,i,v,e);
3150 const XMLCh ContactPerson::CONTACT_BILLING[] =          UNICODE_LITERAL_7(b,i,l,l,i,n,g);
3151 const XMLCh ContactPerson::CONTACT_OTHER[] =            UNICODE_LITERAL_5(o,t,h,e,r);
3152 const XMLCh Description::LOCAL_NAME[] =                 UNICODE_LITERAL_11(D,e,s,c,r,i,p,t,i,o,n);
3153 const XMLCh DigestMethod::LOCAL_NAME[] =                UNICODE_LITERAL_12(D,i,g,e,s,t,M,e,t,h,o,d);
3154 const XMLCh DigestMethod::TYPE_NAME[] =                 UNICODE_LITERAL_16(D,i,g,e,s,t,M,e,t,h,o,d,T,y,p,e);
3155 const XMLCh DigestMethod::ALGORITHM_ATTRIB_NAME[] =     UNICODE_LITERAL_9(A,l,g,o,r,i,t,h,m);
3156 const XMLCh DiscoHints::LOCAL_NAME[] =                  UNICODE_LITERAL_10(D,i,s,c,o,H,i,n,t,s);
3157 const XMLCh DiscoHints::TYPE_NAME[] =                   UNICODE_LITERAL_14(D,i,s,c,o,H,i,n,t,s,T,y,p,e);
3158 const XMLCh DiscoveryResponse::LOCAL_NAME[] =           UNICODE_LITERAL_17(D,i,s,c,o,v,e,r,y,R,e,s,p,o,n,s,e);
3159 const XMLCh DisplayName::LOCAL_NAME[] =                 UNICODE_LITERAL_11(D,i,s,p,l,a,y,N,a,m,e);
3160 const XMLCh DomainHint::LOCAL_NAME[] =                  UNICODE_LITERAL_10(D,o,m,a,i,n,H,i,n,t);
3161 const XMLCh EmailAddress::LOCAL_NAME[] =                UNICODE_LITERAL_12(E,m,a,i,l,A,d,d,r,e,s,s);
3162 const XMLCh EndpointType::LOCAL_NAME[] =                {chNull};
3163 const XMLCh EndpointType::TYPE_NAME[] =                 UNICODE_LITERAL_12(E,n,d,p,o,i,n,t,T,y,p,e);
3164 const XMLCh EndpointType::BINDING_ATTRIB_NAME[] =       UNICODE_LITERAL_7(B,i,n,d,i,n,g);
3165 const XMLCh EndpointType::LOCATION_ATTRIB_NAME[] =      UNICODE_LITERAL_8(L,o,c,a,t,i,o,n);
3166 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);
3167 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);
3168 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);
3169 const XMLCh EntitiesDescriptor::ID_ATTRIB_NAME[] =      UNICODE_LITERAL_2(I,D);
3170 const XMLCh EntitiesDescriptor::NAME_ATTRIB_NAME[] =    UNICODE_LITERAL_4(N,a,m,e);
3171 const XMLCh EntityDescriptor::LOCAL_NAME[] =            UNICODE_LITERAL_16(E,n,t,i,t,y,D,e,s,c,r,i,p,t,o,r);
3172 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);
3173 const XMLCh EntityDescriptor::ID_ATTRIB_NAME[] =        UNICODE_LITERAL_2(I,D);
3174 const XMLCh EntityDescriptor::ENTITYID_ATTRIB_NAME[] =  UNICODE_LITERAL_8(e,n,t,i,t,y,I,D);
3175 const XMLCh EntityAttributes::LOCAL_NAME[] =            UNICODE_LITERAL_16(E,n,t,i,t,y,A,t,t,r,i,b,u,t,e,s);
3176 const XMLCh EntityAttributes::TYPE_NAME[] =             UNICODE_LITERAL_20(E,n,t,i,t,y,A,t,t,r,i,b,u,t,e,s,T,y,p,e);
3177 const XMLCh Extensions::LOCAL_NAME[] =                  UNICODE_LITERAL_10(E,x,t,e,n,s,i,o,n,s);
3178 const XMLCh Extensions::TYPE_NAME[] =                   UNICODE_LITERAL_14(E,x,t,e,n,s,i,o,n,s,T,y,p,e);
3179 const XMLCh GeolocationHint::LOCAL_NAME[] =             UNICODE_LITERAL_15(G,e,o,l,o,c,a,t,i,o,n,H,i,n,t);
3180 const XMLCh GivenName::LOCAL_NAME[] =                   UNICODE_LITERAL_9(G,i,v,e,n,N,a,m,e);
3181 const XMLCh IDPSSODescriptor::LOCAL_NAME[] =            UNICODE_LITERAL_16(I,D,P,S,S,O,D,e,s,c,r,i,p,t,o,r);
3182 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);
3183 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);
3184 const XMLCh IndexedEndpointType::LOCAL_NAME[] =         {chNull};
3185 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);
3186 const XMLCh IndexedEndpointType::INDEX_ATTRIB_NAME[] =  UNICODE_LITERAL_5(i,n,d,e,x);
3187 const XMLCh IndexedEndpointType::ISDEFAULT_ATTRIB_NAME[] =  UNICODE_LITERAL_9(i,s,D,e,f,a,u,l,t);
3188 const XMLCh InformationURL::LOCAL_NAME[] =              UNICODE_LITERAL_14(I,n,f,o,r,m,a,t,i,o,n,U,R,L);
3189 const XMLCh IPHint::LOCAL_NAME[] =                      UNICODE_LITERAL_6(I,P,H,i,n,t);
3190 const XMLCh KeyDescriptor::LOCAL_NAME[] =               UNICODE_LITERAL_13(K,e,y,D,e,s,c,r,i,p,t,o,r);
3191 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);
3192 const XMLCh KeyDescriptor::USE_ATTRIB_NAME[] =          UNICODE_LITERAL_3(u,s,e);
3193 const XMLCh KeyDescriptor::KEYTYPE_ENCRYPTION[] =       UNICODE_LITERAL_10(e,n,c,r,y,p,t,i,o,n);
3194 const XMLCh KeyDescriptor::KEYTYPE_SIGNING[] =          UNICODE_LITERAL_7(s,i,g,n,i,n,g);
3195 const XMLCh Keywords::LOCAL_NAME[] =                                    UNICODE_LITERAL_8(K,e,y,w,o,r,d,s);
3196 const XMLCh Keywords::TYPE_NAME[] =                                             UNICODE_LITERAL_12(K,e,y,w,o,r,d,s,T,y,p,e);
3197 const XMLCh Keywords::LANG_ATTRIB_NAME[] =              UNICODE_LITERAL_4(l,a,n,g);
3198 const XMLCh Logo::LOCAL_NAME[] =                        UNICODE_LITERAL_4(L,o,g,o);
3199 const XMLCh Logo::TYPE_NAME[] =                         UNICODE_LITERAL_8(L,o,g,o,T,y,p,e);
3200 const XMLCh Logo::LANG_ATTRIB_NAME[] =                  UNICODE_LITERAL_4(l,a,n,g);
3201 const XMLCh Logo::HEIGHT_ATTRIB_NAME[] =                UNICODE_LITERAL_6(h,e,i,g,h,t);
3202 const XMLCh Logo::WIDTH_ATTRIB_NAME[] =                 UNICODE_LITERAL_5(w,i,d,t,h);
3203 const XMLCh localizedNameType::LOCAL_NAME[] =           {chNull};
3204 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);
3205 const XMLCh localizedNameType::LANG_ATTRIB_NAME[] =     UNICODE_LITERAL_4(l,a,n,g);
3206 const XMLCh localizedURIType::LOCAL_NAME[] =            {chNull};
3207 const XMLCh localizedURIType::TYPE_NAME[] =             UNICODE_LITERAL_16(l,o,c,a,l,i,z,e,d,U,R,I,T,y,p,e);
3208 const XMLCh localizedURIType::LANG_ATTRIB_NAME[] =      UNICODE_LITERAL_4(l,a,n,g);
3209 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);
3210 const XMLCh NameIDFormat::LOCAL_NAME[] =                UNICODE_LITERAL_12(N,a,m,e,I,D,F,o,r,m,a,t);
3211 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);
3212 const XMLCh Organization::LOCAL_NAME[] =                UNICODE_LITERAL_12(O,r,g,a,n,i,z,a,t,i,o,n);
3213 const XMLCh Organization::TYPE_NAME[] =                 UNICODE_LITERAL_16(O,r,g,a,n,i,z,a,t,i,o,n,T,y,p,e);
3214 const XMLCh OrganizationName::LOCAL_NAME[] =            UNICODE_LITERAL_16(O,r,g,a,n,i,z,a,t,i,o,n,N,a,m,e);
3215 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);
3216 const XMLCh OrganizationURL::LOCAL_NAME[] =             UNICODE_LITERAL_15(O,r,g,a,n,i,z,a,t,i,o,n,U,R,L);
3217 const XMLCh PDPDescriptor::LOCAL_NAME[] =               UNICODE_LITERAL_13(P,D,P,D,e,s,c,r,i,p,t,o,r);
3218 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);
3219 const XMLCh PrivacyStatementURL::LOCAL_NAME[] =         UNICODE_LITERAL_19(P,r,i,v,a,c,y,S,t,a,t,e,m,e,n,t,U,R,L);
3220 const XMLCh QueryDescriptorType::LOCAL_NAME[] =         {chNull};
3221 const XMLCh QueryDescriptorType::TYPE_NAME[] =          UNICODE_LITERAL_19(Q,u,e,r,y,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
3222 const XMLCh QueryDescriptorType::WANTASSERTIONSSIGNED_ATTRIB_NAME[] =   UNICODE_LITERAL_20(W,a,n,t,A,s,s,e,r,t,i,o,n,s,S,i,g,n,e,d);
3223 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);
3224 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);
3225 const XMLCh RequestedAttribute::ISREQUIRED_ATTRIB_NAME[] =  UNICODE_LITERAL_10(i,s,R,e,q,u,i,r,e,d);
3226 const XMLCh RequestInitiator::LOCAL_NAME[] =            UNICODE_LITERAL_16(R,e,q,u,e,s,t,I,n,i,t,i,a,t,o,r);
3227 const XMLCh RoleDescriptor::LOCAL_NAME[] =              UNICODE_LITERAL_14(R,o,l,e,D,e,s,c,r,i,p,t,o,r);
3228 const XMLCh RoleDescriptor::ID_ATTRIB_NAME[] =          UNICODE_LITERAL_2(I,D);
3229 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);
3230 const XMLCh RoleDescriptor::ERRORURL_ATTRIB_NAME[] =    UNICODE_LITERAL_8(e,r,r,o,r,U,R,L);
3231 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);
3232 const XMLCh ServiceName::LOCAL_NAME[] =                 UNICODE_LITERAL_11(S,e,r,v,i,c,e,N,a,m,e);
3233 const XMLCh SigningMethod::LOCAL_NAME[] =               UNICODE_LITERAL_13(S,i,g,n,i,n,g,M,e,t,h,o,d);
3234 const XMLCh SigningMethod::TYPE_NAME[] =                UNICODE_LITERAL_17(S,i,g,n,i,n,g,M,e,t,h,o,d,T,y,p,e);
3235 const XMLCh SigningMethod::ALGORITHM_ATTRIB_NAME[] =    UNICODE_LITERAL_9(A,l,g,o,r,i,t,h,m);
3236 const XMLCh SigningMethod::MINKEYSIZE_ATTRIB_NAME[] =   UNICODE_LITERAL_10(M,i,n,K,e,y,S,i,z,e);
3237 const XMLCh SigningMethod::MAXKEYSIZE_ATTRIB_NAME[] =   UNICODE_LITERAL_10(M,a,x,K,e,y,S,i,z,e);
3238 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);
3239 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);
3240 const XMLCh SourceID::LOCAL_NAME[] =                    UNICODE_LITERAL_8(S,o,u,r,c,e,I,D);
3241 const XMLCh SPSSODescriptor::LOCAL_NAME[] =             UNICODE_LITERAL_15(S,P,S,S,O,D,e,s,c,r,i,p,t,o,r);
3242 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);
3243 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);
3244 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);
3245 const XMLCh SSODescriptorType::LOCAL_NAME[] =           {chNull};
3246 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);
3247 const XMLCh SurName::LOCAL_NAME[] =                     UNICODE_LITERAL_7(S,u,r,N,a,m,e);
3248 const XMLCh TelephoneNumber::LOCAL_NAME[] =             UNICODE_LITERAL_15(T,e,l,e,p,h,o,n,e,N,u,m,b,e,r);
3249 const XMLCh TimeBoundSAMLObject::VALIDUNTIL_ATTRIB_NAME[] =   UNICODE_LITERAL_10(v,a,l,i,d,U,n,t,i,l);
3250 const XMLCh UIInfo::LOCAL_NAME[] =                      UNICODE_LITERAL_6(U,I,I,n,f,o);
3251 const XMLCh UIInfo::TYPE_NAME[] =                       UNICODE_LITERAL_10(U,I,I,n,f,o,T,y,p,e);