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