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