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