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