https://issues.shibboleth.net/jira/browse/CPPOST-18
[shibboleth/cpp-opensaml.git] / saml / saml2 / metadata / impl / MetadataImpl.cpp
1 /*
2  *  Copyright 2001-2007 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 Assertions schema
21  */
22
23 #include "internal.h"
24 #include "exceptions.h"
25 #include "saml2/metadata/Metadata.h"
26
27 #include <xmltooling/AbstractComplexElement.h>
28 #include <xmltooling/AbstractSimpleElement.h>
29 #include <xmltooling/impl/AnyElement.h>
30 #include <xmltooling/io/AbstractXMLObjectMarshaller.h>
31 #include <xmltooling/io/AbstractXMLObjectUnmarshaller.h>
32 #include <xmltooling/util/XMLHelper.h>
33
34 #include <ctime>
35 #include <xercesc/util/XMLUniDefs.hpp>
36
37 using namespace samlconstants;
38 using namespace opensaml::saml2md;
39 using namespace opensaml::saml2;
40 using namespace opensaml;
41 using namespace xmlencryption;
42 using namespace xmlsignature;
43 using namespace xmltooling;
44 using namespace std;
45 using xmlconstants::XMLSIG_NS;
46 using xmlconstants::XML_BOOL_NULL;
47
48 #if defined (_MSC_VER)
49     #pragma warning( push )
50     #pragma warning( disable : 4250 4251 )
51 #endif
52
53 namespace opensaml {
54     namespace saml2md {
55
56         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,AffiliateMember);
57         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,AttributeProfile);
58         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,Company);
59         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,EmailAddress);
60         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,GivenName);
61         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,NameIDFormat);
62         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,SurName);
63         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,TelephoneNumber);
64
65         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,ActionNamespace);
66         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,SourceID);
67
68         class SAML_DLLLOCAL localizedNameTypeImpl : public virtual localizedNameType,
69             public AbstractSimpleElement,
70             public AbstractDOMCachingXMLObject,
71             public AbstractXMLObjectMarshaller,
72             public AbstractXMLObjectUnmarshaller
73         {
74             void init() {
75                 m_Lang=NULL;
76             }
77
78         protected:
79             localizedNameTypeImpl() {
80                 init();
81             }
82
83         public:
84             virtual ~localizedNameTypeImpl() {
85                 XMLString::release(&m_Lang);
86             }
87
88             localizedNameTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
89                     : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
90                 init();
91             }
92
93             localizedNameTypeImpl(const localizedNameTypeImpl& src)
94                     : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
95                 init();
96                 setLang(src.getLang());
97             }
98
99             IMPL_XMLOBJECT_CLONE(localizedNameType);
100             IMPL_STRING_ATTRIB(Lang);
101
102         protected:
103             void marshallAttributes(DOMElement* domElement) const {
104                 MARSHALL_STRING_ATTRIB(Lang,LANG,xmlconstants::XML_NS);
105             }
106
107             void processAttribute(const DOMAttr* attribute) {
108                 PROC_STRING_ATTRIB(Lang,LANG,xmlconstants::XML_NS);
109                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
110             }
111         };
112
113         class SAML_DLLLOCAL localizedURITypeImpl : public virtual localizedURIType,
114             public AbstractSimpleElement,
115             public AbstractDOMCachingXMLObject,
116             public AbstractXMLObjectMarshaller,
117             public AbstractXMLObjectUnmarshaller
118         {
119             void init() {
120                 m_Lang=NULL;
121             }
122
123         protected:
124             localizedURITypeImpl() {
125                 init();
126             }
127
128         public:
129             virtual ~localizedURITypeImpl() {
130                 XMLString::release(&m_Lang);
131             }
132
133             localizedURITypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
134                     : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
135                 init();
136             }
137
138             localizedURITypeImpl(const localizedURITypeImpl& src)
139                     : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
140                 init();
141                 setLang(src.getLang());
142             }
143
144             IMPL_XMLOBJECT_CLONE(localizedURIType);
145             IMPL_STRING_ATTRIB(Lang);
146
147         protected:
148             void marshallAttributes(DOMElement* domElement) const {
149                 MARSHALL_STRING_ATTRIB(Lang,LANG,xmlconstants::XML_NS);
150             }
151
152             void processAttribute(const DOMAttr* attribute) {
153                 PROC_STRING_ATTRIB(Lang,LANG,xmlconstants::XML_NS);
154                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
155             }
156         };
157
158         class SAML_DLLLOCAL OrganizationNameImpl : public virtual OrganizationName, public localizedNameTypeImpl
159         {
160         public:
161             virtual ~OrganizationNameImpl() {}
162
163             OrganizationNameImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
164                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
165
166             OrganizationNameImpl(const OrganizationNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
167
168             IMPL_XMLOBJECT_CLONE(OrganizationName);
169             localizedNameType* clonelocalizedNameType() const {
170                 return new OrganizationNameImpl(*this);
171             }
172         };
173
174         class SAML_DLLLOCAL OrganizationDisplayNameImpl : public virtual OrganizationDisplayName, public localizedNameTypeImpl
175         {
176         public:
177             virtual ~OrganizationDisplayNameImpl() {}
178
179             OrganizationDisplayNameImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
180                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
181
182             OrganizationDisplayNameImpl(const OrganizationDisplayNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
183
184             IMPL_XMLOBJECT_CLONE(OrganizationDisplayName);
185             localizedNameType* clonelocalizedNameType() const {
186                 return new OrganizationDisplayNameImpl(*this);
187             }
188         };
189
190         class SAML_DLLLOCAL OrganizationURLImpl : public virtual OrganizationURL, public localizedURITypeImpl
191         {
192         public:
193             virtual ~OrganizationURLImpl() {}
194
195             OrganizationURLImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
196                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
197
198             OrganizationURLImpl(const OrganizationURLImpl& src) : AbstractXMLObject(src), localizedURITypeImpl(src) {}
199
200             IMPL_XMLOBJECT_CLONE(OrganizationURL);
201             localizedURIType* clonelocalizedURIType() const {
202                 return new OrganizationURLImpl(*this);
203             }
204         };
205
206         class SAML_DLLLOCAL ServiceNameImpl : public virtual ServiceName, public localizedNameTypeImpl
207         {
208         public:
209             virtual ~ServiceNameImpl() {}
210
211             ServiceNameImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
212                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
213
214             ServiceNameImpl(const ServiceNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
215
216             IMPL_XMLOBJECT_CLONE(ServiceName);
217             localizedNameType* clonelocalizedNameType() const {
218                 return new ServiceNameImpl(*this);
219             }
220         };
221
222         class SAML_DLLLOCAL ServiceDescriptionImpl : public virtual ServiceDescription, public localizedNameTypeImpl
223         {
224         public:
225             virtual ~ServiceDescriptionImpl() {}
226
227             ServiceDescriptionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
228                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
229
230             ServiceDescriptionImpl(const ServiceDescriptionImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
231
232             IMPL_XMLOBJECT_CLONE(ServiceDescription);
233             localizedNameType* clonelocalizedNameType() const {
234                 return new ServiceDescriptionImpl(*this);
235             }
236         };
237
238         class SAML_DLLLOCAL ExtensionsImpl : public virtual Extensions,
239             public AbstractComplexElement,
240             public AbstractDOMCachingXMLObject,
241             public AbstractXMLObjectMarshaller,
242             public AbstractXMLObjectUnmarshaller
243         {
244         public:
245             virtual ~ExtensionsImpl() {}
246
247             ExtensionsImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
248                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
249             }
250
251             ExtensionsImpl(const ExtensionsImpl& src)
252                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
253                 VectorOf(XMLObject) v=getUnknownXMLObjects();
254                 for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
255                     v.push_back((*i)->clone());
256             }
257
258             IMPL_XMLOBJECT_CLONE(Extensions);
259             IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
260
261         protected:
262             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
263                 // Unknown child.
264                 const XMLCh* nsURI=root->getNamespaceURI();
265                 if (!XMLString::equals(nsURI,SAML20MD_NS) && nsURI && *nsURI) {
266                     getUnknownXMLObjects().push_back(childXMLObject);
267                     return;
268                 }
269
270                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
271             }
272         };
273
274         class SAML_DLLLOCAL OrganizationImpl : public virtual Organization,
275             public AbstractComplexElement,
276             public AbstractAttributeExtensibleXMLObject,
277             public AbstractDOMCachingXMLObject,
278             public AbstractXMLObjectMarshaller,
279             public AbstractXMLObjectUnmarshaller
280         {
281             list<XMLObject*>::iterator m_pos_OrganizationDisplayName;
282             list<XMLObject*>::iterator m_pos_OrganizationURL;
283
284             void init() {
285                 m_children.push_back(NULL);
286                 m_children.push_back(NULL);
287                 m_children.push_back(NULL);
288                 m_Extensions=NULL;
289                 m_pos_Extensions=m_children.begin();
290                 m_pos_OrganizationDisplayName=m_pos_Extensions;
291                 ++m_pos_OrganizationDisplayName;
292                 m_pos_OrganizationURL=m_pos_OrganizationDisplayName;
293                 ++m_pos_OrganizationURL;
294             }
295         public:
296             virtual ~OrganizationImpl() {}
297
298             OrganizationImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
299                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
300                 init();
301             }
302
303             OrganizationImpl(const OrganizationImpl& src)
304                     : AbstractXMLObject(src), AbstractComplexElement(src),
305                         AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
306                 init();
307                 if (src.getExtensions())
308                     setExtensions(src.getExtensions()->cloneExtensions());
309                 VectorOf(OrganizationName) v=getOrganizationNames();
310                 for (vector<OrganizationName*>::const_iterator i=src.m_OrganizationNames.begin(); i!=src.m_OrganizationNames.end(); i++) {
311                     if (*i) {
312                         v.push_back((*i)->cloneOrganizationName());
313                     }
314                 }
315                 VectorOf(OrganizationDisplayName) w=getOrganizationDisplayNames();
316                 for (vector<OrganizationDisplayName*>::const_iterator j=src.m_OrganizationDisplayNames.begin(); j!=src.m_OrganizationDisplayNames.end(); j++) {
317                     if (*j) {
318                         w.push_back((*j)->cloneOrganizationDisplayName());
319                     }
320                 }
321                 VectorOf(OrganizationURL) x=getOrganizationURLs();
322                 for (vector<OrganizationURL*>::const_iterator k=src.m_OrganizationURLs.begin(); k!=src.m_OrganizationURLs.end(); k++) {
323                     if (*k) {
324                         x.push_back((*k)->cloneOrganizationURL());
325                     }
326                 }
327             }
328
329             IMPL_XMLOBJECT_CLONE(Organization);
330             IMPL_TYPED_CHILD(Extensions);
331             IMPL_TYPED_CHILDREN(OrganizationName,m_pos_OrganizationDisplayName);
332             IMPL_TYPED_CHILDREN(OrganizationDisplayName,m_pos_OrganizationURL);
333             IMPL_TYPED_CHILDREN(OrganizationURL,m_children.end());
334
335         protected:
336             void marshallAttributes(DOMElement* domElement) const {
337                 marshallExtensionAttributes(domElement);
338             }
339
340             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
341                 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
342                 PROC_TYPED_CHILDREN(OrganizationName,SAML20MD_NS,false);
343                 PROC_TYPED_CHILDREN(OrganizationDisplayName,SAML20MD_NS,false);
344                 PROC_TYPED_CHILDREN(OrganizationURL,SAML20MD_NS,false);
345                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
346             }
347
348             void processAttribute(const DOMAttr* attribute) {
349                 unmarshallExtensionAttribute(attribute);
350             }
351         };
352
353         class SAML_DLLLOCAL ContactPersonImpl : public virtual ContactPerson,
354             public AbstractComplexElement,
355             public AbstractAttributeExtensibleXMLObject,
356             public AbstractDOMCachingXMLObject,
357             public AbstractXMLObjectMarshaller,
358             public AbstractXMLObjectUnmarshaller
359         {
360             list<XMLObject*>::iterator m_pos_TelephoneNumber;
361
362             void init() {
363                 m_ContactType=NULL;
364                 m_children.push_back(NULL);
365                 m_children.push_back(NULL);
366                 m_children.push_back(NULL);
367                 m_children.push_back(NULL);
368                 m_children.push_back(NULL);
369                 m_Extensions=NULL;
370                 m_Company=NULL;
371                 m_GivenName=NULL;
372                 m_SurName=NULL;
373                 m_pos_Extensions=m_children.begin();
374                 m_pos_Company=m_pos_Extensions;
375                 ++m_pos_Company;
376                 m_pos_GivenName=m_pos_Company;
377                 ++m_pos_GivenName;
378                 m_pos_SurName=m_pos_GivenName;
379                 ++m_pos_SurName;
380                 m_pos_TelephoneNumber=m_pos_SurName;
381                 ++m_pos_TelephoneNumber;
382             }
383         public:
384             virtual ~ContactPersonImpl() {}
385
386             ContactPersonImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
387                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
388                 init();
389             }
390
391             ContactPersonImpl(const ContactPersonImpl& src)
392                     : AbstractXMLObject(src), AbstractComplexElement(src),
393                         AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
394                 init();
395                 if (src.getExtensions())
396                     setExtensions(src.getExtensions()->cloneExtensions());
397                 if (src.getCompany())
398                     setCompany(src.getCompany()->cloneCompany());
399                 if (src.getGivenName())
400                     setGivenName(src.getGivenName()->cloneGivenName());
401                 if (src.getSurName())
402                     setSurName(src.getSurName()->cloneSurName());
403
404                 VectorOf(EmailAddress) v=getEmailAddresss();
405                 for (vector<EmailAddress*>::const_iterator i=src.m_EmailAddresss.begin(); i!=src.m_EmailAddresss.end(); i++) {
406                     if (*i) {
407                         v.push_back((*i)->cloneEmailAddress());
408                     }
409                 }
410                 VectorOf(TelephoneNumber) w=getTelephoneNumbers();
411                 for (vector<TelephoneNumber*>::const_iterator j=src.m_TelephoneNumbers.begin(); j!=src.m_TelephoneNumbers.end(); j++) {
412                     if (*j) {
413                         w.push_back((*j)->cloneTelephoneNumber());
414                     }
415                 }
416             }
417
418             IMPL_XMLOBJECT_CLONE(ContactPerson);
419             IMPL_STRING_ATTRIB(ContactType);
420             IMPL_TYPED_CHILD(Extensions);
421             IMPL_TYPED_CHILD(Company);
422             IMPL_TYPED_CHILD(GivenName);
423             IMPL_TYPED_CHILD(SurName);
424             IMPL_TYPED_CHILDREN(EmailAddress,m_pos_TelephoneNumber);
425             IMPL_TYPED_CHILDREN(TelephoneNumber,m_children.end());
426
427             void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
428                 if (!qualifiedName.hasNamespaceURI()) {
429                     if (XMLString::equals(qualifiedName.getLocalPart(),CONTACTTYPE_ATTRIB_NAME)) {
430                         setContactType(value);
431                         return;
432                     }
433                 }
434                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
435             }
436
437         protected:
438             void marshallAttributes(DOMElement* domElement) const {
439                 MARSHALL_STRING_ATTRIB(ContactType,CONTACTTYPE,NULL);
440                 marshallExtensionAttributes(domElement);
441             }
442
443             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
444                 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
445                 PROC_TYPED_CHILD(Company,SAML20MD_NS,false);
446                 PROC_TYPED_CHILD(GivenName,SAML20MD_NS,false);
447                 PROC_TYPED_CHILD(SurName,SAML20MD_NS,false);
448                 PROC_TYPED_CHILDREN(EmailAddress,SAML20MD_NS,false);
449                 PROC_TYPED_CHILDREN(TelephoneNumber,SAML20MD_NS,false);
450                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
451             }
452
453             void processAttribute(const DOMAttr* attribute) {
454                 unmarshallExtensionAttribute(attribute);
455             }
456         };
457
458         class SAML_DLLLOCAL AdditionalMetadataLocationImpl : public virtual AdditionalMetadataLocation,
459             public AbstractSimpleElement,
460             public AbstractDOMCachingXMLObject,
461             public AbstractXMLObjectMarshaller,
462             public AbstractXMLObjectUnmarshaller
463         {
464             void init() {
465                 m_Namespace=NULL;
466             }
467
468         public:
469             virtual ~AdditionalMetadataLocationImpl() {
470                 XMLString::release(&m_Namespace);
471             }
472
473             AdditionalMetadataLocationImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
474                     : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
475                 init();
476             }
477
478             AdditionalMetadataLocationImpl(const AdditionalMetadataLocationImpl& src)
479                     : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
480                 init();
481             }
482
483             IMPL_XMLOBJECT_CLONE(AdditionalMetadataLocation);
484             IMPL_STRING_ATTRIB(Namespace);
485
486         protected:
487             void marshallAttributes(DOMElement* domElement) const {
488                 MARSHALL_STRING_ATTRIB(Namespace,NAMESPACE,NULL);
489             }
490
491             void processAttribute(const DOMAttr* attribute) {
492                 PROC_STRING_ATTRIB(Namespace,NAMESPACE,NULL);
493                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
494             }
495         };
496
497         class SAML_DLLLOCAL KeyDescriptorImpl : public virtual KeyDescriptor,
498             public AbstractComplexElement,
499             public AbstractDOMCachingXMLObject,
500             public AbstractXMLObjectMarshaller,
501             public AbstractXMLObjectUnmarshaller
502         {
503                 void init() {
504                 m_Use=NULL;
505                 m_KeyInfo=NULL;
506                 m_children.push_back(NULL);
507                 m_pos_KeyInfo=m_children.begin();
508             }
509         public:
510             virtual ~KeyDescriptorImpl() {
511                 XMLString::release(&m_Use);
512             }
513
514             KeyDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
515                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
516                 init();
517             }
518
519             KeyDescriptorImpl(const KeyDescriptorImpl& src)
520                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
521                 init();
522                 setUse(src.getUse());
523                 if (src.getKeyInfo())
524                     setKeyInfo(src.getKeyInfo()->cloneKeyInfo());
525                 VectorOf(EncryptionMethod) v=getEncryptionMethods();
526                 for (vector<EncryptionMethod*>::const_iterator i=src.m_EncryptionMethods.begin(); i!=src.m_EncryptionMethods.end(); i++) {
527                     if (*i) {
528                         v.push_back((*i)->cloneEncryptionMethod());
529                     }
530                 }
531             }
532
533             IMPL_XMLOBJECT_CLONE(KeyDescriptor);
534             IMPL_STRING_ATTRIB(Use);
535             IMPL_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature);
536             IMPL_TYPED_FOREIGN_CHILDREN(EncryptionMethod,xmlencryption,m_children.end());
537
538         protected:
539             void marshallAttributes(DOMElement* domElement) const {
540                 MARSHALL_STRING_ATTRIB(Use,USE,NULL);
541             }
542
543             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
544                 PROC_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature,XMLSIG_NS,false);
545                 PROC_TYPED_FOREIGN_CHILDREN(EncryptionMethod,xmlencryption,SAML20MD_NS,false);
546                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
547             }
548
549             void processAttribute(const DOMAttr* attribute) {
550                 PROC_STRING_ATTRIB(Use,USE,NULL);
551                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
552             }
553         };
554
555         class SAML_DLLLOCAL EndpointTypeImpl : public virtual EndpointType,
556             public AbstractAttributeExtensibleXMLObject,
557             public AbstractComplexElement,
558             public AbstractDOMCachingXMLObject,
559             public AbstractXMLObjectMarshaller,
560             public AbstractXMLObjectUnmarshaller
561         {
562             void init() {
563                 m_Binding=m_Location=m_ResponseLocation=NULL;
564             }
565
566         protected:
567             EndpointTypeImpl() {
568                 init();
569             }
570
571         public:
572             virtual ~EndpointTypeImpl() {
573                 XMLString::release(&m_Binding);
574                 XMLString::release(&m_Location);
575                 XMLString::release(&m_ResponseLocation);
576             }
577
578             EndpointTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
579                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
580             }
581
582             EndpointTypeImpl(const EndpointTypeImpl& src)
583                     : AbstractXMLObject(src),
584                         AbstractAttributeExtensibleXMLObject(src),
585                         AbstractComplexElement(src),
586                         AbstractDOMCachingXMLObject(src) {
587                 setBinding(src.getBinding());
588                 setLocation(src.getLocation());
589                 setResponseLocation(src.getResponseLocation());
590                 VectorOf(XMLObject) v=getUnknownXMLObjects();
591                 for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
592                     v.push_back((*i)->clone());
593             }
594
595             IMPL_XMLOBJECT_CLONE(EndpointType);
596             IMPL_STRING_ATTRIB(Binding);
597             IMPL_STRING_ATTRIB(Location);
598             IMPL_STRING_ATTRIB(ResponseLocation);
599             IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
600
601             void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
602                 if (!qualifiedName.hasNamespaceURI()) {
603                     if (XMLString::equals(qualifiedName.getLocalPart(),BINDING_ATTRIB_NAME)) {
604                         setBinding(value);
605                         return;
606                     }
607                     else if (XMLString::equals(qualifiedName.getLocalPart(),LOCATION_ATTRIB_NAME)) {
608                         setLocation(value);
609                         return;
610                     }
611                     else if (XMLString::equals(qualifiedName.getLocalPart(),RESPONSELOCATION_ATTRIB_NAME)) {
612                         setResponseLocation(value);
613                         return;
614                     }
615                 }
616                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
617             }
618         protected:
619             void marshallAttributes(DOMElement* domElement) const {
620                 MARSHALL_STRING_ATTRIB(Binding,BINDING,NULL);
621                 MARSHALL_STRING_ATTRIB(Location,LOCATION,NULL);
622                 MARSHALL_STRING_ATTRIB(ResponseLocation,RESPONSELOCATION,NULL);
623                 marshallExtensionAttributes(domElement);
624             }
625
626             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
627                 // Unknown child.
628                 const XMLCh* nsURI=root->getNamespaceURI();
629                 if (!XMLString::equals(nsURI,SAML20MD_NS) && nsURI && *nsURI) {
630                     getUnknownXMLObjects().push_back(childXMLObject);
631                     return;
632                 }
633                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
634             }
635
636             void processAttribute(const DOMAttr* attribute) {
637                 unmarshallExtensionAttribute(attribute);
638             }
639         };
640
641         class SAML_DLLLOCAL IndexedEndpointTypeImpl : public virtual IndexedEndpointType, public EndpointTypeImpl
642         {
643             void init() {
644                 m_Index=NULL;
645                 m_isDefault=XML_BOOL_NULL;
646             }
647
648         protected:
649             IndexedEndpointTypeImpl() {
650                 init();
651             }
652         public:
653             virtual ~IndexedEndpointTypeImpl() {
654                 XMLString::release(&m_Index);
655             }
656
657             IndexedEndpointTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
658                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
659
660             IndexedEndpointTypeImpl(const IndexedEndpointTypeImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {
661                 setIndex(src.m_Index);
662                 isDefault(src.m_isDefault);
663             }
664
665             IMPL_XMLOBJECT_CLONE(IndexedEndpointType);
666             EndpointType* cloneEndpointType() const {
667                 return new IndexedEndpointTypeImpl(*this);
668             }
669
670             IMPL_INTEGER_ATTRIB(Index);
671             IMPL_BOOLEAN_ATTRIB(isDefault);
672
673             void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
674                 if (!qualifiedName.hasNamespaceURI()) {
675                     if (XMLString::equals(qualifiedName.getLocalPart(),INDEX_ATTRIB_NAME)) {
676                         setIndex(value);
677                         return;
678                     }
679                     else if (XMLString::equals(qualifiedName.getLocalPart(),ISDEFAULT_ATTRIB_NAME)) {
680                         setisDefault(value);
681                         return;
682                     }
683                 }
684                 EndpointTypeImpl::setAttribute(qualifiedName, value, ID);
685             }
686
687         protected:
688             void marshallAttributes(DOMElement* domElement) const {
689                 MARSHALL_INTEGER_ATTRIB(Index,INDEX,NULL);
690                 MARSHALL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,NULL);
691                 EndpointTypeImpl::marshallAttributes(domElement);
692             }
693         };
694
695         class SAML_DLLLOCAL ArtifactResolutionServiceImpl : public virtual ArtifactResolutionService, public IndexedEndpointTypeImpl
696         {
697         public:
698             virtual ~ArtifactResolutionServiceImpl() {}
699
700             ArtifactResolutionServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
701                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
702
703             ArtifactResolutionServiceImpl(const ArtifactResolutionServiceImpl& src) : AbstractXMLObject(src), IndexedEndpointTypeImpl(src) {}
704
705             IMPL_XMLOBJECT_CLONE(ArtifactResolutionService);
706             IndexedEndpointType* cloneIndexedEndpointType() const {
707                 return new ArtifactResolutionServiceImpl(*this);
708             }
709             EndpointType* cloneEndpointType() const {
710                 return new ArtifactResolutionServiceImpl(*this);
711             }
712         };
713
714         class SAML_DLLLOCAL SingleLogoutServiceImpl : public virtual SingleLogoutService, public EndpointTypeImpl
715         {
716         public:
717             virtual ~SingleLogoutServiceImpl() {}
718
719             SingleLogoutServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
720                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
721
722             SingleLogoutServiceImpl(const SingleLogoutServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
723
724             IMPL_XMLOBJECT_CLONE(SingleLogoutService);
725             EndpointType* cloneEndpointType() const {
726                 return new SingleLogoutServiceImpl(*this);
727             }
728         };
729
730         class SAML_DLLLOCAL ManageNameIDServiceImpl : public virtual ManageNameIDService, public EndpointTypeImpl
731         {
732         public:
733             virtual ~ManageNameIDServiceImpl() {}
734
735             ManageNameIDServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
736                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
737
738             ManageNameIDServiceImpl(const ManageNameIDServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
739
740             IMPL_XMLOBJECT_CLONE(ManageNameIDService);
741             EndpointType* cloneEndpointType() const {
742                 return new ManageNameIDServiceImpl(*this);
743             }
744         };
745
746         class SAML_DLLLOCAL SingleSignOnServiceImpl : public virtual SingleSignOnService, public EndpointTypeImpl
747         {
748         public:
749             virtual ~SingleSignOnServiceImpl() {}
750
751             SingleSignOnServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
752                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
753
754             SingleSignOnServiceImpl(const SingleSignOnServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
755
756             IMPL_XMLOBJECT_CLONE(SingleSignOnService);
757             EndpointType* cloneEndpointType() const {
758                 return new SingleSignOnServiceImpl(*this);
759             }
760         };
761
762         class SAML_DLLLOCAL NameIDMappingServiceImpl : public virtual NameIDMappingService, public EndpointTypeImpl
763         {
764         public:
765             virtual ~NameIDMappingServiceImpl() {}
766
767             NameIDMappingServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
768                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
769
770             NameIDMappingServiceImpl(const NameIDMappingServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
771
772             IMPL_XMLOBJECT_CLONE(NameIDMappingService);
773             EndpointType* cloneEndpointType() const {
774                 return new NameIDMappingServiceImpl(*this);
775             }
776         };
777
778         class SAML_DLLLOCAL AssertionIDRequestServiceImpl : public virtual AssertionIDRequestService, public EndpointTypeImpl
779         {
780         public:
781             virtual ~AssertionIDRequestServiceImpl() {}
782
783             AssertionIDRequestServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
784                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
785
786             AssertionIDRequestServiceImpl(const AssertionIDRequestServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
787
788             IMPL_XMLOBJECT_CLONE(AssertionIDRequestService);
789             EndpointType* cloneEndpointType() const {
790                 return new AssertionIDRequestServiceImpl(*this);
791             }
792         };
793
794         class SAML_DLLLOCAL AssertionConsumerServiceImpl : public virtual AssertionConsumerService, public IndexedEndpointTypeImpl
795         {
796         public:
797             virtual ~AssertionConsumerServiceImpl() {}
798
799             AssertionConsumerServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
800                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
801
802             AssertionConsumerServiceImpl(const AssertionConsumerServiceImpl& src) : AbstractXMLObject(src), IndexedEndpointTypeImpl(src) {}
803
804             IMPL_XMLOBJECT_CLONE(AssertionConsumerService);
805             EndpointType* cloneEndpointType() const {
806                 return new AssertionConsumerServiceImpl(*this);
807             }
808             IndexedEndpointType* cloneIndexedEndpointType() const {
809                 return new AssertionConsumerServiceImpl(*this);
810             }
811         };
812
813         class SAML_DLLLOCAL AuthnQueryServiceImpl : public virtual AuthnQueryService, public EndpointTypeImpl
814         {
815         public:
816             virtual ~AuthnQueryServiceImpl() {}
817
818             AuthnQueryServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
819                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
820
821             AuthnQueryServiceImpl(const AuthnQueryServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
822
823             IMPL_XMLOBJECT_CLONE(AuthnQueryService);
824             EndpointType* cloneEndpointType() const {
825                 return new AuthnQueryServiceImpl(*this);
826             }
827         };
828
829         class SAML_DLLLOCAL AuthzServiceImpl : public virtual AuthzService, public EndpointTypeImpl
830         {
831         public:
832             virtual ~AuthzServiceImpl() {}
833
834             AuthzServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
835                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
836
837             AuthzServiceImpl(const AuthzServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
838
839             IMPL_XMLOBJECT_CLONE(AuthzService);
840             EndpointType* cloneEndpointType() const {
841                 return new AuthzServiceImpl(*this);
842             }
843         };
844
845         class SAML_DLLLOCAL AttributeServiceImpl : public virtual AttributeService, public EndpointTypeImpl
846         {
847         public:
848             virtual ~AttributeServiceImpl() {}
849
850             AttributeServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
851                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
852
853             AttributeServiceImpl(const AttributeServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
854
855             IMPL_XMLOBJECT_CLONE(AttributeService);
856             EndpointType* cloneEndpointType() const {
857                 return new AttributeServiceImpl(*this);
858             }
859         };
860
861         class SAML_DLLLOCAL RoleDescriptorImpl : public virtual RoleDescriptor,
862             public virtual SignableObject,
863             public AbstractComplexElement,
864             public AbstractAttributeExtensibleXMLObject,
865             public AbstractDOMCachingXMLObject,
866             public AbstractXMLObjectMarshaller,
867             public AbstractXMLObjectUnmarshaller
868         {
869             void init() {
870                 m_ID=m_ProtocolSupportEnumeration=m_ErrorURL=NULL;
871                 m_ValidUntil=m_CacheDuration=NULL;
872                 m_children.push_back(NULL);
873                 m_children.push_back(NULL);
874                 m_children.push_back(NULL);
875                 m_children.push_back(NULL);
876                 m_Signature=NULL;
877                 m_Extensions=NULL;
878                 m_Organization=NULL;
879                 m_pos_Signature=m_children.begin();
880                 m_pos_Extensions=m_pos_Signature;
881                 ++m_pos_Extensions;
882                 m_pos_Organization=m_pos_Extensions;
883                 ++m_pos_Organization;
884                 m_pos_ContactPerson=m_pos_Organization;
885                 ++m_pos_ContactPerson;
886             }
887
888         protected:
889             list<XMLObject*>::iterator m_pos_ContactPerson;
890
891             RoleDescriptorImpl() {
892                 init();
893             }
894
895         public:
896             virtual ~RoleDescriptorImpl() {
897                 XMLString::release(&m_ID);
898                 XMLString::release(&m_ProtocolSupportEnumeration);
899                 XMLString::release(&m_ErrorURL);
900                 delete m_ValidUntil;
901                 delete m_CacheDuration;
902             }
903
904             RoleDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
905                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
906                 init();
907             }
908
909             RoleDescriptorImpl(const RoleDescriptorImpl& src)
910                     : AbstractXMLObject(src), AbstractComplexElement(src),
911                         AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
912                 init();
913                 setID(src.getID());
914                 setProtocolSupportEnumeration(src.getProtocolSupportEnumeration());
915                 setErrorURL(src.getErrorURL());
916                 setValidUntil(src.getValidUntil());
917                 setCacheDuration(src.getCacheDuration());
918                 if (src.getSignature())
919                     setSignature(src.getSignature()->cloneSignature());
920                 if (src.getExtensions())
921                     setExtensions(src.getExtensions()->cloneExtensions());
922                 if (src.getOrganization())
923                     setOrganization(src.getOrganization()->cloneOrganization());
924
925                 VectorOf(KeyDescriptor) v=getKeyDescriptors();
926                 for (vector<KeyDescriptor*>::const_iterator i=src.m_KeyDescriptors.begin(); i!=src.m_KeyDescriptors.end(); i++) {
927                     if (*i) {
928                         v.push_back((*i)->cloneKeyDescriptor());
929                     }
930                 }
931                 VectorOf(ContactPerson) w=getContactPersons();
932                 for (vector<ContactPerson*>::const_iterator j=src.m_ContactPersons.begin(); j!=src.m_ContactPersons.end(); j++) {
933                     if (*j) {
934                         w.push_back((*j)->cloneContactPerson());
935                     }
936                 }
937             }
938
939             //IMPL_TYPED_CHILD(Signature);
940             // Need customized setter.
941         protected:
942             Signature* m_Signature;
943             list<XMLObject*>::iterator m_pos_Signature;
944         public:
945             Signature* getSignature() const {
946                 return m_Signature;
947             }
948
949             void setSignature(Signature* sig) {
950                 prepareForAssignment(m_Signature,sig);
951                 *m_pos_Signature=m_Signature=sig;
952                 // Sync content reference back up.
953                 if (m_Signature)
954                     m_Signature->setContentReference(new opensaml::ContentReference(*this));
955             }
956
957             IMPL_ID_ATTRIB(ID);
958             IMPL_STRING_ATTRIB(ProtocolSupportEnumeration);
959             IMPL_STRING_ATTRIB(ErrorURL);
960             IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
961             IMPL_DURATION_ATTRIB(CacheDuration,0);
962             IMPL_TYPED_CHILD(Extensions);
963             IMPL_TYPED_CHILDREN(KeyDescriptor,m_pos_Organization);
964             IMPL_TYPED_CHILD(Organization);
965             IMPL_TYPED_CHILDREN(ContactPerson,m_pos_ContactPerson);
966
967             bool hasSupport(const XMLCh* protocol) const {
968                 if (!protocol || !*protocol)
969                     return true;
970                 if (m_ProtocolSupportEnumeration) {
971                     // Look for first character.
972                     unsigned int len=XMLString::stringLen(protocol);
973                     unsigned int pos=0;
974                     int index=XMLString::indexOf(m_ProtocolSupportEnumeration,protocol[0],pos);
975                     while (index>=0) {
976                         // Only possible match is if it's the first character or a space comes before it.
977                         if (index==0 || m_ProtocolSupportEnumeration[index-1]==chSpace) {
978                             // See if rest of protocol string is present.
979                             if (0==XMLString::compareNString(m_ProtocolSupportEnumeration+index+1,protocol+1,len-1)) {
980                                 // Only possible match is if it's the last character or a space comes after it.
981                                 if (m_ProtocolSupportEnumeration[index+len]==chNull || m_ProtocolSupportEnumeration[index+len]==chSpace)
982                                     return true;
983                                 else
984                                     pos=index+len;
985                             }
986                             else {
987                                 // Move past last search and start again.
988                                 pos=index+1;
989                             }
990                         }
991                         else {
992                             // Move past last search and start again.
993                             pos=index+1;
994                         }
995                         index=XMLString::indexOf(m_ProtocolSupportEnumeration,protocol[0],pos);
996                     }
997                 }
998                 return false;
999             }
1000
1001             void addSupport(const XMLCh* protocol) {
1002                 if (hasSupport(protocol))
1003                     return;
1004                 if (m_ProtocolSupportEnumeration && *m_ProtocolSupportEnumeration) {
1005 #ifdef HAVE_GOOD_STL
1006                     xstring pse(m_ProtocolSupportEnumeration);
1007                     pse = pse + chSpace + protocol;
1008                     setProtocolSupportEnumeration(pse.c_str());
1009 #else
1010                     auto_ptr_char temp(m_ProtocolSupportEnumeration);
1011                     auto_ptr_char temp2(protocol);
1012                     string pse(temp.get());
1013                     pse = pse + ' ' + temp2.get();
1014                     auto_ptr_XMLCh temp3(pse.c_str());
1015                     setProtocolSupportEnumeration(temp3.get());
1016 #endif
1017                 }
1018                 else {
1019                     setProtocolSupportEnumeration(protocol);
1020                 }
1021             }
1022
1023             void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
1024                 if (!qualifiedName.hasNamespaceURI()) {
1025                     if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) {
1026                         setID(value);
1027                         return;
1028                     }
1029                     else if (XMLString::equals(qualifiedName.getLocalPart(),PROTOCOLSUPPORTENUMERATION_ATTRIB_NAME)) {
1030                         setProtocolSupportEnumeration(value);
1031                         return;
1032                     }
1033                     else if (XMLString::equals(qualifiedName.getLocalPart(),ERRORURL_ATTRIB_NAME)) {
1034                         setErrorURL(value);
1035                         return;
1036                     }
1037                     else if (XMLString::equals(qualifiedName.getLocalPart(),VALIDUNTIL_ATTRIB_NAME)) {
1038                         setValidUntil(value);
1039                         return;
1040                     }
1041                     else if (XMLString::equals(qualifiedName.getLocalPart(),CACHEDURATION_ATTRIB_NAME)) {
1042                         setCacheDuration(value);
1043                         return;
1044                     }
1045                 }
1046                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
1047             }
1048
1049         protected:
1050             void marshallAttributes(DOMElement* domElement) const {
1051                 MARSHALL_ID_ATTRIB(ID,ID,NULL);
1052                 MARSHALL_STRING_ATTRIB(ProtocolSupportEnumeration,PROTOCOLSUPPORTENUMERATION,NULL);
1053                 MARSHALL_STRING_ATTRIB(ErrorURL,ERRORURL,NULL);
1054                 MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,NULL);
1055                 MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,NULL);
1056                 marshallExtensionAttributes(domElement);
1057             }
1058
1059             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1060                 PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLSIG_NS,false);
1061                 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
1062                 PROC_TYPED_CHILDREN(KeyDescriptor,SAML20MD_NS,false);
1063                 PROC_TYPED_CHILD(Organization,SAML20MD_NS,false);
1064                 PROC_TYPED_CHILDREN(ContactPerson,SAML20MD_NS,false);
1065                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
1066             }
1067
1068             void processAttribute(const DOMAttr* attribute) {
1069                 PROC_ID_ATTRIB(ID,ID,NULL);
1070                 unmarshallExtensionAttribute(attribute);
1071             }
1072         };
1073
1074         class SAML_DLLLOCAL RoleDescriptorTypeImpl : public virtual RoleDescriptorType, public RoleDescriptorImpl
1075         {
1076         public:
1077             virtual ~RoleDescriptorTypeImpl() {}
1078
1079             RoleDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1080                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1081             }
1082
1083             RoleDescriptorTypeImpl(const RoleDescriptorTypeImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1084                 VectorOf(XMLObject) v=getUnknownXMLObjects();
1085                 for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
1086                     v.push_back((*i)->clone());
1087             }
1088
1089             IMPL_XMLOBJECT_CLONE(RoleDescriptorType);
1090             RoleDescriptor* cloneRoleDescriptor() const {
1091                 return new RoleDescriptorTypeImpl(*this);
1092             }
1093
1094             IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
1095
1096         protected:
1097             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1098                 getUnknownXMLObjects().push_back(childXMLObject);
1099             }
1100         };
1101
1102         class SAML_DLLLOCAL SSODescriptorTypeImpl : public virtual SSODescriptorType, public RoleDescriptorImpl
1103         {
1104             void init() {
1105                 m_children.push_back(NULL);
1106                 m_children.push_back(NULL);
1107                 m_children.push_back(NULL);
1108                 m_children.push_back(NULL);
1109                 m_pos_ArtifactResolutionService=m_pos_ContactPerson;
1110                 ++m_pos_ArtifactResolutionService;
1111                 m_pos_SingleLogoutService=m_pos_ArtifactResolutionService;
1112                 ++m_pos_SingleLogoutService;
1113                 m_pos_ManageNameIDService=m_pos_SingleLogoutService;
1114                 ++m_pos_ManageNameIDService;
1115                 m_pos_NameIDFormat=m_pos_ManageNameIDService;
1116                 ++m_pos_NameIDFormat;
1117             }
1118
1119         protected:
1120             list<XMLObject*>::iterator m_pos_ArtifactResolutionService;
1121             list<XMLObject*>::iterator m_pos_SingleLogoutService;
1122             list<XMLObject*>::iterator m_pos_ManageNameIDService;
1123             list<XMLObject*>::iterator m_pos_NameIDFormat;
1124
1125             SSODescriptorTypeImpl() {
1126                 init();
1127             }
1128
1129         public:
1130             virtual ~SSODescriptorTypeImpl() {}
1131
1132             SSODescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1133                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1134                 init();
1135             }
1136
1137             SSODescriptorTypeImpl(const SSODescriptorTypeImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1138                 init();
1139                 VectorOf(ArtifactResolutionService) v=getArtifactResolutionServices();
1140                 for (vector<ArtifactResolutionService*>::const_iterator i=src.m_ArtifactResolutionServices.begin(); i!=src.m_ArtifactResolutionServices.end(); i++) {
1141                     if (*i) {
1142                         v.push_back((*i)->cloneArtifactResolutionService());
1143                     }
1144                 }
1145                 VectorOf(SingleLogoutService) w=getSingleLogoutServices();
1146                 for (vector<SingleLogoutService*>::const_iterator j=src.m_SingleLogoutServices.begin(); j!=src.m_SingleLogoutServices.end(); j++) {
1147                     if (*j) {
1148                         w.push_back((*j)->cloneSingleLogoutService());
1149                     }
1150                 }
1151                 VectorOf(ManageNameIDService) x=getManageNameIDServices();
1152                 for (vector<ManageNameIDService*>::const_iterator k=src.m_ManageNameIDServices.begin(); k!=src.m_ManageNameIDServices.end(); k++) {
1153                     if (*k) {
1154                         x.push_back((*k)->cloneManageNameIDService());
1155                     }
1156                 }
1157                 VectorOf(NameIDFormat) y=getNameIDFormats();
1158                 for (vector<NameIDFormat*>::const_iterator m=src.m_NameIDFormats.begin(); m!=src.m_NameIDFormats.end(); m++) {
1159                     if (*m) {
1160                         y.push_back((*m)->cloneNameIDFormat());
1161                     }
1162                 }
1163             }
1164
1165             IMPL_TYPED_CHILDREN(ArtifactResolutionService,m_pos_ArtifactResolutionService);
1166             IMPL_TYPED_CHILDREN(SingleLogoutService,m_pos_SingleLogoutService);
1167             IMPL_TYPED_CHILDREN(ManageNameIDService,m_pos_ManageNameIDService);
1168             IMPL_TYPED_CHILDREN(NameIDFormat,m_pos_NameIDFormat);
1169
1170         protected:
1171             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1172                 PROC_TYPED_CHILDREN(ArtifactResolutionService,SAML20MD_NS,false);
1173                 PROC_TYPED_CHILDREN(SingleLogoutService,SAML20MD_NS,false);
1174                 PROC_TYPED_CHILDREN(ManageNameIDService,SAML20MD_NS,false);
1175                 PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
1176                 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1177             }
1178         };
1179
1180         class SAML_DLLLOCAL IDPSSODescriptorImpl : public virtual IDPSSODescriptor, public SSODescriptorTypeImpl
1181         {
1182             list<XMLObject*>::iterator m_pos_SingleSignOnService;
1183             list<XMLObject*>::iterator m_pos_NameIDMappingService;
1184             list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
1185             list<XMLObject*>::iterator m_pos_AttributeProfile;
1186
1187             void init() {
1188                 m_WantAuthnRequestsSigned=XML_BOOL_NULL;
1189                 m_children.push_back(NULL);
1190                 m_children.push_back(NULL);
1191                 m_children.push_back(NULL);
1192                 m_children.push_back(NULL);
1193                 m_pos_SingleSignOnService=m_pos_NameIDFormat;
1194                 ++m_pos_SingleSignOnService;
1195                 m_pos_NameIDMappingService=m_pos_SingleSignOnService;
1196                 ++m_pos_NameIDMappingService;
1197                 m_pos_AssertionIDRequestService=m_pos_NameIDMappingService;
1198                 ++m_pos_AssertionIDRequestService;
1199                 m_pos_AttributeProfile=m_pos_AssertionIDRequestService;
1200                 ++m_pos_AttributeProfile;
1201             }
1202
1203         public:
1204             virtual ~IDPSSODescriptorImpl() {}
1205
1206             IDPSSODescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1207                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1208                 init();
1209             }
1210
1211             IDPSSODescriptorImpl(const IDPSSODescriptorImpl& src) : AbstractXMLObject(src), SSODescriptorTypeImpl(src) {
1212                 init();
1213                 WantAuthnRequestsSigned(src.m_WantAuthnRequestsSigned);
1214                 VectorOf(SingleSignOnService) v=getSingleSignOnServices();
1215                 for (vector<SingleSignOnService*>::const_iterator i=src.m_SingleSignOnServices.begin(); i!=src.m_SingleSignOnServices.end(); i++) {
1216                     if (*i) {
1217                         v.push_back((*i)->cloneSingleSignOnService());
1218                     }
1219                 }
1220                 VectorOf(NameIDMappingService) w=getNameIDMappingServices();
1221                 for (vector<NameIDMappingService*>::const_iterator j=src.m_NameIDMappingServices.begin(); j!=src.m_NameIDMappingServices.end(); j++) {
1222                     if (*j) {
1223                         w.push_back((*j)->cloneNameIDMappingService());
1224                     }
1225                 }
1226                 VectorOf(AssertionIDRequestService) x=getAssertionIDRequestServices();
1227                 for (vector<AssertionIDRequestService*>::const_iterator k=src.m_AssertionIDRequestServices.begin(); k!=src.m_AssertionIDRequestServices.end(); k++) {
1228                     if (*k) {
1229                         x.push_back((*k)->cloneAssertionIDRequestService());
1230                     }
1231                 }
1232                 VectorOf(AttributeProfile) y=getAttributeProfiles();
1233                 for (vector<AttributeProfile*>::const_iterator m=src.m_AttributeProfiles.begin(); m!=src.m_AttributeProfiles.end(); m++) {
1234                     if (*m) {
1235                         y.push_back((*m)->cloneAttributeProfile());
1236                     }
1237                 }
1238                 VectorOf(Attribute) z=getAttributes();
1239                 for (vector<Attribute*>::const_iterator n=src.m_Attributes.begin(); n!=src.m_Attributes.end(); n++) {
1240                     if (*n) {
1241                         z.push_back((*n)->cloneAttribute());
1242                     }
1243                 }
1244             }
1245
1246             IMPL_XMLOBJECT_CLONE(IDPSSODescriptor);
1247             SSODescriptorType* cloneSSODescriptorType() const {
1248                 return new IDPSSODescriptorImpl(*this);
1249             }
1250             RoleDescriptor* cloneRoleDescriptor() const {
1251                 return new IDPSSODescriptorImpl(*this);
1252             }
1253
1254             IMPL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned);
1255             IMPL_TYPED_CHILDREN(SingleSignOnService,m_pos_SingleSignOnService);
1256             IMPL_TYPED_CHILDREN(NameIDMappingService,m_pos_NameIDMappingService);
1257             IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
1258             IMPL_TYPED_CHILDREN(AttributeProfile,m_pos_AttributeProfile);
1259             IMPL_TYPED_FOREIGN_CHILDREN(Attribute,saml2,m_children.end());
1260
1261             void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
1262                 if (!qualifiedName.hasNamespaceURI()) {
1263                     if (XMLString::equals(qualifiedName.getLocalPart(),WANTAUTHNREQUESTSSIGNED_ATTRIB_NAME)) {
1264                         setWantAuthnRequestsSigned(value);
1265                         return;
1266                     }
1267                 }
1268                 RoleDescriptorImpl::setAttribute(qualifiedName, value, ID);
1269             }
1270
1271         protected:
1272             void marshallAttributes(DOMElement* domElement) const {
1273                 MARSHALL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned,WANTAUTHNREQUESTSSIGNED,NULL);
1274                 RoleDescriptorImpl::marshallAttributes(domElement);
1275             }
1276
1277             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1278                 PROC_TYPED_CHILDREN(SingleSignOnService,SAML20MD_NS,false);
1279                 PROC_TYPED_CHILDREN(NameIDMappingService,SAML20MD_NS,false);
1280                 PROC_TYPED_CHILDREN(AssertionIDRequestService,SAML20MD_NS,false);
1281                 PROC_TYPED_CHILDREN(AttributeProfile,SAML20MD_NS,false);
1282                 PROC_TYPED_FOREIGN_CHILDREN(Attribute,saml2,SAML20_NS,false);
1283                 SSODescriptorTypeImpl::processChildElement(childXMLObject,root);
1284             }
1285         };
1286
1287         class SAML_DLLLOCAL RequestedAttributeImpl : public virtual RequestedAttribute,
1288             public AbstractComplexElement,
1289             public AbstractAttributeExtensibleXMLObject,
1290             public AbstractDOMCachingXMLObject,
1291             public AbstractXMLObjectMarshaller,
1292             public AbstractXMLObjectUnmarshaller
1293         {
1294             void init() {
1295                 m_Name=m_NameFormat=m_FriendlyName=NULL;
1296                 m_isRequired=XML_BOOL_NULL;
1297             }
1298         public:
1299             virtual ~RequestedAttributeImpl() {
1300                 XMLString::release(&m_Name);
1301                 XMLString::release(&m_NameFormat);
1302                 XMLString::release(&m_FriendlyName);
1303             }
1304
1305             RequestedAttributeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1306                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1307                 init();
1308             }
1309
1310             RequestedAttributeImpl(const RequestedAttributeImpl& src)
1311                     : AbstractXMLObject(src), AbstractComplexElement(src),
1312                         AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
1313                 init();
1314                 setName(src.getName());
1315                 setNameFormat(src.getNameFormat());
1316                 setFriendlyName(src.getFriendlyName());
1317                 isRequired(src.m_isRequired);
1318                 VectorOf(XMLObject) v=getAttributeValues();
1319                 for (vector<XMLObject*>::const_iterator i=src.m_AttributeValues.begin(); i!=src.m_AttributeValues.end(); i++) {
1320                     if (*i) {
1321                         v.push_back((*i)->clone());
1322                     }
1323                 }
1324             }
1325
1326             IMPL_XMLOBJECT_CLONE(RequestedAttribute);
1327             Attribute* cloneAttribute() const {
1328                 return new RequestedAttributeImpl(*this);
1329             }
1330
1331             IMPL_STRING_ATTRIB(Name);
1332             IMPL_STRING_ATTRIB(NameFormat);
1333             IMPL_STRING_ATTRIB(FriendlyName);
1334             IMPL_BOOLEAN_ATTRIB(isRequired);
1335             IMPL_XMLOBJECT_CHILDREN(AttributeValue,m_children.end());
1336
1337             void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
1338                 if (!qualifiedName.hasNamespaceURI()) {
1339                     if (XMLString::equals(qualifiedName.getLocalPart(),NAME_ATTRIB_NAME)) {
1340                         setName(value);
1341                         return;
1342                     }
1343                     else if (XMLString::equals(qualifiedName.getLocalPart(),NAMEFORMAT_ATTRIB_NAME)) {
1344                         setNameFormat(value);
1345                         return;
1346                     }
1347                     else if (XMLString::equals(qualifiedName.getLocalPart(),FRIENDLYNAME_ATTRIB_NAME)) {
1348                         setFriendlyName(value);
1349                         return;
1350                     }
1351                     else if (XMLString::equals(qualifiedName.getLocalPart(),ISREQUIRED_ATTRIB_NAME)) {
1352                         setisRequired(value);
1353                         return;
1354                     }
1355                 }
1356                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
1357             }
1358
1359         protected:
1360             void marshallAttributes(DOMElement* domElement) const {
1361                 MARSHALL_STRING_ATTRIB(Name,NAME,NULL);
1362                 MARSHALL_STRING_ATTRIB(NameFormat,NAMEFORMAT,NULL);
1363                 MARSHALL_STRING_ATTRIB(FriendlyName,FRIENDLYNAME,NULL);
1364                 MARSHALL_BOOLEAN_ATTRIB(isRequired,ISREQUIRED,NULL);
1365                 marshallExtensionAttributes(domElement);
1366             }
1367
1368             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1369                 getAttributeValues().push_back(childXMLObject);
1370             }
1371
1372             void processAttribute(const DOMAttr* attribute) {
1373                 unmarshallExtensionAttribute(attribute);
1374             }
1375         };
1376
1377         class SAML_DLLLOCAL AttributeConsumingServiceImpl : public virtual AttributeConsumingService,
1378             public AbstractComplexElement,
1379             public AbstractDOMCachingXMLObject,
1380             public AbstractXMLObjectMarshaller,
1381             public AbstractXMLObjectUnmarshaller
1382         {
1383             list<XMLObject*>::iterator m_pos_ServiceDescription;
1384             list<XMLObject*>::iterator m_pos_RequestedAttribute;
1385
1386                 void init() {
1387                 m_Index=NULL;
1388                 m_isDefault=XML_BOOL_NULL;
1389                 m_children.push_back(NULL);
1390                 m_children.push_back(NULL);
1391                 m_pos_ServiceDescription=m_children.begin();
1392                 m_pos_RequestedAttribute=m_pos_ServiceDescription;
1393                 ++m_pos_RequestedAttribute;
1394             }
1395
1396         public:
1397             virtual ~AttributeConsumingServiceImpl() {
1398                 XMLString::release(&m_Index);
1399             }
1400
1401             AttributeConsumingServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1402                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1403                 init();
1404             }
1405
1406             AttributeConsumingServiceImpl(const AttributeConsumingServiceImpl& src)
1407                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
1408                 init();
1409                 setIndex(src.m_Index);
1410                 isDefault(src.m_isDefault);
1411                 VectorOf(ServiceName) v=getServiceNames();
1412                 for (vector<ServiceName*>::const_iterator i=src.m_ServiceNames.begin(); i!=src.m_ServiceNames.end(); i++) {
1413                     if (*i) {
1414                         v.push_back((*i)->cloneServiceName());
1415                     }
1416                 }
1417                 VectorOf(ServiceDescription) w=getServiceDescriptions();
1418                 for (vector<ServiceDescription*>::const_iterator j=src.m_ServiceDescriptions.begin(); j!=src.m_ServiceDescriptions.end(); j++) {
1419                     if (*j) {
1420                         w.push_back((*j)->cloneServiceDescription());
1421                     }
1422                 }
1423                 VectorOf(RequestedAttribute) x=getRequestedAttributes();
1424                 for (vector<RequestedAttribute*>::const_iterator k=src.m_RequestedAttributes.begin(); k!=src.m_RequestedAttributes.end(); k++) {
1425                     if (*k) {
1426                         x.push_back((*k)->cloneRequestedAttribute());
1427                     }
1428                 }
1429             }
1430
1431             IMPL_XMLOBJECT_CLONE(AttributeConsumingService);
1432             IMPL_INTEGER_ATTRIB(Index);
1433             IMPL_BOOLEAN_ATTRIB(isDefault);
1434             IMPL_TYPED_CHILDREN(ServiceName,m_pos_ServiceDescription);
1435             IMPL_TYPED_CHILDREN(ServiceDescription,m_pos_RequestedAttribute);
1436             IMPL_TYPED_CHILDREN(RequestedAttribute,m_children.end());
1437
1438         protected:
1439             void marshallAttributes(DOMElement* domElement) const {
1440                 MARSHALL_INTEGER_ATTRIB(Index,INDEX,NULL);
1441                 MARSHALL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,NULL);
1442             }
1443
1444             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1445                 PROC_TYPED_CHILDREN(ServiceName,SAML20MD_NS,false);
1446                 PROC_TYPED_CHILDREN(ServiceDescription,SAML20MD_NS,false);
1447                 PROC_TYPED_CHILDREN(RequestedAttribute,SAML20MD_NS,false);
1448                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
1449             }
1450
1451             void processAttribute(const DOMAttr* attribute) {
1452                 PROC_INTEGER_ATTRIB(Index,INDEX,NULL);
1453                 PROC_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,NULL);
1454                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
1455             }
1456         };
1457
1458         class SAML_DLLLOCAL SPSSODescriptorImpl : public virtual SPSSODescriptor, public SSODescriptorTypeImpl
1459         {
1460             list<XMLObject*>::iterator m_pos_AssertionConsumerService;
1461
1462             void init() {
1463                 m_AuthnRequestsSigned=XML_BOOL_NULL;
1464                 m_WantAssertionsSigned=XML_BOOL_NULL;
1465                 m_children.push_back(NULL);
1466                 m_pos_AssertionConsumerService=m_pos_NameIDFormat;
1467                 ++m_pos_AssertionConsumerService;
1468             }
1469
1470         public:
1471             virtual ~SPSSODescriptorImpl() {}
1472
1473             SPSSODescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1474                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1475                 init();
1476             }
1477
1478             SPSSODescriptorImpl(const SPSSODescriptorImpl& src) : AbstractXMLObject(src), SSODescriptorTypeImpl(src) {
1479                 init();
1480                 AuthnRequestsSigned(src.m_AuthnRequestsSigned);
1481                 WantAssertionsSigned(src.m_WantAssertionsSigned);
1482                 VectorOf(AssertionConsumerService) v=getAssertionConsumerServices();
1483                 for (vector<AssertionConsumerService*>::const_iterator i=src.m_AssertionConsumerServices.begin(); i!=src.m_AssertionConsumerServices.end(); i++) {
1484                     if (*i) {
1485                         v.push_back((*i)->cloneAssertionConsumerService());
1486                     }
1487                 }
1488                 VectorOf(AttributeConsumingService) w=getAttributeConsumingServices();
1489                 for (vector<AttributeConsumingService*>::const_iterator j=src.m_AttributeConsumingServices.begin(); j!=src.m_AttributeConsumingServices.end(); j++) {
1490                     if (*j) {
1491                         w.push_back((*j)->cloneAttributeConsumingService());
1492                     }
1493                 }
1494             }
1495
1496             IMPL_XMLOBJECT_CLONE(SPSSODescriptor);
1497             SSODescriptorType* cloneSSODescriptorType() const {
1498                 return cloneSPSSODescriptor();
1499             }
1500             RoleDescriptor* cloneRoleDescriptor() const {
1501                 return cloneSPSSODescriptor();
1502             }
1503
1504             IMPL_BOOLEAN_ATTRIB(AuthnRequestsSigned);
1505             IMPL_BOOLEAN_ATTRIB(WantAssertionsSigned);
1506             IMPL_TYPED_CHILDREN(AssertionConsumerService,m_pos_AssertionConsumerService);
1507             IMPL_TYPED_CHILDREN(AttributeConsumingService,m_children.end());
1508
1509             void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
1510                 if (!qualifiedName.hasNamespaceURI()) {
1511                     if (XMLString::equals(qualifiedName.getLocalPart(),AUTHNREQUESTSSIGNED_ATTRIB_NAME)) {
1512                         setAuthnRequestsSigned(value);
1513                         return;
1514                     }
1515                     else if (XMLString::equals(qualifiedName.getLocalPart(),WANTASSERTIONSSIGNED_ATTRIB_NAME)) {
1516                         setWantAssertionsSigned(value);
1517                         return;
1518                     }
1519                 }
1520                 RoleDescriptorImpl::setAttribute(qualifiedName, value, ID);
1521             }
1522
1523         protected:
1524             void marshallAttributes(DOMElement* domElement) const {
1525                 MARSHALL_BOOLEAN_ATTRIB(AuthnRequestsSigned,AUTHNREQUESTSSIGNED,NULL);
1526                 MARSHALL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,NULL);
1527                 RoleDescriptorImpl::marshallAttributes(domElement);
1528             }
1529
1530             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1531                 PROC_TYPED_CHILDREN(AssertionConsumerService,SAML20MD_NS,false);
1532                 PROC_TYPED_CHILDREN(AttributeConsumingService,SAML20MD_NS,false);
1533                 SSODescriptorTypeImpl::processChildElement(childXMLObject,root);
1534             }
1535         };
1536
1537         class SAML_DLLLOCAL AuthnAuthorityDescriptorImpl : public virtual AuthnAuthorityDescriptor, public RoleDescriptorImpl
1538         {
1539             list<XMLObject*>::iterator m_pos_AuthnQueryService;
1540             list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
1541
1542             void init() {
1543                 m_children.push_back(NULL);
1544                 m_children.push_back(NULL);
1545                 m_pos_AuthnQueryService=m_pos_ContactPerson;
1546                 ++m_pos_AuthnQueryService;
1547                 m_pos_AssertionIDRequestService=m_pos_AuthnQueryService;
1548                 ++m_pos_AssertionIDRequestService;
1549             }
1550
1551         public:
1552             virtual ~AuthnAuthorityDescriptorImpl() {}
1553
1554             AuthnAuthorityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1555                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1556                 init();
1557             }
1558
1559             AuthnAuthorityDescriptorImpl(const AuthnAuthorityDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1560                 init();
1561                 VectorOf(AuthnQueryService) v=getAuthnQueryServices();
1562                 for (vector<AuthnQueryService*>::const_iterator i=src.m_AuthnQueryServices.begin(); i!=src.m_AuthnQueryServices.end(); i++) {
1563                     if (*i) {
1564                         v.push_back((*i)->cloneAuthnQueryService());
1565                     }
1566                 }
1567                 VectorOf(AssertionIDRequestService) w=getAssertionIDRequestServices();
1568                 for (vector<AssertionIDRequestService*>::const_iterator j=src.m_AssertionIDRequestServices.begin(); j!=src.m_AssertionIDRequestServices.end(); j++) {
1569                     if (*j) {
1570                         w.push_back((*j)->cloneAssertionIDRequestService());
1571                     }
1572                 }
1573                 VectorOf(NameIDFormat) x=getNameIDFormats();
1574                 for (vector<NameIDFormat*>::const_iterator k=src.m_NameIDFormats.begin(); k!=src.m_NameIDFormats.end(); k++) {
1575                     if (*k) {
1576                         x.push_back((*k)->cloneNameIDFormat());
1577                     }
1578                 }
1579             }
1580
1581             IMPL_XMLOBJECT_CLONE(AuthnAuthorityDescriptor);
1582             RoleDescriptor* cloneRoleDescriptor() const {
1583                 return cloneAuthnAuthorityDescriptor();
1584             }
1585
1586             IMPL_TYPED_CHILDREN(AuthnQueryService,m_pos_AuthnQueryService);
1587             IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
1588             IMPL_TYPED_CHILDREN(NameIDFormat,m_children.end());
1589
1590         protected:
1591             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1592                 PROC_TYPED_CHILDREN(AuthnQueryService,SAML20MD_NS,false);
1593                 PROC_TYPED_CHILDREN(AssertionIDRequestService,SAML20MD_NS,false);
1594                 PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
1595                 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1596             }
1597         };
1598
1599         class SAML_DLLLOCAL PDPDescriptorImpl : public virtual PDPDescriptor, public RoleDescriptorImpl
1600         {
1601             list<XMLObject*>::iterator m_pos_AuthzService;
1602             list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
1603
1604             void init() {
1605                 m_children.push_back(NULL);
1606                 m_children.push_back(NULL);
1607                 m_pos_AuthzService=m_pos_ContactPerson;
1608                 ++m_pos_AuthzService;
1609                 m_pos_AssertionIDRequestService=m_pos_AuthzService;
1610                 ++m_pos_AssertionIDRequestService;
1611             }
1612
1613         public:
1614             virtual ~PDPDescriptorImpl() {}
1615
1616             PDPDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1617                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1618                 init();
1619             }
1620
1621             PDPDescriptorImpl(const PDPDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1622                 init();
1623                 VectorOf(AuthzService) v=getAuthzServices();
1624                 for (vector<AuthzService*>::const_iterator i=src.m_AuthzServices.begin(); i!=src.m_AuthzServices.end(); i++) {
1625                     if (*i) {
1626                         v.push_back((*i)->cloneAuthzService());
1627                     }
1628                 }
1629                 VectorOf(AssertionIDRequestService) w=getAssertionIDRequestServices();
1630                 for (vector<AssertionIDRequestService*>::const_iterator j=src.m_AssertionIDRequestServices.begin(); j!=src.m_AssertionIDRequestServices.end(); j++) {
1631                     if (*j) {
1632                         w.push_back((*j)->cloneAssertionIDRequestService());
1633                     }
1634                 }
1635                 VectorOf(NameIDFormat) x=getNameIDFormats();
1636                 for (vector<NameIDFormat*>::const_iterator k=src.m_NameIDFormats.begin(); k!=src.m_NameIDFormats.end(); k++) {
1637                     if (*k) {
1638                         x.push_back((*k)->cloneNameIDFormat());
1639                     }
1640                 }
1641             }
1642
1643             IMPL_XMLOBJECT_CLONE(PDPDescriptor);
1644             RoleDescriptor* cloneRoleDescriptor() const {
1645                 return clonePDPDescriptor();
1646             }
1647
1648             IMPL_TYPED_CHILDREN(AuthzService,m_pos_AuthzService);
1649             IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
1650             IMPL_TYPED_CHILDREN(NameIDFormat,m_children.end());
1651
1652         protected:
1653             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1654                 PROC_TYPED_CHILDREN(AuthzService,SAML20MD_NS,false);
1655                 PROC_TYPED_CHILDREN(AssertionIDRequestService,SAML20MD_NS,false);
1656                 PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
1657                 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1658             }
1659         };
1660
1661         class SAML_DLLLOCAL AttributeAuthorityDescriptorImpl : public virtual AttributeAuthorityDescriptor, public RoleDescriptorImpl
1662         {
1663             list<XMLObject*>::iterator m_pos_AttributeService;
1664             list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
1665             list<XMLObject*>::iterator m_pos_NameIDFormat;
1666             list<XMLObject*>::iterator m_pos_AttributeProfile;
1667
1668             void init() {
1669                 m_children.push_back(NULL);
1670                 m_children.push_back(NULL);
1671                 m_children.push_back(NULL);
1672                 m_children.push_back(NULL);
1673                 m_pos_AttributeService=m_pos_ContactPerson;
1674                 ++m_pos_AttributeService;
1675                 m_pos_AssertionIDRequestService=m_pos_AttributeService;
1676                 ++m_pos_AssertionIDRequestService;
1677                 m_pos_NameIDFormat=m_pos_AssertionIDRequestService;
1678                 ++m_pos_NameIDFormat;
1679                 m_pos_AttributeProfile=m_pos_NameIDFormat;
1680                 ++m_pos_AttributeProfile;
1681             }
1682
1683         public:
1684             virtual ~AttributeAuthorityDescriptorImpl() {}
1685
1686             AttributeAuthorityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1687                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1688                 init();
1689             }
1690
1691             AttributeAuthorityDescriptorImpl(const AttributeAuthorityDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1692                 init();
1693                 VectorOf(AttributeService) v=getAttributeServices();
1694                 for (vector<AttributeService*>::const_iterator i=src.m_AttributeServices.begin(); i!=src.m_AttributeServices.end(); i++) {
1695                     if (*i) {
1696                         v.push_back((*i)->cloneAttributeService());
1697                     }
1698                 }
1699                 VectorOf(AssertionIDRequestService) w=getAssertionIDRequestServices();
1700                 for (vector<AssertionIDRequestService*>::const_iterator j=src.m_AssertionIDRequestServices.begin(); j!=src.m_AssertionIDRequestServices.end(); j++) {
1701                     if (*j) {
1702                         w.push_back((*j)->cloneAssertionIDRequestService());
1703                     }
1704                 }
1705                 VectorOf(NameIDFormat) x=getNameIDFormats();
1706                 for (vector<NameIDFormat*>::const_iterator k=src.m_NameIDFormats.begin(); k!=src.m_NameIDFormats.end(); k++) {
1707                     if (*k) {
1708                         x.push_back((*k)->cloneNameIDFormat());
1709                     }
1710                 }
1711                 VectorOf(AttributeProfile) y=getAttributeProfiles();
1712                 for (vector<AttributeProfile*>::const_iterator m=src.m_AttributeProfiles.begin(); m!=src.m_AttributeProfiles.end(); m++) {
1713                     if (*m) {
1714                         y.push_back((*m)->cloneAttributeProfile());
1715                     }
1716                 }
1717                 VectorOf(Attribute) z=getAttributes();
1718                 for (vector<Attribute*>::const_iterator n=src.m_Attributes.begin(); n!=src.m_Attributes.end(); n++) {
1719                     if (*n) {
1720                         z.push_back((*n)->cloneAttribute());
1721                     }
1722                 }
1723             }
1724
1725             IMPL_XMLOBJECT_CLONE(AttributeAuthorityDescriptor);
1726             RoleDescriptor* cloneRoleDescriptor() const {
1727                 return cloneAttributeAuthorityDescriptor();
1728             }
1729
1730             IMPL_TYPED_CHILDREN(AttributeService,m_pos_AttributeService);
1731             IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
1732             IMPL_TYPED_CHILDREN(NameIDFormat,m_pos_NameIDFormat);
1733             IMPL_TYPED_CHILDREN(AttributeProfile,m_pos_AttributeProfile);
1734             IMPL_TYPED_FOREIGN_CHILDREN(Attribute,saml2,m_children.end());
1735
1736         protected:
1737             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1738                 PROC_TYPED_CHILDREN(AttributeService,SAML20MD_NS,false);
1739                 PROC_TYPED_CHILDREN(AssertionIDRequestService,SAML20MD_NS,false);
1740                 PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
1741                 PROC_TYPED_CHILDREN(AttributeProfile,SAML20MD_NS,false);
1742                 PROC_TYPED_FOREIGN_CHILDREN(Attribute,saml2,SAML20_NS,false);
1743                 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1744             }
1745         };
1746
1747         class SAML_DLLLOCAL QueryDescriptorTypeImpl : public virtual QueryDescriptorType, public RoleDescriptorImpl
1748         {
1749             void init() {
1750                 m_WantAssertionsSigned=XML_BOOL_NULL;
1751                 m_children.push_back(NULL);
1752                 m_pos_NameIDFormat=m_pos_ContactPerson;
1753                 ++m_pos_NameIDFormat;
1754             }
1755
1756         protected:
1757             list<XMLObject*>::iterator m_pos_NameIDFormat;
1758
1759             QueryDescriptorTypeImpl() {
1760                 init();
1761             }
1762
1763         public:
1764             virtual ~QueryDescriptorTypeImpl() {}
1765
1766             QueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1767                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1768                 init();
1769             }
1770
1771             QueryDescriptorTypeImpl(const QueryDescriptorTypeImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1772                 init();
1773                 WantAssertionsSigned(src.m_WantAssertionsSigned);
1774                 VectorOf(NameIDFormat) y=getNameIDFormats();
1775                 for (vector<NameIDFormat*>::const_iterator m=src.m_NameIDFormats.begin(); m!=src.m_NameIDFormats.end(); m++) {
1776                     if (*m) {
1777                         y.push_back((*m)->cloneNameIDFormat());
1778                     }
1779                 }
1780             }
1781
1782             IMPL_BOOLEAN_ATTRIB(WantAssertionsSigned);
1783             IMPL_TYPED_CHILDREN(NameIDFormat,m_pos_NameIDFormat);
1784
1785             void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
1786                 if (!qualifiedName.hasNamespaceURI()) {
1787                     if (XMLString::equals(qualifiedName.getLocalPart(),WANTASSERTIONSSIGNED_ATTRIB_NAME)) {
1788                         setWantAssertionsSigned(value);
1789                         return;
1790                     }
1791                 }
1792                 RoleDescriptorImpl::setAttribute(qualifiedName, value, ID);
1793             }
1794
1795         protected:
1796             void marshallAttributes(DOMElement* domElement) const {
1797                 MARSHALL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,NULL);
1798                 RoleDescriptorImpl::marshallAttributes(domElement);
1799             }
1800
1801             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1802                 PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
1803                 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1804             }
1805         };
1806
1807         class SAML_DLLLOCAL AuthnQueryDescriptorTypeImpl : public virtual AuthnQueryDescriptorType, public QueryDescriptorTypeImpl
1808         {
1809         public:
1810             virtual ~AuthnQueryDescriptorTypeImpl() {}
1811
1812             AuthnQueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1813                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
1814
1815             AuthnQueryDescriptorTypeImpl(const AuthnQueryDescriptorTypeImpl& src) : AbstractXMLObject(src), QueryDescriptorTypeImpl(src) {}
1816
1817             IMPL_XMLOBJECT_CLONE(AuthnQueryDescriptorType);
1818             QueryDescriptorType* cloneQueryDescriptorType() const {
1819                 return new AuthnQueryDescriptorTypeImpl(*this);
1820             }
1821             RoleDescriptor* cloneRoleDescriptor() const {
1822                 return new AuthnQueryDescriptorTypeImpl(*this);
1823             }
1824         };
1825
1826         class SAML_DLLLOCAL AttributeQueryDescriptorTypeImpl : public virtual AttributeQueryDescriptorType, public QueryDescriptorTypeImpl
1827         {
1828         public:
1829             virtual ~AttributeQueryDescriptorTypeImpl() {}
1830
1831             AttributeQueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1832                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
1833
1834             AttributeQueryDescriptorTypeImpl(const AttributeQueryDescriptorTypeImpl& src)
1835                     : AbstractXMLObject(src), QueryDescriptorTypeImpl(src) {
1836                 VectorOf(AttributeConsumingService) w=getAttributeConsumingServices();
1837                 for (vector<AttributeConsumingService*>::const_iterator j=src.m_AttributeConsumingServices.begin(); j!=src.m_AttributeConsumingServices.end(); j++) {
1838                     if (*j) {
1839                         w.push_back((*j)->cloneAttributeConsumingService());
1840                     }
1841                 }
1842             }
1843
1844             IMPL_XMLOBJECT_CLONE(AttributeQueryDescriptorType);
1845             QueryDescriptorType* cloneQueryDescriptorType() const {
1846                 return new AttributeQueryDescriptorTypeImpl(*this);
1847             }
1848             RoleDescriptor* cloneRoleDescriptor() const {
1849                 return new AttributeQueryDescriptorTypeImpl(*this);
1850             }
1851
1852             IMPL_TYPED_CHILDREN(AttributeConsumingService,m_children.end());
1853
1854         protected:
1855             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1856                 PROC_TYPED_CHILDREN(AttributeConsumingService,SAML20MD_NS,false);
1857                 QueryDescriptorTypeImpl::processChildElement(childXMLObject,root);
1858             }
1859         };
1860
1861         class SAML_DLLLOCAL AuthzDecisionQueryDescriptorTypeImpl : public virtual AuthzDecisionQueryDescriptorType, public QueryDescriptorTypeImpl
1862         {
1863         public:
1864             virtual ~AuthzDecisionQueryDescriptorTypeImpl() {}
1865
1866             AuthzDecisionQueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1867                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
1868
1869             AuthzDecisionQueryDescriptorTypeImpl(const AuthzDecisionQueryDescriptorTypeImpl& src)
1870                     : AbstractXMLObject(src), QueryDescriptorTypeImpl(src) {
1871                 VectorOf(ActionNamespace) w=getActionNamespaces();
1872                 for (vector<ActionNamespace*>::const_iterator j=src.m_ActionNamespaces.begin(); j!=src.m_ActionNamespaces.end(); j++) {
1873                     if (*j) {
1874                         w.push_back((*j)->cloneActionNamespace());
1875                     }
1876                 }
1877             }
1878
1879             IMPL_XMLOBJECT_CLONE(AuthzDecisionQueryDescriptorType);
1880             QueryDescriptorType* cloneQueryDescriptorType() const {
1881                 return new AuthzDecisionQueryDescriptorTypeImpl(*this);
1882             }
1883             RoleDescriptor* cloneRoleDescriptor() const {
1884                 return new AuthzDecisionQueryDescriptorTypeImpl(*this);
1885             }
1886
1887             IMPL_TYPED_CHILDREN(ActionNamespace,m_children.end());
1888
1889         protected:
1890             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1891                 PROC_TYPED_CHILDREN(ActionNamespace,samlconstants::SAML20MD_QUERY_EXT_NS,false);
1892                 QueryDescriptorTypeImpl::processChildElement(childXMLObject,root);
1893             }
1894         };
1895
1896         class SAML_DLLLOCAL AffiliationDescriptorImpl : public virtual AffiliationDescriptor,
1897             public virtual SignableObject,
1898             public AbstractComplexElement,
1899             public AbstractAttributeExtensibleXMLObject,
1900             public AbstractDOMCachingXMLObject,
1901             public AbstractXMLObjectMarshaller,
1902             public AbstractXMLObjectUnmarshaller
1903         {
1904             list<XMLObject*>::iterator m_pos_AffiliateMember;
1905
1906             void init() {
1907                 m_ID=m_AffiliationOwnerID=NULL;
1908                 m_ValidUntil=m_CacheDuration=NULL;
1909                 m_children.push_back(NULL);
1910                 m_children.push_back(NULL);
1911                 m_children.push_back(NULL);
1912                 m_Signature=NULL;
1913                 m_Extensions=NULL;
1914                 m_pos_Signature=m_children.begin();
1915                 m_pos_Extensions=m_pos_Signature;
1916                 ++m_pos_Extensions;
1917                 m_pos_AffiliateMember=m_pos_Extensions;
1918                 ++m_pos_AffiliateMember;
1919             }
1920
1921         public:
1922             virtual ~AffiliationDescriptorImpl() {
1923                 XMLString::release(&m_ID);
1924                 XMLString::release(&m_AffiliationOwnerID);
1925                 delete m_ValidUntil;
1926                 delete m_CacheDuration;
1927             }
1928
1929             AffiliationDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1930                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1931                 init();
1932             }
1933
1934             AffiliationDescriptorImpl(const AffiliationDescriptorImpl& src)
1935                     : AbstractXMLObject(src), AbstractComplexElement(src),
1936                         AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
1937                 init();
1938                 setID(src.getID());
1939                 setAffiliationOwnerID(src.getAffiliationOwnerID());
1940                 setValidUntil(src.getValidUntil());
1941                 setCacheDuration(src.getCacheDuration());
1942                 if (src.getSignature())
1943                     setSignature(src.getSignature()->cloneSignature());
1944                 if (src.getExtensions())
1945                     setExtensions(src.getExtensions()->cloneExtensions());
1946
1947                 VectorOf(KeyDescriptor) v=getKeyDescriptors();
1948                 for (vector<KeyDescriptor*>::const_iterator i=src.m_KeyDescriptors.begin(); i!=src.m_KeyDescriptors.end(); i++) {
1949                     if (*i) {
1950                         v.push_back((*i)->cloneKeyDescriptor());
1951                     }
1952                 }
1953                 VectorOf(AffiliateMember) w=getAffiliateMembers();
1954                 for (vector<AffiliateMember*>::const_iterator j=src.m_AffiliateMembers.begin(); j!=src.m_AffiliateMembers.end(); j++) {
1955                     if (*j) {
1956                         w.push_back((*j)->cloneAffiliateMember());
1957                     }
1958                 }
1959             }
1960
1961             IMPL_XMLOBJECT_CLONE(AffiliationDescriptor);
1962
1963             //IMPL_TYPED_CHILD(Signature);
1964             // Need customized setter.
1965         protected:
1966             Signature* m_Signature;
1967             list<XMLObject*>::iterator m_pos_Signature;
1968         public:
1969             Signature* getSignature() const {
1970                 return m_Signature;
1971             }
1972
1973             void setSignature(Signature* sig) {
1974                 prepareForAssignment(m_Signature,sig);
1975                 *m_pos_Signature=m_Signature=sig;
1976                 // Sync content reference back up.
1977                 if (m_Signature)
1978                     m_Signature->setContentReference(new opensaml::ContentReference(*this));
1979             }
1980
1981             IMPL_ID_ATTRIB(ID);
1982             IMPL_STRING_ATTRIB(AffiliationOwnerID);
1983             IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
1984             IMPL_DURATION_ATTRIB(CacheDuration,0);
1985             IMPL_TYPED_CHILD(Extensions);
1986             IMPL_TYPED_CHILDREN(AffiliateMember,m_pos_AffiliateMember);
1987             IMPL_TYPED_CHILDREN(KeyDescriptor,m_children.end());
1988
1989             void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
1990                 if (!qualifiedName.hasNamespaceURI()) {
1991                     if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) {
1992                         setID(value);
1993                         return;
1994                     }
1995                     else if (XMLString::equals(qualifiedName.getLocalPart(),AFFILIATIONOWNERID_ATTRIB_NAME)) {
1996                         setAffiliationOwnerID(value);
1997                         return;
1998                     }
1999                     else if (XMLString::equals(qualifiedName.getLocalPart(),VALIDUNTIL_ATTRIB_NAME)) {
2000                         setValidUntil(value);
2001                         return;
2002                     }
2003                     else if (XMLString::equals(qualifiedName.getLocalPart(),CACHEDURATION_ATTRIB_NAME)) {
2004                         setCacheDuration(value);
2005                         return;
2006                     }
2007                 }
2008                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
2009             }
2010
2011         protected:
2012             void marshallAttributes(DOMElement* domElement) const {
2013                 MARSHALL_ID_ATTRIB(ID,ID,NULL);
2014                 MARSHALL_STRING_ATTRIB(AffiliationOwnerID,AFFILIATIONOWNERID,NULL);
2015                 MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,NULL);
2016                 MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,NULL);
2017                 marshallExtensionAttributes(domElement);
2018             }
2019
2020             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
2021                 PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLSIG_NS,false);
2022                 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
2023                 PROC_TYPED_CHILDREN(AffiliateMember,SAML20MD_NS,false);
2024                 PROC_TYPED_CHILDREN(KeyDescriptor,SAML20MD_NS,false);
2025                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
2026             }
2027
2028             void processAttribute(const DOMAttr* attribute) {
2029                 PROC_ID_ATTRIB(ID,ID,NULL);
2030                 unmarshallExtensionAttribute(attribute);
2031             }
2032         };
2033
2034         class SAML_DLLLOCAL EntityDescriptorImpl : public virtual EntityDescriptor,
2035             public virtual SignableObject,
2036             public AbstractComplexElement,
2037             public AbstractAttributeExtensibleXMLObject,
2038             public AbstractDOMCachingXMLObject,
2039             public AbstractXMLObjectMarshaller,
2040             public AbstractXMLObjectUnmarshaller
2041         {
2042             list<XMLObject*>::iterator m_pos_ContactPerson;
2043
2044             void init() {
2045                 m_ID=m_EntityID=NULL;
2046                 m_ValidUntil=m_CacheDuration=NULL;
2047                 m_children.push_back(NULL);
2048                 m_children.push_back(NULL);
2049                 m_children.push_back(NULL);
2050                 m_children.push_back(NULL);
2051                 m_children.push_back(NULL);
2052                 m_Signature=NULL;
2053                 m_Extensions=NULL;
2054                 m_AffiliationDescriptor=NULL;
2055                 m_Organization=NULL;
2056                 m_pos_Signature=m_children.begin();
2057                 m_pos_Extensions=m_pos_Signature;
2058                 ++m_pos_Extensions;
2059                 m_pos_AffiliationDescriptor=m_pos_Extensions;
2060                 ++m_pos_AffiliationDescriptor;
2061                 m_pos_Organization=m_pos_AffiliationDescriptor;
2062                 ++m_pos_Organization;
2063                 m_pos_ContactPerson=m_pos_Organization;
2064                 ++m_pos_ContactPerson;
2065             }
2066
2067         public:
2068             virtual ~EntityDescriptorImpl() {
2069                 XMLString::release(&m_ID);
2070                 XMLString::release(&m_EntityID);
2071                 delete m_ValidUntil;
2072                 delete m_CacheDuration;
2073             }
2074
2075             EntityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
2076                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
2077                 init();
2078             }
2079
2080             EntityDescriptorImpl(const EntityDescriptorImpl& src)
2081                     : AbstractXMLObject(src), AbstractComplexElement(src),
2082                         AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
2083                 init();
2084                 setID(src.getID());
2085                 setEntityID(src.getEntityID());
2086                 setValidUntil(src.getValidUntil());
2087                 setCacheDuration(src.getCacheDuration());
2088                 if (src.getSignature())
2089                     setSignature(src.getSignature()->cloneSignature());
2090                 if (src.getExtensions())
2091                     setExtensions(src.getExtensions()->cloneExtensions());
2092                 if (src.getAffiliationDescriptor())
2093                     setAffiliationDescriptor(src.getAffiliationDescriptor()->cloneAffiliationDescriptor());
2094                 if (src.getOrganization())
2095                     setOrganization(src.getOrganization()->cloneOrganization());
2096
2097                 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
2098                     if (*i) {
2099                         IDPSSODescriptor* idp=dynamic_cast<IDPSSODescriptor*>(*i);
2100                         if (idp) {
2101                             getIDPSSODescriptors().push_back(idp->cloneIDPSSODescriptor());
2102                             continue;
2103                         }
2104
2105                         SPSSODescriptor* sp=dynamic_cast<SPSSODescriptor*>(*i);
2106                         if (sp) {
2107                             getSPSSODescriptors().push_back(sp->cloneSPSSODescriptor());
2108                             continue;
2109                         }
2110
2111                         AuthnAuthorityDescriptor* authn=dynamic_cast<AuthnAuthorityDescriptor*>(*i);
2112                         if (authn) {
2113                             getAuthnAuthorityDescriptors().push_back(authn->cloneAuthnAuthorityDescriptor());
2114                             continue;
2115                         }
2116
2117                         AttributeAuthorityDescriptor* attr=dynamic_cast<AttributeAuthorityDescriptor*>(*i);
2118                         if (attr) {
2119                             getAttributeAuthorityDescriptors().push_back(attr->cloneAttributeAuthorityDescriptor());
2120                             continue;
2121                         }
2122
2123                         PDPDescriptor* pdp=dynamic_cast<PDPDescriptor*>(*i);
2124                         if (pdp) {
2125                             getPDPDescriptors().push_back(pdp->clonePDPDescriptor());
2126                             continue;
2127                         }
2128
2129                         AuthnQueryDescriptorType* authnq=dynamic_cast<AuthnQueryDescriptorType*>(*i);
2130                         if (authnq) {
2131                             getAuthnQueryDescriptorTypes().push_back(authnq->cloneAuthnQueryDescriptorType());
2132                             continue;
2133                         }
2134
2135                         AttributeQueryDescriptorType* attrq=dynamic_cast<AttributeQueryDescriptorType*>(*i);
2136                         if (attrq) {
2137                             getAttributeQueryDescriptorTypes().push_back(attrq->cloneAttributeQueryDescriptorType());
2138                             continue;
2139                         }
2140
2141                         AuthzDecisionQueryDescriptorType* authzq=dynamic_cast<AuthzDecisionQueryDescriptorType*>(*i);
2142                         if (authzq) {
2143                             getAuthzDecisionQueryDescriptorTypes().push_back(authzq->cloneAuthzDecisionQueryDescriptorType());
2144                             continue;
2145                         }
2146
2147                         RoleDescriptor* role=dynamic_cast<RoleDescriptor*>(*i);
2148                         if (role) {
2149                             getRoleDescriptors().push_back(role->cloneRoleDescriptor());
2150                             continue;
2151                         }
2152                     }
2153                 }
2154
2155                 VectorOf(ContactPerson) v=getContactPersons();
2156                 for (vector<ContactPerson*>::const_iterator j=src.m_ContactPersons.begin(); j!=src.m_ContactPersons.end(); j++) {
2157                     if (*j) {
2158                         v.push_back((*j)->cloneContactPerson());
2159                     }
2160                 }
2161                 VectorOf(AdditionalMetadataLocation) w=getAdditionalMetadataLocations();
2162                 for (vector<AdditionalMetadataLocation*>::const_iterator k=src.m_AdditionalMetadataLocations.begin(); k!=src.m_AdditionalMetadataLocations.end(); k++) {
2163                     if (*k) {
2164                         w.push_back((*k)->cloneAdditionalMetadataLocation());
2165                     }
2166                 }
2167             }
2168
2169             IMPL_XMLOBJECT_CLONE(EntityDescriptor);
2170
2171             //IMPL_TYPED_CHILD(Signature);
2172             // Need customized setter.
2173         protected:
2174             Signature* m_Signature;
2175             list<XMLObject*>::iterator m_pos_Signature;
2176         public:
2177             Signature* getSignature() const {
2178                 return m_Signature;
2179             }
2180
2181             void setSignature(Signature* sig) {
2182                 prepareForAssignment(m_Signature,sig);
2183                 *m_pos_Signature=m_Signature=sig;
2184                 // Sync content reference back up.
2185                 if (m_Signature)
2186                     m_Signature->setContentReference(new opensaml::ContentReference(*this));
2187             }
2188
2189             IMPL_ID_ATTRIB(ID);
2190             IMPL_STRING_ATTRIB(EntityID);
2191             IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
2192             IMPL_DURATION_ATTRIB(CacheDuration,0);
2193             IMPL_TYPED_CHILD(Extensions);
2194             IMPL_TYPED_CHILDREN(RoleDescriptor,m_pos_AffiliationDescriptor);
2195             IMPL_TYPED_CHILDREN(IDPSSODescriptor,m_pos_AffiliationDescriptor);
2196             IMPL_TYPED_CHILDREN(SPSSODescriptor,m_pos_AffiliationDescriptor);
2197             IMPL_TYPED_CHILDREN(AuthnAuthorityDescriptor,m_pos_AffiliationDescriptor);
2198             IMPL_TYPED_CHILDREN(AttributeAuthorityDescriptor,m_pos_AffiliationDescriptor);
2199             IMPL_TYPED_CHILDREN(PDPDescriptor,m_pos_AffiliationDescriptor);
2200             IMPL_TYPED_CHILDREN(AuthnQueryDescriptorType,m_pos_AffiliationDescriptor);
2201             IMPL_TYPED_CHILDREN(AttributeQueryDescriptorType,m_pos_AffiliationDescriptor);
2202             IMPL_TYPED_CHILDREN(AuthzDecisionQueryDescriptorType,m_pos_AffiliationDescriptor);
2203             IMPL_TYPED_CHILD(AffiliationDescriptor);
2204             IMPL_TYPED_CHILD(Organization);
2205             IMPL_TYPED_CHILDREN(ContactPerson,m_pos_ContactPerson);
2206             IMPL_TYPED_CHILDREN(AdditionalMetadataLocation,m_children.end());
2207
2208             void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
2209                 if (!qualifiedName.hasNamespaceURI()) {
2210                     if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) {
2211                         setID(value);
2212                         return;
2213                     }
2214                     else if (XMLString::equals(qualifiedName.getLocalPart(),ENTITYID_ATTRIB_NAME)) {
2215                         setEntityID(value);
2216                         return;
2217                     }
2218                     else if (XMLString::equals(qualifiedName.getLocalPart(),VALIDUNTIL_ATTRIB_NAME)) {
2219                         setValidUntil(value);
2220                         return;
2221                     }
2222                     else if (XMLString::equals(qualifiedName.getLocalPart(),CACHEDURATION_ATTRIB_NAME)) {
2223                         setCacheDuration(value);
2224                         return;
2225                     }
2226                 }
2227                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
2228             }
2229
2230             const RoleDescriptor* getRoleDescriptor(const xmltooling::QName& qname, const XMLCh* protocol) const {
2231                 // Check for "known" elements/types.
2232                 if (qname == IDPSSODescriptor::ELEMENT_QNAME)
2233                     return find_if(m_IDPSSODescriptors, isValidForProtocol(protocol));
2234                 if (qname == SPSSODescriptor::ELEMENT_QNAME)
2235                     return find_if(m_SPSSODescriptors, isValidForProtocol(protocol));
2236                 if (qname == AuthnAuthorityDescriptor::ELEMENT_QNAME)
2237                     return find_if(m_AuthnAuthorityDescriptors, isValidForProtocol(protocol));
2238                 if (qname == AttributeAuthorityDescriptor::ELEMENT_QNAME)
2239                     return find_if(m_AttributeAuthorityDescriptors, isValidForProtocol(protocol));
2240                 if (qname == PDPDescriptor::ELEMENT_QNAME)
2241                     return find_if(m_PDPDescriptors, isValidForProtocol(protocol));
2242                 if (qname == AuthnQueryDescriptorType::TYPE_QNAME)
2243                     return find_if(m_AuthnQueryDescriptorTypes, isValidForProtocol(protocol));
2244                 if (qname == AttributeQueryDescriptorType::TYPE_QNAME)
2245                     return find_if(m_AttributeQueryDescriptorTypes, isValidForProtocol(protocol));
2246                 if (qname == AuthzDecisionQueryDescriptorType::TYPE_QNAME)
2247                     return find_if(m_AuthzDecisionQueryDescriptorTypes, isValidForProtocol(protocol));
2248
2249                 vector<RoleDescriptor*>::const_iterator i =
2250                     find_if(m_RoleDescriptors.begin(), m_RoleDescriptors.end(), ofTypeValidForProtocol(qname,protocol));
2251                 return (i!=m_RoleDescriptors.end()) ? *i : NULL;
2252             }
2253
2254         protected:
2255             void marshallAttributes(DOMElement* domElement) const {
2256                 MARSHALL_ID_ATTRIB(ID,ID,NULL);
2257                 MARSHALL_STRING_ATTRIB(EntityID,ENTITYID,NULL);
2258                 MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,NULL);
2259                 MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,NULL);
2260                 marshallExtensionAttributes(domElement);
2261             }
2262
2263             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
2264                 PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLSIG_NS,false);
2265                 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
2266                 PROC_TYPED_CHILDREN(IDPSSODescriptor,SAML20MD_NS,false);
2267                 PROC_TYPED_CHILDREN(SPSSODescriptor,SAML20MD_NS,false);
2268                 PROC_TYPED_CHILDREN(AuthnAuthorityDescriptor,SAML20MD_NS,false);
2269                 PROC_TYPED_CHILDREN(AttributeAuthorityDescriptor,SAML20MD_NS,false);
2270                 PROC_TYPED_CHILDREN(PDPDescriptor,SAML20MD_NS,false);
2271                 PROC_TYPED_CHILDREN(AuthnQueryDescriptorType,samlconstants::SAML20MD_QUERY_EXT_NS,false);
2272                 PROC_TYPED_CHILDREN(AttributeQueryDescriptorType,samlconstants::SAML20MD_QUERY_EXT_NS,false);
2273                 PROC_TYPED_CHILDREN(AuthzDecisionQueryDescriptorType,samlconstants::SAML20MD_QUERY_EXT_NS,false);
2274                 PROC_TYPED_CHILDREN(RoleDescriptor,SAML20MD_NS,false);
2275                 PROC_TYPED_CHILD(AffiliationDescriptor,SAML20MD_NS,false);
2276                 PROC_TYPED_CHILD(Organization,SAML20MD_NS,false);
2277                 PROC_TYPED_CHILDREN(ContactPerson,SAML20MD_NS,false);
2278                 PROC_TYPED_CHILDREN(AdditionalMetadataLocation,SAML20MD_NS,false);
2279                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
2280             }
2281
2282             void processAttribute(const DOMAttr* attribute) {
2283                 PROC_ID_ATTRIB(ID,ID,NULL);
2284                 unmarshallExtensionAttribute(attribute);
2285             }
2286         };
2287
2288         class SAML_DLLLOCAL EntitiesDescriptorImpl : public virtual EntitiesDescriptor,
2289             public virtual SignableObject,
2290             public AbstractComplexElement,
2291             public AbstractDOMCachingXMLObject,
2292             public AbstractXMLObjectMarshaller,
2293             public AbstractXMLObjectUnmarshaller
2294         {
2295             void init() {
2296                 m_ID=m_Name=NULL;
2297                 m_ValidUntil=m_CacheDuration=NULL;
2298                 m_children.push_back(NULL);
2299                 m_children.push_back(NULL);
2300                 m_Signature=NULL;
2301                 m_Extensions=NULL;
2302                 m_pos_Signature=m_children.begin();
2303                 m_pos_Extensions=m_pos_Signature;
2304                 ++m_pos_Extensions;
2305             }
2306
2307         public:
2308             virtual ~EntitiesDescriptorImpl() {
2309                 XMLString::release(&m_ID);
2310                 XMLString::release(&m_Name);
2311                 delete m_ValidUntil;
2312                 delete m_CacheDuration;
2313             }
2314
2315             EntitiesDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
2316                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
2317                 init();
2318             }
2319
2320             EntitiesDescriptorImpl(const EntitiesDescriptorImpl& src)
2321                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
2322                 init();
2323                 setID(src.getID());
2324                 setName(src.getName());
2325                 setValidUntil(src.getValidUntil());
2326                 setCacheDuration(src.getCacheDuration());
2327                 if (src.getSignature())
2328                     setSignature(src.getSignature()->cloneSignature());
2329                 if (src.getExtensions())
2330                     setExtensions(src.getExtensions()->cloneExtensions());
2331
2332                 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
2333                     if (*i) {
2334                         EntityDescriptor* e=dynamic_cast<EntityDescriptor*>(*i);
2335                         if (e) {
2336                             getEntityDescriptors().push_back(e->cloneEntityDescriptor());
2337                             continue;
2338                         }
2339
2340                         EntitiesDescriptor* es=dynamic_cast<EntitiesDescriptor*>(*i);
2341                         if (es) {
2342                             getEntitiesDescriptors().push_back(es->cloneEntitiesDescriptor());
2343                             continue;
2344                         }
2345                     }
2346                 }
2347             }
2348
2349             IMPL_XMLOBJECT_CLONE(EntitiesDescriptor);
2350
2351             //IMPL_TYPED_CHILD(Signature);
2352             // Need customized setter.
2353         protected:
2354             Signature* m_Signature;
2355             list<XMLObject*>::iterator m_pos_Signature;
2356         public:
2357             Signature* getSignature() const {
2358                 return m_Signature;
2359             }
2360
2361             void setSignature(Signature* sig) {
2362                 prepareForAssignment(m_Signature,sig);
2363                 *m_pos_Signature=m_Signature=sig;
2364                 // Sync content reference back up.
2365                 if (m_Signature)
2366                     m_Signature->setContentReference(new opensaml::ContentReference(*this));
2367             }
2368
2369             IMPL_ID_ATTRIB(ID);
2370             IMPL_STRING_ATTRIB(Name);
2371             IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
2372             IMPL_DURATION_ATTRIB(CacheDuration,0);
2373             IMPL_TYPED_CHILD(Extensions);
2374             IMPL_TYPED_CHILDREN(EntityDescriptor,m_children.end());
2375             IMPL_TYPED_CHILDREN(EntitiesDescriptor,m_children.end());
2376
2377         protected:
2378             void marshallAttributes(DOMElement* domElement) const {
2379                 MARSHALL_ID_ATTRIB(ID,ID,NULL);
2380                 MARSHALL_STRING_ATTRIB(Name,NAME,NULL);
2381                 MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,NULL);
2382                 MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,NULL);
2383             }
2384
2385             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
2386                 PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLSIG_NS,false);
2387                 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
2388                 PROC_TYPED_CHILDREN(EntityDescriptor,SAML20MD_NS,false);
2389                 PROC_TYPED_CHILDREN(EntitiesDescriptor,SAML20MD_NS,false);
2390                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
2391             }
2392
2393             void processAttribute(const DOMAttr* attribute) {
2394                 PROC_ID_ATTRIB(ID,ID,NULL);
2395                 PROC_STRING_ATTRIB(Name,NAME,NULL);
2396                 PROC_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,NULL);
2397                 PROC_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,NULL);
2398             }
2399         };
2400
2401     };
2402 };
2403
2404 #if defined (_MSC_VER)
2405     #pragma warning( pop )
2406 #endif
2407
2408 IMPL_ELEMENT_QNAME(IDPSSODescriptor, SAML20MD_NS, SAML20MD_PREFIX);
2409 IMPL_ELEMENT_QNAME(SPSSODescriptor, SAML20MD_NS, SAML20MD_PREFIX);
2410 IMPL_ELEMENT_QNAME(AuthnAuthorityDescriptor, SAML20MD_NS, SAML20MD_PREFIX);
2411 IMPL_ELEMENT_QNAME(AttributeAuthorityDescriptor, SAML20MD_NS, SAML20MD_PREFIX);
2412 IMPL_ELEMENT_QNAME(PDPDescriptor, SAML20MD_NS, SAML20MD_PREFIX);
2413 IMPL_TYPE_QNAME(AuthnQueryDescriptorType, SAML20MD_QUERY_EXT_NS, SAML20MD_QUERY_EXT_PREFIX);
2414 IMPL_TYPE_QNAME(AttributeQueryDescriptorType, SAML20MD_QUERY_EXT_NS, SAML20MD_QUERY_EXT_PREFIX);
2415 IMPL_TYPE_QNAME(AuthzDecisionQueryDescriptorType, SAML20MD_QUERY_EXT_NS, SAML20MD_QUERY_EXT_PREFIX);
2416
2417 // Builder Implementations
2418
2419 IMPL_XMLOBJECTBUILDER(AdditionalMetadataLocation);
2420 IMPL_XMLOBJECTBUILDER(AffiliateMember);
2421 IMPL_XMLOBJECTBUILDER(AffiliationDescriptor);
2422 IMPL_XMLOBJECTBUILDER(ArtifactResolutionService);
2423 IMPL_XMLOBJECTBUILDER(AssertionConsumerService);
2424 IMPL_XMLOBJECTBUILDER(AssertionIDRequestService);
2425 IMPL_XMLOBJECTBUILDER(AttributeAuthorityDescriptor);
2426 IMPL_XMLOBJECTBUILDER(AttributeConsumingService);
2427 IMPL_XMLOBJECTBUILDER(AttributeProfile);
2428 IMPL_XMLOBJECTBUILDER(AttributeQueryDescriptorType);
2429 IMPL_XMLOBJECTBUILDER(AttributeService);
2430 IMPL_XMLOBJECTBUILDER(AuthnAuthorityDescriptor);
2431 IMPL_XMLOBJECTBUILDER(AuthnQueryDescriptorType);
2432 IMPL_XMLOBJECTBUILDER(AuthnQueryService);
2433 IMPL_XMLOBJECTBUILDER(AuthzDecisionQueryDescriptorType);
2434 IMPL_XMLOBJECTBUILDER(AuthzService);
2435 IMPL_XMLOBJECTBUILDER(Company);
2436 IMPL_XMLOBJECTBUILDER(ContactPerson);
2437 IMPL_XMLOBJECTBUILDER(EmailAddress);
2438 IMPL_XMLOBJECTBUILDER(EndpointType);
2439 IMPL_XMLOBJECTBUILDER(EntitiesDescriptor);
2440 IMPL_XMLOBJECTBUILDER(EntityDescriptor);
2441 IMPL_XMLOBJECTBUILDER(Extensions);
2442 IMPL_XMLOBJECTBUILDER(GivenName);
2443 IMPL_XMLOBJECTBUILDER(IDPSSODescriptor);
2444 IMPL_XMLOBJECTBUILDER(IndexedEndpointType);
2445 IMPL_XMLOBJECTBUILDER(KeyDescriptor);
2446 IMPL_XMLOBJECTBUILDER(localizedNameType);
2447 IMPL_XMLOBJECTBUILDER(localizedURIType);
2448 IMPL_XMLOBJECTBUILDER(ManageNameIDService);
2449 IMPL_XMLOBJECTBUILDER(NameIDFormat);
2450 IMPL_XMLOBJECTBUILDER(NameIDMappingService);
2451 IMPL_XMLOBJECTBUILDER(Organization);
2452 IMPL_XMLOBJECTBUILDER(OrganizationName);
2453 IMPL_XMLOBJECTBUILDER(OrganizationDisplayName);
2454 IMPL_XMLOBJECTBUILDER(OrganizationURL);
2455 IMPL_XMLOBJECTBUILDER(PDPDescriptor);
2456 IMPL_XMLOBJECTBUILDER(RequestedAttribute);
2457 IMPL_XMLOBJECTBUILDER(ServiceDescription);
2458 IMPL_XMLOBJECTBUILDER(ServiceName);
2459 IMPL_XMLOBJECTBUILDER(SingleLogoutService);
2460 IMPL_XMLOBJECTBUILDER(SingleSignOnService);
2461 IMPL_XMLOBJECTBUILDER(SPSSODescriptor);
2462 IMPL_XMLOBJECTBUILDER(SurName);
2463 IMPL_XMLOBJECTBUILDER(TelephoneNumber);
2464
2465 IMPL_XMLOBJECTBUILDER(ActionNamespace);
2466 IMPL_XMLOBJECTBUILDER(SourceID);
2467
2468 #ifdef HAVE_COVARIANT_RETURNS
2469 RoleDescriptor* RoleDescriptorBuilder::buildObject(
2470 #else
2471 xmltooling::XMLObject* RoleDescriptorBuilder::buildObject(
2472 #endif
2473     const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType
2474     ) const
2475 {
2476     return new RoleDescriptorTypeImpl(nsURI,localName,prefix,schemaType);
2477 }
2478
2479 const XMLCh ActionNamespace::LOCAL_NAME[] =             UNICODE_LITERAL_15(A,c,t,i,o,n,N,a,m,e,s,p,a,c,e);
2480 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);
2481 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);
2482 const XMLCh AdditionalMetadataLocation::NAMESPACE_ATTRIB_NAME[] =   UNICODE_LITERAL_9(n,a,m,e,s,p,a,c,e);
2483 const XMLCh AffiliateMember::LOCAL_NAME[] =             UNICODE_LITERAL_15(A,f,f,i,l,i,a,t,e,M,e,m,b,e,r);
2484 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);
2485 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);
2486 const XMLCh AffiliationDescriptor::ID_ATTRIB_NAME[] =   UNICODE_LITERAL_2(I,D);
2487 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);
2488 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);
2489 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);
2490 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);
2491 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);
2492 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);
2493 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);
2494 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);
2495 const XMLCh AttributeConsumingService::INDEX_ATTRIB_NAME[] =    UNICODE_LITERAL_5(i,n,d,e,x);
2496 const XMLCh AttributeConsumingService::ISDEFAULT_ATTRIB_NAME[] =    UNICODE_LITERAL_9(i,s,D,e,f,a,u,l,t);
2497 const XMLCh AttributeProfile::LOCAL_NAME[] =            UNICODE_LITERAL_16(A,t,t,r,i,b,u,t,e,P,r,o,f,i,l,e);
2498 const XMLCh AttributeQueryDescriptorType::LOCAL_NAME[] =UNICODE_LITERAL_14(R,o,l,e,D,e,s,c,r,i,p,t,o,r);
2499 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);
2500 const XMLCh AttributeService::LOCAL_NAME[] =            UNICODE_LITERAL_16(A,t,t,r,i,b,u,t,e,S,e,r,v,i,c,e);
2501 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);
2502 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);
2503 const XMLCh AuthnQueryDescriptorType::LOCAL_NAME[] =    UNICODE_LITERAL_14(R,o,l,e,D,e,s,c,r,i,p,t,o,r);
2504 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);
2505 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);
2506 const XMLCh AuthzDecisionQueryDescriptorType::LOCAL_NAME[] =    UNICODE_LITERAL_14(R,o,l,e,D,e,s,c,r,i,p,t,o,r);
2507 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);
2508 const XMLCh AuthzService::LOCAL_NAME[] =                UNICODE_LITERAL_12(A,u,t,h,z,S,e,r,v,i,c,e);
2509 const XMLCh CacheableSAMLObject::CACHEDURATION_ATTRIB_NAME[] =  UNICODE_LITERAL_13(c,a,c,h,e,D,u,r,a,t,i,o,n);
2510 const XMLCh Company::LOCAL_NAME[] =                     UNICODE_LITERAL_7(C,o,m,p,a,n,y);
2511 const XMLCh ContactPerson::LOCAL_NAME[] =               UNICODE_LITERAL_13(C,o,n,t,a,c,t,P,e,r,s,o,n);
2512 const XMLCh ContactPerson::TYPE_NAME[] =                UNICODE_LITERAL_11(C,o,n,t,a,c,t,T,y,p,e);
2513 const XMLCh ContactPerson::CONTACTTYPE_ATTRIB_NAME[] =  UNICODE_LITERAL_11(c,o,n,t,a,c,t,T,y,p,e);
2514 const XMLCh ContactPerson::CONTACT_TECHNICAL[] =        UNICODE_LITERAL_9(t,e,c,h,n,i,c,a,l);
2515 const XMLCh ContactPerson::CONTACT_SUPPORT[] =          UNICODE_LITERAL_7(s,u,p,p,o,r,t);
2516 const XMLCh ContactPerson::CONTACT_ADMINISTRATIVE[] =   UNICODE_LITERAL_14(a,d,m,i,n,i,s,t,r,a,t,i,v,e);
2517 const XMLCh ContactPerson::CONTACT_BILLING[] =          UNICODE_LITERAL_7(b,i,l,l,i,n,g);
2518 const XMLCh ContactPerson::CONTACT_OTHER[] =            UNICODE_LITERAL_5(o,t,h,e,r);
2519 const XMLCh EmailAddress::LOCAL_NAME[] =                UNICODE_LITERAL_12(E,m,a,i,l,A,d,d,r,e,s,s);
2520 const XMLCh EndpointType::LOCAL_NAME[] =                {chNull};
2521 const XMLCh EndpointType::TYPE_NAME[] =                 UNICODE_LITERAL_12(E,n,d,p,o,i,n,t,T,y,p,e);
2522 const XMLCh EndpointType::BINDING_ATTRIB_NAME[] =       UNICODE_LITERAL_7(B,i,n,d,i,n,g);
2523 const XMLCh EndpointType::LOCATION_ATTRIB_NAME[] =      UNICODE_LITERAL_8(L,o,c,a,t,i,o,n);
2524 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);
2525 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);
2526 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);
2527 const XMLCh EntitiesDescriptor::ID_ATTRIB_NAME[] =      UNICODE_LITERAL_2(I,D);
2528 const XMLCh EntitiesDescriptor::NAME_ATTRIB_NAME[] =    UNICODE_LITERAL_4(N,a,m,e);
2529 const XMLCh EntityDescriptor::LOCAL_NAME[] =            UNICODE_LITERAL_16(E,n,t,i,t,y,D,e,s,c,r,i,p,t,o,r);
2530 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);
2531 const XMLCh EntityDescriptor::ID_ATTRIB_NAME[] =        UNICODE_LITERAL_2(I,D);
2532 const XMLCh EntityDescriptor::ENTITYID_ATTRIB_NAME[] =  UNICODE_LITERAL_8(e,n,t,i,t,y,I,D);
2533 const XMLCh Extensions::LOCAL_NAME[] =                  UNICODE_LITERAL_10(E,x,t,e,n,s,i,o,n,s);
2534 const XMLCh Extensions::TYPE_NAME[] =                   UNICODE_LITERAL_14(E,x,t,e,n,s,i,o,n,s,T,y,p,e);
2535 const XMLCh GivenName::LOCAL_NAME[] =                   UNICODE_LITERAL_9(G,i,v,e,n,N,a,m,e);
2536 const XMLCh IDPSSODescriptor::LOCAL_NAME[] =            UNICODE_LITERAL_16(I,D,P,S,S,O,D,e,s,c,r,i,p,t,o,r);
2537 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);
2538 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);
2539 const XMLCh IndexedEndpointType::LOCAL_NAME[] =         {chNull};
2540 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);
2541 const XMLCh IndexedEndpointType::INDEX_ATTRIB_NAME[] =  UNICODE_LITERAL_5(i,n,d,e,x);
2542 const XMLCh IndexedEndpointType::ISDEFAULT_ATTRIB_NAME[] =  UNICODE_LITERAL_9(i,s,D,e,f,a,u,l,t);
2543 const XMLCh KeyDescriptor::LOCAL_NAME[] =               UNICODE_LITERAL_13(K,e,y,D,e,s,c,r,i,p,t,o,r);
2544 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);
2545 const XMLCh KeyDescriptor::USE_ATTRIB_NAME[] =          UNICODE_LITERAL_3(u,s,e);
2546 const XMLCh KeyDescriptor::KEYTYPE_ENCRYPTION[] =       UNICODE_LITERAL_10(e,n,c,r,y,p,t,i,o,n);
2547 const XMLCh KeyDescriptor::KEYTYPE_SIGNING[] =          UNICODE_LITERAL_7(s,i,g,n,i,n,g);
2548 const XMLCh localizedNameType::LOCAL_NAME[] =           {chNull};
2549 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);
2550 const XMLCh localizedNameType::LANG_ATTRIB_NAME[] =     UNICODE_LITERAL_4(l,a,n,g);
2551 const XMLCh localizedURIType::LOCAL_NAME[] =            {chNull};
2552 const XMLCh localizedURIType::TYPE_NAME[] =             UNICODE_LITERAL_16(l,o,c,a,l,i,z,e,d,U,R,I,T,y,p,e);
2553 const XMLCh localizedURIType::LANG_ATTRIB_NAME[] =      UNICODE_LITERAL_4(l,a,n,g);
2554 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);
2555 const XMLCh NameIDFormat::LOCAL_NAME[] =                UNICODE_LITERAL_12(N,a,m,e,I,D,F,o,r,m,a,t);
2556 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);
2557 const XMLCh Organization::LOCAL_NAME[] =                UNICODE_LITERAL_12(O,r,g,a,n,i,z,a,t,i,o,n);
2558 const XMLCh Organization::TYPE_NAME[] =                 UNICODE_LITERAL_16(O,r,g,a,n,i,z,a,t,i,o,n,T,y,p,e);
2559 const XMLCh OrganizationName::LOCAL_NAME[] =            UNICODE_LITERAL_16(O,r,g,a,n,i,z,a,t,i,o,n,N,a,m,e);
2560 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);
2561 const XMLCh OrganizationURL::LOCAL_NAME[] =             UNICODE_LITERAL_15(O,r,g,a,n,i,z,a,t,i,o,n,U,R,L);
2562 const XMLCh PDPDescriptor::LOCAL_NAME[] =               UNICODE_LITERAL_13(P,D,P,D,e,s,c,r,i,p,t,o,r);
2563 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);
2564 const XMLCh QueryDescriptorType::LOCAL_NAME[] =         {chNull};
2565 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);
2566 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);
2567 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);
2568 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);
2569 const XMLCh RequestedAttribute::ISREQUIRED_ATTRIB_NAME[] =  UNICODE_LITERAL_10(i,s,R,e,q,u,i,r,e,d);
2570 const XMLCh RoleDescriptor::LOCAL_NAME[] =              UNICODE_LITERAL_14(R,o,l,e,D,e,s,c,r,i,p,t,o,r);
2571 const XMLCh RoleDescriptor::ID_ATTRIB_NAME[] =          UNICODE_LITERAL_2(I,D);
2572 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);
2573 const XMLCh RoleDescriptor::ERRORURL_ATTRIB_NAME[] =    UNICODE_LITERAL_8(e,r,r,o,r,U,R,L);
2574 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);
2575 const XMLCh ServiceName::LOCAL_NAME[] =                 UNICODE_LITERAL_11(S,e,r,v,i,c,e,N,a,m,e);
2576 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);
2577 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);
2578 const XMLCh SourceID::LOCAL_NAME[] =                    UNICODE_LITERAL_8(S,o,u,r,c,e,I,D);
2579 const XMLCh SPSSODescriptor::LOCAL_NAME[] =             UNICODE_LITERAL_15(S,P,S,S,O,D,e,s,c,r,i,p,t,o,r);
2580 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);
2581 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);
2582 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);
2583 const XMLCh SSODescriptorType::LOCAL_NAME[] =           {chNull};
2584 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);
2585 const XMLCh SurName::LOCAL_NAME[] =                     UNICODE_LITERAL_7(S,u,r,N,a,m,e);
2586 const XMLCh TelephoneNumber::LOCAL_NAME[] =             UNICODE_LITERAL_15(T,e,l,e,p,h,o,n,e,N,u,m,b,e,r);
2587 const XMLCh TimeBoundSAMLObject::VALIDUNTIL_ATTRIB_NAME[] =   UNICODE_LITERAL_10(v,a,l,i,d,U,n,t,i,l);