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