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