f6503ec99ab720e201a5effc16634d301fffde29
[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 #include "saml2/metadata/MetadataKeyInfoIterator.h"
27
28 #include <xmltooling/AbstractComplexElement.h>
29 #include <xmltooling/AbstractSimpleElement.h>
30 #include <xmltooling/impl/AnyElement.h>
31 #include <xmltooling/io/AbstractXMLObjectMarshaller.h>
32 #include <xmltooling/io/AbstractXMLObjectUnmarshaller.h>
33 #include <xmltooling/util/XMLHelper.h>
34
35 #include <ctime>
36 #include <xercesc/util/XMLUniDefs.hpp>
37
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 using samlconstants::SAML20_NS;
48 using samlconstants::SAML20MD_NS;
49
50 #if defined (_MSC_VER)
51     #pragma warning( push )
52     #pragma warning( disable : 4250 4251 )
53 #endif
54
55 namespace opensaml {
56     namespace saml2md {
57
58         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,AffiliateMember);
59         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,AttributeProfile);
60         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,Company);
61         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,EmailAddress);
62         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,GivenName);
63         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,NameIDFormat);
64         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,SurName);
65         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,TelephoneNumber);
66
67         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,ActionNamespace);
68         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,SourceID);
69
70         class SAML_DLLLOCAL localizedNameTypeImpl : public virtual localizedNameType,
71             public AbstractSimpleElement,
72             public AbstractDOMCachingXMLObject,
73             public AbstractXMLObjectMarshaller,
74             public AbstractXMLObjectUnmarshaller
75         {
76             void init() {
77                 m_Lang=NULL;
78             }
79             
80         protected:
81             localizedNameTypeImpl() {
82                 init();
83             }
84             
85         public:
86             virtual ~localizedNameTypeImpl() {
87                 XMLString::release(&m_Lang);
88             }
89     
90             localizedNameTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
91                     : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
92                 init();
93             }
94                 
95             localizedNameTypeImpl(const localizedNameTypeImpl& src)
96                     : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
97                 init();
98                 setLang(src.getLang());
99             }
100             
101             IMPL_XMLOBJECT_CLONE(localizedNameType);
102             IMPL_STRING_ATTRIB(Lang);
103     
104         protected:
105             void marshallAttributes(DOMElement* domElement) const {
106                 MARSHALL_STRING_ATTRIB(Lang,LANG,xmlconstants::XML_NS);
107             }
108
109             void processAttribute(const DOMAttr* attribute) {
110                 PROC_STRING_ATTRIB(Lang,LANG,xmlconstants::XML_NS);
111                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
112             }
113         };
114
115         class SAML_DLLLOCAL localizedURITypeImpl : public virtual localizedURIType,
116             public AbstractSimpleElement,
117             public AbstractDOMCachingXMLObject,
118             public AbstractXMLObjectMarshaller,
119             public AbstractXMLObjectUnmarshaller
120         {
121             void init() {
122                 m_Lang=NULL;
123             }
124             
125         protected:
126             localizedURITypeImpl() {
127                 init();
128             }
129             
130         public:
131             virtual ~localizedURITypeImpl() {
132                 XMLString::release(&m_Lang);
133             }
134     
135             localizedURITypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
136                     : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
137                 init();
138             }
139                 
140             localizedURITypeImpl(const localizedURITypeImpl& src)
141                     : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
142                 init();
143                 setLang(src.getLang());
144             }
145             
146             IMPL_XMLOBJECT_CLONE(localizedURIType);
147             IMPL_STRING_ATTRIB(Lang);
148     
149         protected:
150             void marshallAttributes(DOMElement* domElement) const {
151                 MARSHALL_STRING_ATTRIB(Lang,LANG,xmlconstants::XML_NS);
152             }
153
154             void processAttribute(const DOMAttr* attribute) {
155                 PROC_STRING_ATTRIB(Lang,LANG,xmlconstants::XML_NS);
156                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
157             }
158         };
159
160         class SAML_DLLLOCAL OrganizationNameImpl : public virtual OrganizationName, public localizedNameTypeImpl
161         {
162         public:
163             virtual ~OrganizationNameImpl() {}
164     
165             OrganizationNameImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
166                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
167                 
168             OrganizationNameImpl(const OrganizationNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
169             
170             IMPL_XMLOBJECT_CLONE(OrganizationName);
171             localizedNameType* clonelocalizedNameType() const {
172                 return new OrganizationNameImpl(*this);
173             }
174         };
175                 
176         class SAML_DLLLOCAL OrganizationDisplayNameImpl : public virtual OrganizationDisplayName, public localizedNameTypeImpl
177         {
178         public:
179             virtual ~OrganizationDisplayNameImpl() {}
180     
181             OrganizationDisplayNameImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
182                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
183                 
184             OrganizationDisplayNameImpl(const OrganizationDisplayNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
185             
186             IMPL_XMLOBJECT_CLONE(OrganizationDisplayName);
187             localizedNameType* clonelocalizedNameType() const {
188                 return new OrganizationDisplayNameImpl(*this);
189             }
190         };
191
192         class SAML_DLLLOCAL OrganizationURLImpl : public virtual OrganizationURL, public localizedURITypeImpl
193         {
194         public:
195             virtual ~OrganizationURLImpl() {}
196     
197             OrganizationURLImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
198                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
199                 
200             OrganizationURLImpl(const OrganizationURLImpl& src) : AbstractXMLObject(src), localizedURITypeImpl(src) {}
201             
202             IMPL_XMLOBJECT_CLONE(OrganizationURL);
203             localizedURIType* clonelocalizedURIType() const {
204                 return new OrganizationURLImpl(*this);
205             }
206         };
207
208         class SAML_DLLLOCAL ServiceNameImpl : public virtual ServiceName, public localizedNameTypeImpl
209         {
210         public:
211             virtual ~ServiceNameImpl() {}
212     
213             ServiceNameImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
214                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
215                 
216             ServiceNameImpl(const ServiceNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
217             
218             IMPL_XMLOBJECT_CLONE(ServiceName);
219             localizedNameType* clonelocalizedNameType() const {
220                 return new ServiceNameImpl(*this);
221             }
222         };
223
224         class SAML_DLLLOCAL ServiceDescriptionImpl : public virtual ServiceDescription, public localizedNameTypeImpl
225         {
226         public:
227             virtual ~ServiceDescriptionImpl() {}
228     
229             ServiceDescriptionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
230                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
231                 
232             ServiceDescriptionImpl(const ServiceDescriptionImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
233             
234             IMPL_XMLOBJECT_CLONE(ServiceDescription);
235             localizedNameType* clonelocalizedNameType() const {
236                 return new ServiceDescriptionImpl(*this);
237             }
238         };
239
240         class SAML_DLLLOCAL ExtensionsImpl : public virtual Extensions,
241             public AbstractComplexElement,
242             public AbstractDOMCachingXMLObject,
243             public AbstractXMLObjectMarshaller,
244             public AbstractXMLObjectUnmarshaller
245         {
246         public:
247             virtual ~ExtensionsImpl() {}
248     
249             ExtensionsImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
250                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
251             }
252                 
253             ExtensionsImpl(const ExtensionsImpl& src)
254                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
255                 VectorOf(XMLObject) v=getUnknownXMLObjects();
256                 for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
257                     v.push_back((*i)->clone());
258             }
259             
260             IMPL_XMLOBJECT_CLONE(Extensions);
261             IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
262     
263         protected:
264             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
265                 // Unknown child.
266                 const XMLCh* nsURI=root->getNamespaceURI();
267                 if (!XMLString::equals(nsURI,SAML20MD_NS) && nsURI && *nsURI) {
268                     getUnknownXMLObjects().push_back(childXMLObject);
269                     return;
270                 }
271                 
272                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
273             }
274         };
275
276         class SAML_DLLLOCAL OrganizationImpl : public virtual Organization,
277             public AbstractComplexElement,
278             public AbstractAttributeExtensibleXMLObject,
279             public AbstractDOMCachingXMLObject,
280             public AbstractXMLObjectMarshaller,
281             public AbstractXMLObjectUnmarshaller
282         {
283             list<XMLObject*>::iterator m_pos_OrganizationDisplayName;
284             list<XMLObject*>::iterator m_pos_OrganizationURL;
285             
286             void init() {
287                 m_children.push_back(NULL);
288                 m_children.push_back(NULL);
289                 m_children.push_back(NULL);
290                 m_Extensions=NULL;
291                 m_pos_Extensions=m_children.begin();
292                 m_pos_OrganizationDisplayName=m_pos_Extensions;
293                 ++m_pos_OrganizationDisplayName;
294                 m_pos_OrganizationURL=m_pos_OrganizationDisplayName;
295                 ++m_pos_OrganizationURL;
296             }
297         public:
298             virtual ~OrganizationImpl() {}
299     
300             OrganizationImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
301                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
302                 init();
303             }
304                 
305             OrganizationImpl(const OrganizationImpl& src)
306                     : AbstractXMLObject(src), AbstractComplexElement(src),
307                         AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
308                 init();
309                 if (src.getExtensions())
310                     setExtensions(src.getExtensions()->cloneExtensions());
311                 VectorOf(OrganizationName) v=getOrganizationNames();
312                 for (vector<OrganizationName*>::const_iterator i=src.m_OrganizationNames.begin(); i!=src.m_OrganizationNames.end(); i++) {
313                     if (*i) {
314                         v.push_back((*i)->cloneOrganizationName());
315                     }
316                 }
317                 VectorOf(OrganizationDisplayName) w=getOrganizationDisplayNames();
318                 for (vector<OrganizationDisplayName*>::const_iterator j=src.m_OrganizationDisplayNames.begin(); j!=src.m_OrganizationDisplayNames.end(); j++) {
319                     if (*j) {
320                         w.push_back((*j)->cloneOrganizationDisplayName());
321                     }
322                 }
323                 VectorOf(OrganizationURL) x=getOrganizationURLs();
324                 for (vector<OrganizationURL*>::const_iterator k=src.m_OrganizationURLs.begin(); k!=src.m_OrganizationURLs.end(); k++) {
325                     if (*k) {
326                         x.push_back((*k)->cloneOrganizationURL());
327                     }
328                 }
329             }
330             
331             IMPL_XMLOBJECT_CLONE(Organization);
332             IMPL_TYPED_CHILD(Extensions);
333             IMPL_TYPED_CHILDREN(OrganizationName,m_pos_OrganizationDisplayName);
334             IMPL_TYPED_CHILDREN(OrganizationDisplayName,m_pos_OrganizationURL);
335             IMPL_TYPED_CHILDREN(OrganizationURL,m_children.end());
336     
337         protected:
338             void marshallAttributes(DOMElement* domElement) const {
339                 marshallExtensionAttributes(domElement);
340             }
341
342             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
343                 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
344                 PROC_TYPED_CHILDREN(OrganizationName,SAML20MD_NS,false);
345                 PROC_TYPED_CHILDREN(OrganizationDisplayName,SAML20MD_NS,false);
346                 PROC_TYPED_CHILDREN(OrganizationURL,SAML20MD_NS,false);
347                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
348             }
349
350             void processAttribute(const DOMAttr* attribute) {
351                 unmarshallExtensionAttribute(attribute);
352             }
353         };
354
355         class SAML_DLLLOCAL ContactPersonImpl : public virtual ContactPerson,
356             public AbstractComplexElement,
357             public AbstractAttributeExtensibleXMLObject,
358             public AbstractDOMCachingXMLObject,
359             public AbstractXMLObjectMarshaller,
360             public AbstractXMLObjectUnmarshaller
361         {
362             list<XMLObject*>::iterator m_pos_TelephoneNumber;
363             
364             void init() {
365                 m_ContactType=NULL;
366                 m_children.push_back(NULL);
367                 m_children.push_back(NULL);
368                 m_children.push_back(NULL);
369                 m_children.push_back(NULL);
370                 m_children.push_back(NULL);
371                 m_Extensions=NULL;
372                 m_Company=NULL;
373                 m_GivenName=NULL;
374                 m_SurName=NULL;
375                 m_pos_Extensions=m_children.begin();
376                 m_pos_Company=m_pos_Extensions;
377                 ++m_pos_Company;
378                 m_pos_GivenName=m_pos_Company;
379                 ++m_pos_GivenName;
380                 m_pos_SurName=m_pos_GivenName;
381                 ++m_pos_SurName;
382                 m_pos_TelephoneNumber=m_pos_SurName;
383                 ++m_pos_TelephoneNumber;
384             }
385         public:
386             virtual ~ContactPersonImpl() {}
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             KeyInfoIterator* getKeyInfoIterator() const {
960                 return new MetadataKeyInfoIterator(*this);
961             }
962
963             std::string getName() const {
964                 const EntityDescriptor* parent = dynamic_cast<const EntityDescriptor*>(getParent());
965                 if (parent) {
966                     char* ch = toUTF8(parent->getEntityID());
967                     if (ch) {
968                         string s(ch);
969                         delete[] ch;
970                         return s;
971                     }
972                 }
973                 return "";
974             }
975             
976             IMPL_ID_ATTRIB(ID);
977             IMPL_STRING_ATTRIB(ProtocolSupportEnumeration);
978             IMPL_STRING_ATTRIB(ErrorURL);
979             IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
980             IMPL_DATETIME_ATTRIB(CacheDuration,0);
981             IMPL_TYPED_CHILD(Extensions);
982             IMPL_TYPED_CHILDREN(KeyDescriptor,m_pos_Organization);
983             IMPL_TYPED_CHILD(Organization);
984             IMPL_TYPED_CHILDREN(ContactPerson,m_pos_ContactPerson);
985
986             bool hasSupport(const XMLCh* protocol) const {
987                 if (m_ProtocolSupportEnumeration) {
988                     // Look for first character.
989                     unsigned int len=XMLString::stringLen(protocol);
990                     unsigned int pos=0;
991                     int index=XMLString::indexOf(m_ProtocolSupportEnumeration,protocol[0],pos);
992                     while (index>=0) {
993                         // Only possible match is if it's the first character or a space comes before it.
994                         if (index==0 || m_ProtocolSupportEnumeration[index-1]==chSpace) {
995                             // See if rest of protocol string is present.
996                             if (0==XMLString::compareNString(m_ProtocolSupportEnumeration+index+1,protocol+1,len-1)) {
997                                 // Only possible match is if it's the last character or a space comes after it.
998                                 if (m_ProtocolSupportEnumeration[index+len]==chNull || m_ProtocolSupportEnumeration[index+len]==chSpace)
999                                     return true;
1000                                 else
1001                                     pos=index+len;
1002                             }
1003                             else {
1004                                 // Move past last search and start again.
1005                                 pos=index+1;
1006                             }
1007                         }
1008                         else {
1009                             // Move past last search and start again.
1010                             pos=index+1;
1011                         }
1012                         index=XMLString::indexOf(m_ProtocolSupportEnumeration,protocol[0],pos);
1013                     }
1014                 }
1015                 return false;
1016             }
1017     
1018             void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
1019                 if (!qualifiedName.hasNamespaceURI()) {
1020                     if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) {
1021                         setID(value);
1022                         return;
1023                     }
1024                     else if (XMLString::equals(qualifiedName.getLocalPart(),PROTOCOLSUPPORTENUMERATION_ATTRIB_NAME)) {
1025                         setProtocolSupportEnumeration(value);
1026                         return;
1027                     }
1028                     else if (XMLString::equals(qualifiedName.getLocalPart(),ERRORURL_ATTRIB_NAME)) {
1029                         setErrorURL(value);
1030                         return;
1031                     }
1032                     else if (XMLString::equals(qualifiedName.getLocalPart(),VALIDUNTIL_ATTRIB_NAME)) {
1033                         setValidUntil(value);
1034                         return;
1035                     }
1036                     else if (XMLString::equals(qualifiedName.getLocalPart(),CACHEDURATION_ATTRIB_NAME)) {
1037                         setCacheDuration(value);
1038                         return;
1039                     }
1040                 }
1041                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
1042             }
1043
1044         protected:
1045             void marshallAttributes(DOMElement* domElement) const {
1046                 MARSHALL_ID_ATTRIB(ID,ID,NULL);
1047                 MARSHALL_STRING_ATTRIB(ProtocolSupportEnumeration,PROTOCOLSUPPORTENUMERATION,NULL);
1048                 MARSHALL_STRING_ATTRIB(ErrorURL,ERRORURL,NULL);
1049                 MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,NULL);
1050                 MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,NULL);
1051                 marshallExtensionAttributes(domElement);
1052             }
1053
1054             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1055                 PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLSIG_NS,false);
1056                 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
1057                 PROC_TYPED_CHILDREN(KeyDescriptor,SAML20MD_NS,false);
1058                 PROC_TYPED_CHILD(Organization,SAML20MD_NS,false);
1059                 PROC_TYPED_CHILDREN(ContactPerson,SAML20MD_NS,false);
1060                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
1061             }
1062
1063             void processAttribute(const DOMAttr* attribute) {
1064                 PROC_ID_ATTRIB(ID,ID,NULL);
1065                 unmarshallExtensionAttribute(attribute);
1066             }
1067         };
1068
1069         class SAML_DLLLOCAL SSODescriptorTypeImpl : public virtual SSODescriptorType, public RoleDescriptorImpl
1070         {
1071             void init() {
1072                 m_children.push_back(NULL);
1073                 m_children.push_back(NULL);
1074                 m_children.push_back(NULL);
1075                 m_children.push_back(NULL);
1076                 m_pos_ArtifactResolutionService=m_pos_ContactPerson;
1077                 ++m_pos_ArtifactResolutionService;
1078                 m_pos_SingleLogoutService=m_pos_ArtifactResolutionService;
1079                 ++m_pos_SingleLogoutService;
1080                 m_pos_ManageNameIDService=m_pos_SingleLogoutService;
1081                 ++m_pos_ManageNameIDService;
1082                 m_pos_NameIDFormat=m_pos_ManageNameIDService;
1083                 ++m_pos_NameIDFormat;
1084             }
1085         
1086         protected:
1087             list<XMLObject*>::iterator m_pos_ArtifactResolutionService;
1088             list<XMLObject*>::iterator m_pos_SingleLogoutService;
1089             list<XMLObject*>::iterator m_pos_ManageNameIDService;
1090             list<XMLObject*>::iterator m_pos_NameIDFormat;
1091             
1092             SSODescriptorTypeImpl() {
1093                 init();
1094             }
1095         
1096         public:
1097             virtual ~SSODescriptorTypeImpl() {}
1098     
1099             SSODescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1100                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1101                 init();
1102             }
1103                 
1104             SSODescriptorTypeImpl(const SSODescriptorTypeImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1105                 init();
1106                 VectorOf(ArtifactResolutionService) v=getArtifactResolutionServices();
1107                 for (vector<ArtifactResolutionService*>::const_iterator i=src.m_ArtifactResolutionServices.begin(); i!=src.m_ArtifactResolutionServices.end(); i++) {
1108                     if (*i) {
1109                         v.push_back((*i)->cloneArtifactResolutionService());
1110                     }
1111                 }
1112                 VectorOf(SingleLogoutService) w=getSingleLogoutServices();
1113                 for (vector<SingleLogoutService*>::const_iterator j=src.m_SingleLogoutServices.begin(); j!=src.m_SingleLogoutServices.end(); j++) {
1114                     if (*j) {
1115                         w.push_back((*j)->cloneSingleLogoutService());
1116                     }
1117                 }
1118                 VectorOf(ManageNameIDService) x=getManageNameIDServices();
1119                 for (vector<ManageNameIDService*>::const_iterator k=src.m_ManageNameIDServices.begin(); k!=src.m_ManageNameIDServices.end(); k++) {
1120                     if (*k) {
1121                         x.push_back((*k)->cloneManageNameIDService());
1122                     }
1123                 }
1124                 VectorOf(NameIDFormat) y=getNameIDFormats();
1125                 for (vector<NameIDFormat*>::const_iterator m=src.m_NameIDFormats.begin(); m!=src.m_NameIDFormats.end(); m++) {
1126                     if (*m) {
1127                         y.push_back((*m)->cloneNameIDFormat());
1128                     }
1129                 }
1130             }
1131             
1132             IMPL_TYPED_CHILDREN(ArtifactResolutionService,m_pos_ArtifactResolutionService);
1133             IMPL_TYPED_CHILDREN(SingleLogoutService,m_pos_SingleLogoutService);
1134             IMPL_TYPED_CHILDREN(ManageNameIDService,m_pos_ManageNameIDService);
1135             IMPL_TYPED_CHILDREN(NameIDFormat,m_pos_NameIDFormat);
1136
1137         protected:
1138             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1139                 PROC_TYPED_CHILDREN(ArtifactResolutionService,SAML20MD_NS,false);
1140                 PROC_TYPED_CHILDREN(SingleLogoutService,SAML20MD_NS,false);
1141                 PROC_TYPED_CHILDREN(ManageNameIDService,SAML20MD_NS,false);
1142                 PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
1143                 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1144             }
1145         };
1146
1147         class SAML_DLLLOCAL IDPSSODescriptorImpl : public virtual IDPSSODescriptor, public SSODescriptorTypeImpl
1148         {
1149             list<XMLObject*>::iterator m_pos_SingleSignOnService;
1150             list<XMLObject*>::iterator m_pos_NameIDMappingService;
1151             list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
1152             list<XMLObject*>::iterator m_pos_AttributeProfile;
1153             
1154             void init() {
1155                 m_WantAuthnRequestsSigned=XML_BOOL_NULL;
1156                 m_children.push_back(NULL);
1157                 m_children.push_back(NULL);
1158                 m_children.push_back(NULL);
1159                 m_children.push_back(NULL);
1160                 m_pos_SingleSignOnService=m_pos_NameIDFormat;
1161                 ++m_pos_SingleSignOnService;
1162                 m_pos_NameIDMappingService=m_pos_SingleSignOnService;
1163                 ++m_pos_NameIDMappingService;
1164                 m_pos_AssertionIDRequestService=m_pos_NameIDMappingService;
1165                 ++m_pos_AssertionIDRequestService;
1166                 m_pos_AttributeProfile=m_pos_AssertionIDRequestService;
1167                 ++m_pos_AttributeProfile;
1168             }
1169         
1170         public:
1171             virtual ~IDPSSODescriptorImpl() {}
1172     
1173             IDPSSODescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1174                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1175                 init();
1176             }
1177                 
1178             IDPSSODescriptorImpl(const IDPSSODescriptorImpl& src) : AbstractXMLObject(src), SSODescriptorTypeImpl(src) {
1179                 init();
1180                 WantAuthnRequestsSigned(src.m_WantAuthnRequestsSigned);
1181                 VectorOf(SingleSignOnService) v=getSingleSignOnServices();
1182                 for (vector<SingleSignOnService*>::const_iterator i=src.m_SingleSignOnServices.begin(); i!=src.m_SingleSignOnServices.end(); i++) {
1183                     if (*i) {
1184                         v.push_back((*i)->cloneSingleSignOnService());
1185                     }
1186                 }
1187                 VectorOf(NameIDMappingService) w=getNameIDMappingServices();
1188                 for (vector<NameIDMappingService*>::const_iterator j=src.m_NameIDMappingServices.begin(); j!=src.m_NameIDMappingServices.end(); j++) {
1189                     if (*j) {
1190                         w.push_back((*j)->cloneNameIDMappingService());
1191                     }
1192                 }
1193                 VectorOf(AssertionIDRequestService) x=getAssertionIDRequestServices();
1194                 for (vector<AssertionIDRequestService*>::const_iterator k=src.m_AssertionIDRequestServices.begin(); k!=src.m_AssertionIDRequestServices.end(); k++) {
1195                     if (*k) {
1196                         x.push_back((*k)->cloneAssertionIDRequestService());
1197                     }
1198                 }
1199                 VectorOf(AttributeProfile) y=getAttributeProfiles();
1200                 for (vector<AttributeProfile*>::const_iterator m=src.m_AttributeProfiles.begin(); m!=src.m_AttributeProfiles.end(); m++) {
1201                     if (*m) {
1202                         y.push_back((*m)->cloneAttributeProfile());
1203                     }
1204                 }
1205                 VectorOf(Attribute) z=getAttributes();
1206                 for (vector<Attribute*>::const_iterator n=src.m_Attributes.begin(); n!=src.m_Attributes.end(); n++) {
1207                     if (*n) {
1208                         z.push_back((*n)->cloneAttribute());
1209                     }
1210                 }
1211             }
1212             
1213             IMPL_XMLOBJECT_CLONE(IDPSSODescriptor);
1214             SSODescriptorType* cloneSSODescriptorType() const {
1215                 return new IDPSSODescriptorImpl(*this);
1216             }
1217             RoleDescriptor* cloneRoleDescriptor() const {
1218                 return new IDPSSODescriptorImpl(*this);
1219             }
1220             
1221             IMPL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned);
1222             IMPL_TYPED_CHILDREN(SingleSignOnService,m_pos_SingleSignOnService);
1223             IMPL_TYPED_CHILDREN(NameIDMappingService,m_pos_NameIDMappingService);
1224             IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
1225             IMPL_TYPED_CHILDREN(AttributeProfile,m_pos_AttributeProfile);
1226             IMPL_TYPED_FOREIGN_CHILDREN(Attribute,saml2,m_children.end());
1227
1228             void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
1229                 if (!qualifiedName.hasNamespaceURI()) {
1230                     if (XMLString::equals(qualifiedName.getLocalPart(),WANTAUTHNREQUESTSSIGNED_ATTRIB_NAME)) {
1231                         setWantAuthnRequestsSigned(value);
1232                         return;
1233                     }
1234                 }
1235                 RoleDescriptorImpl::setAttribute(qualifiedName, value, ID);
1236             }
1237
1238         protected:
1239             void marshallAttributes(DOMElement* domElement) const {
1240                 MARSHALL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned,WANTAUTHNREQUESTSSIGNED,NULL);
1241                 RoleDescriptorImpl::marshallAttributes(domElement);
1242             }
1243             
1244             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1245                 PROC_TYPED_CHILDREN(SingleSignOnService,SAML20MD_NS,false);
1246                 PROC_TYPED_CHILDREN(NameIDMappingService,SAML20MD_NS,false);
1247                 PROC_TYPED_CHILDREN(AssertionIDRequestService,SAML20MD_NS,false);
1248                 PROC_TYPED_CHILDREN(AttributeProfile,SAML20MD_NS,false);
1249                 PROC_TYPED_FOREIGN_CHILDREN(Attribute,saml2,SAML20_NS,false);
1250                 SSODescriptorTypeImpl::processChildElement(childXMLObject,root);
1251             }
1252         };
1253
1254         class SAML_DLLLOCAL RequestedAttributeImpl : public virtual RequestedAttribute,
1255             public AbstractComplexElement,
1256             public AbstractAttributeExtensibleXMLObject,
1257             public AbstractDOMCachingXMLObject,
1258             public AbstractXMLObjectMarshaller,
1259             public AbstractXMLObjectUnmarshaller
1260         {
1261             void init() {
1262                 m_Name=m_NameFormat=m_FriendlyName=NULL;
1263                 m_isRequired=XML_BOOL_NULL;
1264             }
1265         public:
1266             virtual ~RequestedAttributeImpl() {
1267                 XMLString::release(&m_Name);
1268                 XMLString::release(&m_NameFormat);
1269                 XMLString::release(&m_FriendlyName);
1270             }
1271     
1272             RequestedAttributeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1273                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1274                 init();
1275             }
1276                 
1277             RequestedAttributeImpl(const RequestedAttributeImpl& src)
1278                     : AbstractXMLObject(src), AbstractComplexElement(src),
1279                         AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
1280                 init();
1281                 setName(src.getName());
1282                 setNameFormat(src.getNameFormat());
1283                 setFriendlyName(src.getFriendlyName());
1284                 isRequired(src.m_isRequired);
1285                 VectorOf(XMLObject) v=getAttributeValues();
1286                 for (vector<XMLObject*>::const_iterator i=src.m_AttributeValues.begin(); i!=src.m_AttributeValues.end(); i++) {
1287                     if (*i) {
1288                         v.push_back((*i)->clone());
1289                     }
1290                 }
1291             }
1292             
1293             IMPL_XMLOBJECT_CLONE(RequestedAttribute);
1294             Attribute* cloneAttribute() const {
1295                 return new RequestedAttributeImpl(*this);
1296             }
1297             
1298             IMPL_STRING_ATTRIB(Name);
1299             IMPL_STRING_ATTRIB(NameFormat);
1300             IMPL_STRING_ATTRIB(FriendlyName);
1301             IMPL_BOOLEAN_ATTRIB(isRequired);
1302             IMPL_XMLOBJECT_CHILDREN(AttributeValue,m_children.end());
1303     
1304             void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
1305                 if (!qualifiedName.hasNamespaceURI()) {
1306                     if (XMLString::equals(qualifiedName.getLocalPart(),NAME_ATTRIB_NAME)) {
1307                         setName(value);
1308                         return;
1309                     }
1310                     else if (XMLString::equals(qualifiedName.getLocalPart(),NAMEFORMAT_ATTRIB_NAME)) {
1311                         setNameFormat(value);
1312                         return;
1313                     }
1314                     else if (XMLString::equals(qualifiedName.getLocalPart(),FRIENDLYNAME_ATTRIB_NAME)) {
1315                         setFriendlyName(value);
1316                         return;
1317                     }
1318                     else if (XMLString::equals(qualifiedName.getLocalPart(),ISREQUIRED_ATTRIB_NAME)) {
1319                         setisRequired(value);
1320                         return;
1321                     }
1322                 }
1323                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
1324             }
1325
1326         protected:
1327             void marshallAttributes(DOMElement* domElement) const {
1328                 MARSHALL_STRING_ATTRIB(Name,NAME,NULL);
1329                 MARSHALL_STRING_ATTRIB(NameFormat,NAMEFORMAT,NULL);
1330                 MARSHALL_STRING_ATTRIB(FriendlyName,FRIENDLYNAME,NULL);
1331                 MARSHALL_BOOLEAN_ATTRIB(isRequired,ISREQUIRED,NULL);
1332                 marshallExtensionAttributes(domElement);
1333             }
1334
1335             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1336                 getAttributeValues().push_back(childXMLObject);
1337             }
1338
1339             void processAttribute(const DOMAttr* attribute) {
1340                 unmarshallExtensionAttribute(attribute);
1341             }
1342         };
1343
1344         class SAML_DLLLOCAL AttributeConsumingServiceImpl : public virtual AttributeConsumingService,
1345             public AbstractComplexElement,
1346             public AbstractDOMCachingXMLObject,
1347             public AbstractXMLObjectMarshaller,
1348             public AbstractXMLObjectUnmarshaller
1349         {
1350             list<XMLObject*>::iterator m_pos_ServiceDescription;
1351             list<XMLObject*>::iterator m_pos_RequestedAttribute;
1352             
1353                 void init() {
1354                 m_Index=NULL;
1355                 m_isDefault=XML_BOOL_NULL;
1356                 m_children.push_back(NULL);
1357                 m_children.push_back(NULL);
1358                 m_pos_ServiceDescription=m_children.begin();
1359                 m_pos_RequestedAttribute=m_pos_ServiceDescription;
1360                 ++m_pos_RequestedAttribute;
1361             }
1362
1363         public:
1364             virtual ~AttributeConsumingServiceImpl() {
1365                 XMLString::release(&m_Index);
1366             }
1367     
1368             AttributeConsumingServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1369                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1370                 init();
1371             }
1372                 
1373             AttributeConsumingServiceImpl(const AttributeConsumingServiceImpl& src)
1374                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
1375                 init();
1376                 setIndex(src.m_Index);
1377                 isDefault(src.m_isDefault);
1378                 VectorOf(ServiceName) v=getServiceNames();
1379                 for (vector<ServiceName*>::const_iterator i=src.m_ServiceNames.begin(); i!=src.m_ServiceNames.end(); i++) {
1380                     if (*i) {
1381                         v.push_back((*i)->cloneServiceName());
1382                     }
1383                 }
1384                 VectorOf(ServiceDescription) w=getServiceDescriptions();
1385                 for (vector<ServiceDescription*>::const_iterator j=src.m_ServiceDescriptions.begin(); j!=src.m_ServiceDescriptions.end(); j++) {
1386                     if (*j) {
1387                         w.push_back((*j)->cloneServiceDescription());
1388                     }
1389                 }
1390                 VectorOf(RequestedAttribute) x=getRequestedAttributes();
1391                 for (vector<RequestedAttribute*>::const_iterator k=src.m_RequestedAttributes.begin(); k!=src.m_RequestedAttributes.end(); k++) {
1392                     if (*k) {
1393                         x.push_back((*k)->cloneRequestedAttribute());
1394                     }
1395                 }
1396             }
1397             
1398             IMPL_XMLOBJECT_CLONE(AttributeConsumingService);
1399             IMPL_INTEGER_ATTRIB(Index);
1400             IMPL_BOOLEAN_ATTRIB(isDefault);
1401             IMPL_TYPED_CHILDREN(ServiceName,m_pos_ServiceDescription);
1402             IMPL_TYPED_CHILDREN(ServiceDescription,m_pos_RequestedAttribute);
1403             IMPL_TYPED_CHILDREN(RequestedAttribute,m_children.end());
1404     
1405         protected:
1406             void marshallAttributes(DOMElement* domElement) const {
1407                 MARSHALL_INTEGER_ATTRIB(Index,INDEX,NULL);
1408                 MARSHALL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,NULL);
1409             }
1410
1411             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1412                 PROC_TYPED_CHILDREN(ServiceName,SAML20MD_NS,false);
1413                 PROC_TYPED_CHILDREN(ServiceDescription,SAML20MD_NS,false);
1414                 PROC_TYPED_CHILDREN(RequestedAttribute,SAML20MD_NS,false);
1415                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
1416             }
1417
1418             void processAttribute(const DOMAttr* attribute) {
1419                 PROC_INTEGER_ATTRIB(Index,INDEX,NULL);
1420                 PROC_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,NULL);
1421                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
1422             }
1423         };
1424
1425         class SAML_DLLLOCAL SPSSODescriptorImpl : public virtual SPSSODescriptor, public SSODescriptorTypeImpl
1426         {
1427             list<XMLObject*>::iterator m_pos_AssertionConsumerService;
1428             
1429             void init() {
1430                 m_AuthnRequestsSigned=XML_BOOL_NULL;
1431                 m_WantAssertionsSigned=XML_BOOL_NULL;
1432                 m_children.push_back(NULL);
1433                 m_pos_AssertionConsumerService=m_pos_NameIDFormat;
1434                 ++m_pos_AssertionConsumerService;
1435             }
1436         
1437         public:
1438             virtual ~SPSSODescriptorImpl() {}
1439     
1440             SPSSODescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1441                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1442                 init();
1443             }
1444                 
1445             SPSSODescriptorImpl(const SPSSODescriptorImpl& src) : AbstractXMLObject(src), SSODescriptorTypeImpl(src) {
1446                 init();
1447                 AuthnRequestsSigned(src.m_AuthnRequestsSigned);
1448                 WantAssertionsSigned(src.m_WantAssertionsSigned);
1449                 VectorOf(AssertionConsumerService) v=getAssertionConsumerServices();
1450                 for (vector<AssertionConsumerService*>::const_iterator i=src.m_AssertionConsumerServices.begin(); i!=src.m_AssertionConsumerServices.end(); i++) {
1451                     if (*i) {
1452                         v.push_back((*i)->cloneAssertionConsumerService());
1453                     }
1454                 }
1455                 VectorOf(AttributeConsumingService) w=getAttributeConsumingServices();
1456                 for (vector<AttributeConsumingService*>::const_iterator j=src.m_AttributeConsumingServices.begin(); j!=src.m_AttributeConsumingServices.end(); j++) {
1457                     if (*j) {
1458                         w.push_back((*j)->cloneAttributeConsumingService());
1459                     }
1460                 }
1461             }
1462             
1463             IMPL_XMLOBJECT_CLONE(SPSSODescriptor);
1464             SSODescriptorType* cloneSSODescriptorType() const {
1465                 return cloneSPSSODescriptor();
1466             }
1467             RoleDescriptor* cloneRoleDescriptor() const {
1468                 return cloneSPSSODescriptor();
1469             }
1470             
1471             IMPL_BOOLEAN_ATTRIB(AuthnRequestsSigned);
1472             IMPL_BOOLEAN_ATTRIB(WantAssertionsSigned);
1473             IMPL_TYPED_CHILDREN(AssertionConsumerService,m_pos_AssertionConsumerService);
1474             IMPL_TYPED_CHILDREN(AttributeConsumingService,m_children.end());
1475
1476             void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
1477                 if (!qualifiedName.hasNamespaceURI()) {
1478                     if (XMLString::equals(qualifiedName.getLocalPart(),AUTHNREQUESTSSIGNED_ATTRIB_NAME)) {
1479                         setAuthnRequestsSigned(value);
1480                         return;
1481                     }
1482                     else if (XMLString::equals(qualifiedName.getLocalPart(),WANTASSERTIONSSIGNED_ATTRIB_NAME)) {
1483                         setWantAssertionsSigned(value);
1484                         return;
1485                     }
1486                 }
1487                 RoleDescriptorImpl::setAttribute(qualifiedName, value, ID);
1488             }
1489
1490         protected:
1491             void marshallAttributes(DOMElement* domElement) const {
1492                 MARSHALL_BOOLEAN_ATTRIB(AuthnRequestsSigned,AUTHNREQUESTSSIGNED,NULL);
1493                 MARSHALL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,NULL);
1494                 RoleDescriptorImpl::marshallAttributes(domElement);
1495             }
1496             
1497             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1498                 PROC_TYPED_CHILDREN(AssertionConsumerService,SAML20MD_NS,false);
1499                 PROC_TYPED_CHILDREN(AttributeConsumingService,SAML20MD_NS,false);
1500                 SSODescriptorTypeImpl::processChildElement(childXMLObject,root);
1501             }
1502         };
1503
1504         class SAML_DLLLOCAL AuthnAuthorityDescriptorImpl : public virtual AuthnAuthorityDescriptor, public RoleDescriptorImpl
1505         {
1506             list<XMLObject*>::iterator m_pos_AuthnQueryService;
1507             list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
1508             
1509             void init() {
1510                 m_children.push_back(NULL);
1511                 m_children.push_back(NULL);
1512                 m_pos_AuthnQueryService=m_pos_ContactPerson;
1513                 ++m_pos_AuthnQueryService;
1514                 m_pos_AssertionIDRequestService=m_pos_AuthnQueryService;
1515                 ++m_pos_AssertionIDRequestService;
1516             }
1517         
1518         public:
1519             virtual ~AuthnAuthorityDescriptorImpl() {}
1520     
1521             AuthnAuthorityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1522                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1523                 init();
1524             }
1525                 
1526             AuthnAuthorityDescriptorImpl(const AuthnAuthorityDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1527                 init();
1528                 VectorOf(AuthnQueryService) v=getAuthnQueryServices();
1529                 for (vector<AuthnQueryService*>::const_iterator i=src.m_AuthnQueryServices.begin(); i!=src.m_AuthnQueryServices.end(); i++) {
1530                     if (*i) {
1531                         v.push_back((*i)->cloneAuthnQueryService());
1532                     }
1533                 }
1534                 VectorOf(AssertionIDRequestService) w=getAssertionIDRequestServices();
1535                 for (vector<AssertionIDRequestService*>::const_iterator j=src.m_AssertionIDRequestServices.begin(); j!=src.m_AssertionIDRequestServices.end(); j++) {
1536                     if (*j) {
1537                         w.push_back((*j)->cloneAssertionIDRequestService());
1538                     }
1539                 }
1540                 VectorOf(NameIDFormat) x=getNameIDFormats();
1541                 for (vector<NameIDFormat*>::const_iterator k=src.m_NameIDFormats.begin(); k!=src.m_NameIDFormats.end(); k++) {
1542                     if (*k) {
1543                         x.push_back((*k)->cloneNameIDFormat());
1544                     }
1545                 }
1546             }
1547             
1548             IMPL_XMLOBJECT_CLONE(AuthnAuthorityDescriptor);
1549             RoleDescriptor* cloneRoleDescriptor() const {
1550                 return cloneAuthnAuthorityDescriptor();
1551             }
1552             
1553             IMPL_TYPED_CHILDREN(AuthnQueryService,m_pos_AuthnQueryService);
1554             IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
1555             IMPL_TYPED_CHILDREN(NameIDFormat,m_children.end());
1556
1557         protected:
1558             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1559                 PROC_TYPED_CHILDREN(AuthnQueryService,SAML20MD_NS,false);
1560                 PROC_TYPED_CHILDREN(AssertionIDRequestService,SAML20MD_NS,false);
1561                 PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
1562                 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1563             }
1564         };
1565
1566         class SAML_DLLLOCAL PDPDescriptorImpl : public virtual PDPDescriptor, public RoleDescriptorImpl
1567         {
1568             list<XMLObject*>::iterator m_pos_AuthzService;
1569             list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
1570             
1571             void init() {
1572                 m_children.push_back(NULL);
1573                 m_children.push_back(NULL);
1574                 m_pos_AuthzService=m_pos_ContactPerson;
1575                 ++m_pos_AuthzService;
1576                 m_pos_AssertionIDRequestService=m_pos_AuthzService;
1577                 ++m_pos_AssertionIDRequestService;
1578             }
1579         
1580         public:
1581             virtual ~PDPDescriptorImpl() {}
1582     
1583             PDPDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1584                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1585                 init();
1586             }
1587                 
1588             PDPDescriptorImpl(const PDPDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1589                 init();
1590                 VectorOf(AuthzService) v=getAuthzServices();
1591                 for (vector<AuthzService*>::const_iterator i=src.m_AuthzServices.begin(); i!=src.m_AuthzServices.end(); i++) {
1592                     if (*i) {
1593                         v.push_back((*i)->cloneAuthzService());
1594                     }
1595                 }
1596                 VectorOf(AssertionIDRequestService) w=getAssertionIDRequestServices();
1597                 for (vector<AssertionIDRequestService*>::const_iterator j=src.m_AssertionIDRequestServices.begin(); j!=src.m_AssertionIDRequestServices.end(); j++) {
1598                     if (*j) {
1599                         w.push_back((*j)->cloneAssertionIDRequestService());
1600                     }
1601                 }
1602                 VectorOf(NameIDFormat) x=getNameIDFormats();
1603                 for (vector<NameIDFormat*>::const_iterator k=src.m_NameIDFormats.begin(); k!=src.m_NameIDFormats.end(); k++) {
1604                     if (*k) {
1605                         x.push_back((*k)->cloneNameIDFormat());
1606                     }
1607                 }
1608             }
1609             
1610             IMPL_XMLOBJECT_CLONE(PDPDescriptor);
1611             RoleDescriptor* cloneRoleDescriptor() const {
1612                 return clonePDPDescriptor();
1613             }
1614             
1615             IMPL_TYPED_CHILDREN(AuthzService,m_pos_AuthzService);
1616             IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
1617             IMPL_TYPED_CHILDREN(NameIDFormat,m_children.end());
1618
1619         protected:
1620             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1621                 PROC_TYPED_CHILDREN(AuthzService,SAML20MD_NS,false);
1622                 PROC_TYPED_CHILDREN(AssertionIDRequestService,SAML20MD_NS,false);
1623                 PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
1624                 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1625             }
1626         };
1627
1628         class SAML_DLLLOCAL AttributeAuthorityDescriptorImpl : public virtual AttributeAuthorityDescriptor, public RoleDescriptorImpl
1629         {
1630             list<XMLObject*>::iterator m_pos_AttributeService;
1631             list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
1632             list<XMLObject*>::iterator m_pos_NameIDFormat;
1633             list<XMLObject*>::iterator m_pos_AttributeProfile;
1634         
1635             void init() {
1636                 m_children.push_back(NULL);
1637                 m_children.push_back(NULL);
1638                 m_children.push_back(NULL);
1639                 m_children.push_back(NULL);
1640                 m_pos_AttributeService=m_pos_ContactPerson;
1641                 ++m_pos_AttributeService;
1642                 m_pos_AssertionIDRequestService=m_pos_AttributeService;
1643                 ++m_pos_AssertionIDRequestService;
1644                 m_pos_NameIDFormat=m_pos_AssertionIDRequestService;
1645                 ++m_pos_NameIDFormat;
1646                 m_pos_AttributeProfile=m_pos_NameIDFormat;
1647                 ++m_pos_AttributeProfile;
1648             }
1649         
1650         public:
1651             virtual ~AttributeAuthorityDescriptorImpl() {}
1652     
1653             AttributeAuthorityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1654                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1655                 init();
1656             }
1657                 
1658             AttributeAuthorityDescriptorImpl(const AttributeAuthorityDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1659                 init();
1660                 VectorOf(AttributeService) v=getAttributeServices();
1661                 for (vector<AttributeService*>::const_iterator i=src.m_AttributeServices.begin(); i!=src.m_AttributeServices.end(); i++) {
1662                     if (*i) {
1663                         v.push_back((*i)->cloneAttributeService());
1664                     }
1665                 }
1666                 VectorOf(AssertionIDRequestService) w=getAssertionIDRequestServices();
1667                 for (vector<AssertionIDRequestService*>::const_iterator j=src.m_AssertionIDRequestServices.begin(); j!=src.m_AssertionIDRequestServices.end(); j++) {
1668                     if (*j) {
1669                         w.push_back((*j)->cloneAssertionIDRequestService());
1670                     }
1671                 }
1672                 VectorOf(NameIDFormat) x=getNameIDFormats();
1673                 for (vector<NameIDFormat*>::const_iterator k=src.m_NameIDFormats.begin(); k!=src.m_NameIDFormats.end(); k++) {
1674                     if (*k) {
1675                         x.push_back((*k)->cloneNameIDFormat());
1676                     }
1677                 }
1678                 VectorOf(AttributeProfile) y=getAttributeProfiles();
1679                 for (vector<AttributeProfile*>::const_iterator m=src.m_AttributeProfiles.begin(); m!=src.m_AttributeProfiles.end(); m++) {
1680                     if (*m) {
1681                         y.push_back((*m)->cloneAttributeProfile());
1682                     }
1683                 }
1684                 VectorOf(Attribute) z=getAttributes();
1685                 for (vector<Attribute*>::const_iterator n=src.m_Attributes.begin(); n!=src.m_Attributes.end(); n++) {
1686                     if (*n) {
1687                         z.push_back((*n)->cloneAttribute());
1688                     }
1689                 }
1690             }
1691
1692             IMPL_XMLOBJECT_CLONE(AttributeAuthorityDescriptor);
1693             RoleDescriptor* cloneRoleDescriptor() const {
1694                 return cloneAttributeAuthorityDescriptor();
1695             }
1696             
1697             IMPL_TYPED_CHILDREN(AttributeService,m_pos_AttributeService);
1698             IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
1699             IMPL_TYPED_CHILDREN(NameIDFormat,m_pos_NameIDFormat);
1700             IMPL_TYPED_CHILDREN(AttributeProfile,m_pos_AttributeProfile);
1701             IMPL_TYPED_FOREIGN_CHILDREN(Attribute,saml2,m_children.end());
1702
1703         protected:
1704             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1705                 PROC_TYPED_CHILDREN(AttributeService,SAML20MD_NS,false);
1706                 PROC_TYPED_CHILDREN(AssertionIDRequestService,SAML20MD_NS,false);
1707                 PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
1708                 PROC_TYPED_CHILDREN(AttributeProfile,SAML20MD_NS,false);
1709                 PROC_TYPED_FOREIGN_CHILDREN(Attribute,saml2,SAML20_NS,false);
1710                 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1711             }
1712         };
1713
1714         class SAML_DLLLOCAL QueryDescriptorTypeImpl : public virtual QueryDescriptorType, public RoleDescriptorImpl
1715         {
1716             void init() {
1717                 m_WantAssertionsSigned=XML_BOOL_NULL;
1718                 m_children.push_back(NULL);
1719                 m_pos_NameIDFormat=m_pos_ContactPerson;
1720                 ++m_pos_NameIDFormat;
1721             }
1722         
1723         protected:
1724             list<XMLObject*>::iterator m_pos_NameIDFormat;
1725             
1726             QueryDescriptorTypeImpl() {
1727                 init();
1728             }
1729         
1730         public:
1731             virtual ~QueryDescriptorTypeImpl() {}
1732     
1733             QueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1734                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1735                 init();
1736             }
1737                 
1738             QueryDescriptorTypeImpl(const QueryDescriptorTypeImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1739                 init();
1740                 WantAssertionsSigned(src.m_WantAssertionsSigned);
1741                 VectorOf(NameIDFormat) y=getNameIDFormats();
1742                 for (vector<NameIDFormat*>::const_iterator m=src.m_NameIDFormats.begin(); m!=src.m_NameIDFormats.end(); m++) {
1743                     if (*m) {
1744                         y.push_back((*m)->cloneNameIDFormat());
1745                     }
1746                 }
1747             }
1748             
1749             IMPL_BOOLEAN_ATTRIB(WantAssertionsSigned);
1750             IMPL_TYPED_CHILDREN(NameIDFormat,m_pos_NameIDFormat);
1751
1752             void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
1753                 if (!qualifiedName.hasNamespaceURI()) {
1754                     if (XMLString::equals(qualifiedName.getLocalPart(),WANTASSERTIONSSIGNED_ATTRIB_NAME)) {
1755                         setWantAssertionsSigned(value);
1756                         return;
1757                     }
1758                 }
1759                 RoleDescriptorImpl::setAttribute(qualifiedName, value, ID);
1760             }
1761
1762         protected:
1763             void marshallAttributes(DOMElement* domElement) const {
1764                 MARSHALL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,NULL);
1765                 RoleDescriptorImpl::marshallAttributes(domElement);
1766             }
1767
1768             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1769                 PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
1770                 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1771             }
1772         };
1773
1774         class SAML_DLLLOCAL AuthnQueryDescriptorTypeImpl : public virtual AuthnQueryDescriptorType, public QueryDescriptorTypeImpl
1775         {
1776         public:
1777             virtual ~AuthnQueryDescriptorTypeImpl() {}
1778     
1779             AuthnQueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1780                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
1781                 
1782             AuthnQueryDescriptorTypeImpl(const AuthnQueryDescriptorTypeImpl& src) : AbstractXMLObject(src), QueryDescriptorTypeImpl(src) {}
1783             
1784             IMPL_XMLOBJECT_CLONE(AuthnQueryDescriptorType);
1785             QueryDescriptorType* cloneQueryDescriptorType() const {
1786                 return new AuthnQueryDescriptorTypeImpl(*this);
1787             }
1788             RoleDescriptor* cloneRoleDescriptor() const {
1789                 return new AuthnQueryDescriptorTypeImpl(*this);
1790             }
1791         };
1792
1793         class SAML_DLLLOCAL AttributeQueryDescriptorTypeImpl : public virtual AttributeQueryDescriptorType, public QueryDescriptorTypeImpl
1794         {
1795         public:
1796             virtual ~AttributeQueryDescriptorTypeImpl() {}
1797     
1798             AttributeQueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1799                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
1800                 
1801             AttributeQueryDescriptorTypeImpl(const AttributeQueryDescriptorTypeImpl& src)
1802                     : AbstractXMLObject(src), QueryDescriptorTypeImpl(src) {
1803                 VectorOf(AttributeConsumingService) w=getAttributeConsumingServices();
1804                 for (vector<AttributeConsumingService*>::const_iterator j=src.m_AttributeConsumingServices.begin(); j!=src.m_AttributeConsumingServices.end(); j++) {
1805                     if (*j) {
1806                         w.push_back((*j)->cloneAttributeConsumingService());
1807                     }
1808                 }
1809             }
1810             
1811             IMPL_XMLOBJECT_CLONE(AttributeQueryDescriptorType);
1812             QueryDescriptorType* cloneQueryDescriptorType() const {
1813                 return new AttributeQueryDescriptorTypeImpl(*this);
1814             }
1815             RoleDescriptor* cloneRoleDescriptor() const {
1816                 return new AttributeQueryDescriptorTypeImpl(*this);
1817             }
1818             
1819             IMPL_TYPED_CHILDREN(AttributeConsumingService,m_children.end());
1820
1821         protected:
1822             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1823                 PROC_TYPED_CHILDREN(AttributeConsumingService,SAML20MD_NS,false);
1824                 QueryDescriptorTypeImpl::processChildElement(childXMLObject,root);
1825             }
1826         };
1827
1828         class SAML_DLLLOCAL AuthzDecisionQueryDescriptorTypeImpl : public virtual AuthzDecisionQueryDescriptorType, public QueryDescriptorTypeImpl
1829         {
1830         public:
1831             virtual ~AuthzDecisionQueryDescriptorTypeImpl() {}
1832     
1833             AuthzDecisionQueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1834                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
1835                 
1836             AuthzDecisionQueryDescriptorTypeImpl(const AuthzDecisionQueryDescriptorTypeImpl& src)
1837                     : AbstractXMLObject(src), QueryDescriptorTypeImpl(src) {
1838                 VectorOf(ActionNamespace) w=getActionNamespaces();
1839                 for (vector<ActionNamespace*>::const_iterator j=src.m_ActionNamespaces.begin(); j!=src.m_ActionNamespaces.end(); j++) {
1840                     if (*j) {
1841                         w.push_back((*j)->cloneActionNamespace());
1842                     }
1843                 }
1844             }
1845             
1846             IMPL_XMLOBJECT_CLONE(AuthzDecisionQueryDescriptorType);
1847             QueryDescriptorType* cloneQueryDescriptorType() const {
1848                 return new AuthzDecisionQueryDescriptorTypeImpl(*this);
1849             }
1850             RoleDescriptor* cloneRoleDescriptor() const {
1851                 return new AuthzDecisionQueryDescriptorTypeImpl(*this);
1852             }
1853             
1854             IMPL_TYPED_CHILDREN(ActionNamespace,m_children.end());
1855
1856         protected:
1857             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1858                 PROC_TYPED_CHILDREN(ActionNamespace,samlconstants::SAML20MD_QUERY_EXT_NS,false);
1859                 QueryDescriptorTypeImpl::processChildElement(childXMLObject,root);
1860             }
1861         };
1862
1863         class SAML_DLLLOCAL AffiliationDescriptorImpl : public virtual AffiliationDescriptor,
1864             public virtual SignableObject,
1865             public AbstractComplexElement,
1866             public AbstractAttributeExtensibleXMLObject,
1867             public AbstractDOMCachingXMLObject,
1868             public AbstractXMLObjectMarshaller,
1869             public AbstractXMLObjectUnmarshaller
1870         {
1871             list<XMLObject*>::iterator m_pos_AffiliateMember;
1872
1873             void init() {
1874                 m_ID=m_AffiliationOwnerID=NULL;
1875                 m_ValidUntil=m_CacheDuration=NULL;
1876                 m_children.push_back(NULL);
1877                 m_children.push_back(NULL);
1878                 m_children.push_back(NULL);
1879                 m_Signature=NULL;
1880                 m_Extensions=NULL;
1881                 m_pos_Signature=m_children.begin();
1882                 m_pos_Extensions=m_pos_Signature;
1883                 ++m_pos_Extensions;
1884                 m_pos_AffiliateMember=m_pos_Extensions;
1885                 ++m_pos_AffiliateMember;
1886             }
1887             
1888         public:
1889             virtual ~AffiliationDescriptorImpl() {
1890                 XMLString::release(&m_ID);
1891                 XMLString::release(&m_AffiliationOwnerID);
1892                 delete m_ValidUntil;
1893                 delete m_CacheDuration;
1894             }
1895     
1896             AffiliationDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1897                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1898                 init();
1899             }
1900                 
1901             AffiliationDescriptorImpl(const AffiliationDescriptorImpl& src)
1902                     : AbstractXMLObject(src), AbstractComplexElement(src),
1903                         AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
1904                 init();
1905                 setID(src.getID());
1906                 setAffiliationOwnerID(src.getAffiliationOwnerID());
1907                 setValidUntil(src.getValidUntil());
1908                 setCacheDuration(src.getCacheDuration());
1909                 if (src.getSignature())
1910                     setSignature(src.getSignature()->cloneSignature());
1911                 if (src.getExtensions())
1912                     setExtensions(src.getExtensions()->cloneExtensions());
1913                 
1914                 VectorOf(KeyDescriptor) v=getKeyDescriptors();
1915                 for (vector<KeyDescriptor*>::const_iterator i=src.m_KeyDescriptors.begin(); i!=src.m_KeyDescriptors.end(); i++) {
1916                     if (*i) {
1917                         v.push_back((*i)->cloneKeyDescriptor());
1918                     }
1919                 }
1920                 VectorOf(AffiliateMember) w=getAffiliateMembers();
1921                 for (vector<AffiliateMember*>::const_iterator j=src.m_AffiliateMembers.begin(); j!=src.m_AffiliateMembers.end(); j++) {
1922                     if (*j) {
1923                         w.push_back((*j)->cloneAffiliateMember());
1924                     }
1925                 }
1926             }
1927
1928             IMPL_XMLOBJECT_CLONE(AffiliationDescriptor);
1929
1930             //IMPL_TYPED_CHILD(Signature);
1931             // Need customized setter.
1932         protected:
1933             Signature* m_Signature;
1934             list<XMLObject*>::iterator m_pos_Signature;
1935         public:
1936             Signature* getSignature() const {
1937                 return m_Signature;
1938             }
1939             
1940             void setSignature(Signature* sig) {
1941                 prepareForAssignment(m_Signature,sig);
1942                 *m_pos_Signature=m_Signature=sig;
1943                 // Sync content reference back up.
1944                 if (m_Signature)
1945                     m_Signature->setContentReference(new opensaml::ContentReference(*this));
1946             }
1947             
1948             IMPL_ID_ATTRIB(ID);
1949             IMPL_STRING_ATTRIB(AffiliationOwnerID);
1950             IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
1951             IMPL_DATETIME_ATTRIB(CacheDuration,0);
1952             IMPL_TYPED_CHILD(Extensions);
1953             IMPL_TYPED_CHILDREN(AffiliateMember,m_pos_AffiliateMember);
1954             IMPL_TYPED_CHILDREN(KeyDescriptor,m_children.end());
1955     
1956             void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
1957                 if (!qualifiedName.hasNamespaceURI()) {
1958                     if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) {
1959                         setID(value);
1960                         return;
1961                     }
1962                     else if (XMLString::equals(qualifiedName.getLocalPart(),AFFILIATIONOWNERID_ATTRIB_NAME)) {
1963                         setAffiliationOwnerID(value);
1964                         return;
1965                     }
1966                     else if (XMLString::equals(qualifiedName.getLocalPart(),VALIDUNTIL_ATTRIB_NAME)) {
1967                         setValidUntil(value);
1968                         return;
1969                     }
1970                     else if (XMLString::equals(qualifiedName.getLocalPart(),CACHEDURATION_ATTRIB_NAME)) {
1971                         setCacheDuration(value);
1972                         return;
1973                     }
1974                 }
1975                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
1976             }
1977
1978         protected:
1979             void marshallAttributes(DOMElement* domElement) const {
1980                 MARSHALL_ID_ATTRIB(ID,ID,NULL);
1981                 MARSHALL_STRING_ATTRIB(AffiliationOwnerID,AFFILIATIONOWNERID,NULL);
1982                 MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,NULL);
1983                 MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,NULL);
1984                 marshallExtensionAttributes(domElement);
1985             }
1986
1987             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1988                 PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLSIG_NS,false);
1989                 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
1990                 PROC_TYPED_CHILDREN(AffiliateMember,SAML20MD_NS,false);
1991                 PROC_TYPED_CHILDREN(KeyDescriptor,SAML20MD_NS,false);
1992                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
1993             }
1994
1995             void processAttribute(const DOMAttr* attribute) {
1996                 PROC_ID_ATTRIB(ID,ID,NULL);
1997                 unmarshallExtensionAttribute(attribute);
1998             }
1999         };
2000
2001         class SAML_DLLLOCAL EntityDescriptorImpl : public virtual EntityDescriptor,
2002             public virtual SignableObject,
2003             public AbstractComplexElement,
2004             public AbstractAttributeExtensibleXMLObject,
2005             public AbstractDOMCachingXMLObject,
2006             public AbstractXMLObjectMarshaller,
2007             public AbstractXMLObjectUnmarshaller
2008         {
2009             list<XMLObject*>::iterator m_pos_ContactPerson;
2010
2011             void init() {
2012                 m_ID=m_EntityID=NULL;
2013                 m_ValidUntil=m_CacheDuration=NULL;
2014                 m_children.push_back(NULL);
2015                 m_children.push_back(NULL);
2016                 m_children.push_back(NULL);
2017                 m_children.push_back(NULL);
2018                 m_children.push_back(NULL);
2019                 m_Signature=NULL;
2020                 m_Extensions=NULL;
2021                 m_AffiliationDescriptor=NULL;
2022                 m_Organization=NULL;
2023                 m_pos_Signature=m_children.begin();
2024                 m_pos_Extensions=m_pos_Signature;
2025                 ++m_pos_Extensions;
2026                 m_pos_AffiliationDescriptor=m_pos_Extensions;
2027                 ++m_pos_AffiliationDescriptor;
2028                 m_pos_Organization=m_pos_AffiliationDescriptor;
2029                 ++m_pos_Organization;
2030                 m_pos_ContactPerson=m_pos_Organization;
2031                 ++m_pos_ContactPerson;
2032             }
2033             
2034         public:
2035             virtual ~EntityDescriptorImpl() {
2036                 XMLString::release(&m_ID);
2037                 XMLString::release(&m_EntityID);
2038                 delete m_ValidUntil;
2039                 delete m_CacheDuration;
2040             }
2041     
2042             EntityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
2043                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
2044                 init();
2045             }
2046                 
2047             EntityDescriptorImpl(const EntityDescriptorImpl& src)
2048                     : AbstractXMLObject(src), AbstractComplexElement(src),
2049                         AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
2050                 init();
2051                 setID(src.getID());
2052                 setEntityID(src.getEntityID());
2053                 setValidUntil(src.getValidUntil());
2054                 setCacheDuration(src.getCacheDuration());
2055                 if (src.getSignature())
2056                     setSignature(src.getSignature()->cloneSignature());
2057                 if (src.getExtensions())
2058                     setExtensions(src.getExtensions()->cloneExtensions());
2059                 if (src.getAffiliationDescriptor())
2060                     setAffiliationDescriptor(src.getAffiliationDescriptor()->cloneAffiliationDescriptor());
2061                 if (src.getOrganization())
2062                     setOrganization(src.getOrganization()->cloneOrganization());
2063                 
2064                 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
2065                     if (*i) {
2066                         IDPSSODescriptor* idp=dynamic_cast<IDPSSODescriptor*>(*i);
2067                         if (idp) {
2068                             getIDPSSODescriptors().push_back(idp->cloneIDPSSODescriptor());
2069                             continue;
2070                         }
2071                         
2072                         SPSSODescriptor* sp=dynamic_cast<SPSSODescriptor*>(*i);
2073                         if (sp) {
2074                             getSPSSODescriptors().push_back(sp->cloneSPSSODescriptor());
2075                             continue;
2076                         }
2077
2078                         AuthnAuthorityDescriptor* authn=dynamic_cast<AuthnAuthorityDescriptor*>(*i);
2079                         if (authn) {
2080                             getAuthnAuthorityDescriptors().push_back(authn->cloneAuthnAuthorityDescriptor());
2081                             continue;
2082                         }
2083
2084                         AttributeAuthorityDescriptor* attr=dynamic_cast<AttributeAuthorityDescriptor*>(*i);
2085                         if (attr) {
2086                             getAttributeAuthorityDescriptors().push_back(attr->cloneAttributeAuthorityDescriptor());
2087                             continue;
2088                         }
2089
2090                         PDPDescriptor* pdp=dynamic_cast<PDPDescriptor*>(*i);
2091                         if (pdp) {
2092                             getPDPDescriptors().push_back(pdp->clonePDPDescriptor());
2093                             continue;
2094                         }
2095     
2096                         AuthnQueryDescriptorType* authnq=dynamic_cast<AuthnQueryDescriptorType*>(*i);
2097                         if (authnq) {
2098                             getAuthnQueryDescriptorTypes().push_back(authnq->cloneAuthnQueryDescriptorType());
2099                             continue;
2100                         }
2101
2102                         AttributeQueryDescriptorType* attrq=dynamic_cast<AttributeQueryDescriptorType*>(*i);
2103                         if (attrq) {
2104                             getAttributeQueryDescriptorTypes().push_back(attrq->cloneAttributeQueryDescriptorType());
2105                             continue;
2106                         }
2107
2108                         AuthzDecisionQueryDescriptorType* authzq=dynamic_cast<AuthzDecisionQueryDescriptorType*>(*i);
2109                         if (authzq) {
2110                             getAuthzDecisionQueryDescriptorTypes().push_back(authzq->cloneAuthzDecisionQueryDescriptorType());
2111                             continue;
2112                         }
2113
2114                         RoleDescriptor* role=dynamic_cast<RoleDescriptor*>(*i);
2115                         if (role) {
2116                             getRoleDescriptors().push_back(role->cloneRoleDescriptor());
2117                             continue;
2118                         }
2119                     }
2120                 }
2121
2122                 VectorOf(ContactPerson) v=getContactPersons();
2123                 for (vector<ContactPerson*>::const_iterator j=src.m_ContactPersons.begin(); j!=src.m_ContactPersons.end(); j++) {
2124                     if (*j) {
2125                         v.push_back((*j)->cloneContactPerson());
2126                     }
2127                 }
2128                 VectorOf(AdditionalMetadataLocation) w=getAdditionalMetadataLocations();
2129                 for (vector<AdditionalMetadataLocation*>::const_iterator k=src.m_AdditionalMetadataLocations.begin(); k!=src.m_AdditionalMetadataLocations.end(); k++) {
2130                     if (*k) {
2131                         w.push_back((*k)->cloneAdditionalMetadataLocation());
2132                     }
2133                 }
2134             }
2135
2136             IMPL_XMLOBJECT_CLONE(EntityDescriptor);
2137
2138             //IMPL_TYPED_CHILD(Signature);
2139             // Need customized setter.
2140         protected:
2141             Signature* m_Signature;
2142             list<XMLObject*>::iterator m_pos_Signature;
2143         public:
2144             Signature* getSignature() const {
2145                 return m_Signature;
2146             }
2147             
2148             void setSignature(Signature* sig) {
2149                 prepareForAssignment(m_Signature,sig);
2150                 *m_pos_Signature=m_Signature=sig;
2151                 // Sync content reference back up.
2152                 if (m_Signature)
2153                     m_Signature->setContentReference(new opensaml::ContentReference(*this));
2154             }
2155             
2156             IMPL_ID_ATTRIB(ID);
2157             IMPL_STRING_ATTRIB(EntityID);
2158             IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
2159             IMPL_DATETIME_ATTRIB(CacheDuration,0);
2160             IMPL_TYPED_CHILD(Extensions);
2161             IMPL_TYPED_CHILDREN(RoleDescriptor,m_pos_AffiliationDescriptor);
2162             IMPL_TYPED_CHILDREN(IDPSSODescriptor,m_pos_AffiliationDescriptor);
2163             IMPL_TYPED_CHILDREN(SPSSODescriptor,m_pos_AffiliationDescriptor);
2164             IMPL_TYPED_CHILDREN(AuthnAuthorityDescriptor,m_pos_AffiliationDescriptor);
2165             IMPL_TYPED_CHILDREN(AttributeAuthorityDescriptor,m_pos_AffiliationDescriptor);
2166             IMPL_TYPED_CHILDREN(PDPDescriptor,m_pos_AffiliationDescriptor);
2167             IMPL_TYPED_CHILDREN(AuthnQueryDescriptorType,m_pos_AffiliationDescriptor);
2168             IMPL_TYPED_CHILDREN(AttributeQueryDescriptorType,m_pos_AffiliationDescriptor);
2169             IMPL_TYPED_CHILDREN(AuthzDecisionQueryDescriptorType,m_pos_AffiliationDescriptor);
2170             IMPL_TYPED_CHILD(AffiliationDescriptor);
2171             IMPL_TYPED_CHILD(Organization);
2172             IMPL_TYPED_CHILDREN(ContactPerson,m_pos_ContactPerson);
2173             IMPL_TYPED_CHILDREN(AdditionalMetadataLocation,m_children.end());
2174     
2175             void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
2176                 if (!qualifiedName.hasNamespaceURI()) {
2177                     if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) {
2178                         setID(value);
2179                         return;
2180                     }
2181                     else if (XMLString::equals(qualifiedName.getLocalPart(),ENTITYID_ATTRIB_NAME)) {
2182                         setEntityID(value);
2183                         return;
2184                     }
2185                     else if (XMLString::equals(qualifiedName.getLocalPart(),VALIDUNTIL_ATTRIB_NAME)) {
2186                         setValidUntil(value);
2187                         return;
2188                     }
2189                     else if (XMLString::equals(qualifiedName.getLocalPart(),CACHEDURATION_ATTRIB_NAME)) {
2190                         setCacheDuration(value);
2191                         return;
2192                     }
2193                 }
2194                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
2195             }
2196
2197             const IDPSSODescriptor* getIDPSSODescriptor(const XMLCh* protocol) const {
2198                 for (vector<IDPSSODescriptor*>::const_iterator i=m_IDPSSODescriptors.begin(); i!=m_IDPSSODescriptors.end(); i++) {
2199                     if ((*i)->hasSupport(protocol) && (*i)->isValid())
2200                         return (*i);
2201                 }
2202                 return NULL;
2203             }
2204             
2205             const SPSSODescriptor* getSPSSODescriptor(const XMLCh* protocol) const {
2206                 for (vector<SPSSODescriptor*>::const_iterator i=m_SPSSODescriptors.begin(); i!=m_SPSSODescriptors.end(); i++) {
2207                     if ((*i)->hasSupport(protocol) && (*i)->isValid())
2208                         return (*i);
2209                 }
2210                 return NULL;
2211             }
2212             
2213             const AuthnAuthorityDescriptor* getAuthnAuthorityDescriptor(const XMLCh* protocol) const {
2214                 for (vector<AuthnAuthorityDescriptor*>::const_iterator i=m_AuthnAuthorityDescriptors.begin(); i!=m_AuthnAuthorityDescriptors.end(); i++) {
2215                     if ((*i)->hasSupport(protocol) && (*i)->isValid())
2216                         return (*i);
2217                 }
2218                 return NULL;
2219             }
2220             
2221             const AttributeAuthorityDescriptor* getAttributeAuthorityDescriptor(const XMLCh* protocol) const {
2222                 for (vector<AttributeAuthorityDescriptor*>::const_iterator i=m_AttributeAuthorityDescriptors.begin(); i!=m_AttributeAuthorityDescriptors.end(); i++) {
2223                     if ((*i)->hasSupport(protocol) && (*i)->isValid())
2224                         return (*i);
2225                 }
2226                 return NULL;
2227             }
2228             
2229             const PDPDescriptor* getPDPDescriptor(const XMLCh* protocol) const {
2230                 for (vector<PDPDescriptor*>::const_iterator i=m_PDPDescriptors.begin(); i!=m_PDPDescriptors.end(); i++) {
2231                     if ((*i)->hasSupport(protocol) && (*i)->isValid())
2232                         return (*i);
2233                 }
2234                 return NULL;
2235             }
2236
2237             const AuthnQueryDescriptorType* getAuthnQueryDescriptorType(const XMLCh* protocol) const {
2238                 for (vector<AuthnQueryDescriptorType*>::const_iterator i=m_AuthnQueryDescriptorTypes.begin(); i!=m_AuthnQueryDescriptorTypes.end(); i++) {
2239                     if ((*i)->hasSupport(protocol) && (*i)->isValid())
2240                         return (*i);
2241                 }
2242                 return NULL;
2243             }
2244
2245             const AttributeQueryDescriptorType* getAttributeQueryDescriptorType(const XMLCh* protocol) const {
2246                 for (vector<AttributeQueryDescriptorType*>::const_iterator i=m_AttributeQueryDescriptorTypes.begin(); i!=m_AttributeQueryDescriptorTypes.end(); i++) {
2247                     if ((*i)->hasSupport(protocol) && (*i)->isValid())
2248                         return (*i);
2249                 }
2250                 return NULL;
2251             }
2252             
2253             const AuthzDecisionQueryDescriptorType* getAuthzDecisionQueryDescriptorType(const XMLCh* protocol) const {
2254                 for (vector<AuthzDecisionQueryDescriptorType*>::const_iterator i=m_AuthzDecisionQueryDescriptorTypes.begin(); i!=m_AuthzDecisionQueryDescriptorTypes.end(); i++) {
2255                     if ((*i)->hasSupport(protocol) && (*i)->isValid())
2256                         return (*i);
2257                 }
2258                 return NULL;
2259             }
2260
2261             const RoleDescriptor* getRoleDescriptor(const xmltooling::QName& qname, const XMLCh* protocol) const {
2262                 // Check for "known" elements/types.
2263                 QName q;
2264                 q.setNamespaceURI(SAML20MD_NS);
2265                 q.setLocalPart(IDPSSODescriptor::LOCAL_NAME);
2266                 if (q == qname)
2267                     return getIDPSSODescriptor(protocol);
2268                 q.setLocalPart(SPSSODescriptor::LOCAL_NAME);
2269                 if (q == qname)
2270                     return getSPSSODescriptor(protocol);
2271                 q.setLocalPart(AuthnAuthorityDescriptor::LOCAL_NAME);
2272                 if (q == qname)
2273                     return getAuthnAuthorityDescriptor(protocol);
2274                 q.setLocalPart(AttributeAuthorityDescriptor::LOCAL_NAME);
2275                 if (q == qname)
2276                     return getAttributeAuthorityDescriptor(protocol);
2277                 q.setLocalPart(PDPDescriptor::LOCAL_NAME);
2278                 if (q == qname)
2279                     return getPDPDescriptor(protocol);
2280                 q.setNamespaceURI(samlconstants::SAML20MD_QUERY_EXT_NS);
2281                 q.setLocalPart(AuthnQueryDescriptorType::TYPE_NAME);
2282                 if (q == qname)
2283                     return getAuthnQueryDescriptorType(protocol);
2284                 q.setLocalPart(AttributeQueryDescriptorType::TYPE_NAME);
2285                 if (q == qname)
2286                     return getAttributeQueryDescriptorType(protocol);
2287                 q.setLocalPart(AuthzDecisionQueryDescriptorType::TYPE_NAME);
2288                 if (q == qname)
2289                     return getAuthzDecisionQueryDescriptorType(protocol);
2290                 
2291                 for (vector<RoleDescriptor*>::const_iterator i=m_RoleDescriptors.begin(); i!=m_RoleDescriptors.end(); i++) {
2292                     if ((*i)->getSchemaType() && qname==(*((*i)->getSchemaType())) && (*i)->hasSupport(protocol) && (*i)->isValid())
2293                         return (*i);
2294                 }
2295                 return NULL;
2296             }
2297
2298         protected:
2299             void marshallAttributes(DOMElement* domElement) const {
2300                 MARSHALL_ID_ATTRIB(ID,ID,NULL);
2301                 MARSHALL_STRING_ATTRIB(EntityID,ENTITYID,NULL);
2302                 MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,NULL);
2303                 MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,NULL);
2304                 marshallExtensionAttributes(domElement);
2305             }
2306
2307             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
2308                 PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLSIG_NS,false);
2309                 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
2310                 PROC_TYPED_CHILDREN(IDPSSODescriptor,SAML20MD_NS,false);
2311                 PROC_TYPED_CHILDREN(SPSSODescriptor,SAML20MD_NS,false);
2312                 PROC_TYPED_CHILDREN(AuthnAuthorityDescriptor,SAML20MD_NS,false);
2313                 PROC_TYPED_CHILDREN(AttributeAuthorityDescriptor,SAML20MD_NS,false);
2314                 PROC_TYPED_CHILDREN(PDPDescriptor,SAML20MD_NS,false);
2315                 PROC_TYPED_CHILDREN(AuthnQueryDescriptorType,samlconstants::SAML20MD_QUERY_EXT_NS,false);
2316                 PROC_TYPED_CHILDREN(AttributeQueryDescriptorType,samlconstants::SAML20MD_QUERY_EXT_NS,false);
2317                 PROC_TYPED_CHILDREN(AuthzDecisionQueryDescriptorType,samlconstants::SAML20MD_QUERY_EXT_NS,false);
2318                 PROC_TYPED_CHILDREN(RoleDescriptor,SAML20MD_NS,false);
2319                 PROC_TYPED_CHILD(AffiliationDescriptor,SAML20MD_NS,false);
2320                 PROC_TYPED_CHILD(Organization,SAML20MD_NS,false);
2321                 PROC_TYPED_CHILDREN(ContactPerson,SAML20MD_NS,false);
2322                 PROC_TYPED_CHILDREN(AdditionalMetadataLocation,SAML20MD_NS,false);
2323                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
2324             }
2325
2326             void processAttribute(const DOMAttr* attribute) {
2327                 PROC_ID_ATTRIB(ID,ID,NULL);
2328                 unmarshallExtensionAttribute(attribute);
2329             }
2330         };
2331
2332         class SAML_DLLLOCAL EntitiesDescriptorImpl : public virtual EntitiesDescriptor,
2333             public virtual SignableObject,
2334             public AbstractComplexElement,
2335             public AbstractDOMCachingXMLObject,
2336             public AbstractXMLObjectMarshaller,
2337             public AbstractXMLObjectUnmarshaller
2338         {
2339             void init() {
2340                 m_ID=m_Name=NULL;
2341                 m_ValidUntil=m_CacheDuration=NULL;
2342                 m_children.push_back(NULL);
2343                 m_children.push_back(NULL);
2344                 m_Signature=NULL;
2345                 m_Extensions=NULL;
2346                 m_pos_Signature=m_children.begin();
2347                 m_pos_Extensions=m_pos_Signature;
2348                 ++m_pos_Extensions;
2349             }
2350             
2351         public:
2352             virtual ~EntitiesDescriptorImpl() {
2353                 XMLString::release(&m_ID);
2354                 XMLString::release(&m_Name);
2355                 delete m_ValidUntil;
2356                 delete m_CacheDuration;
2357             }
2358     
2359             EntitiesDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
2360                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
2361                 init();
2362             }
2363                 
2364             EntitiesDescriptorImpl(const EntitiesDescriptorImpl& src)
2365                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
2366                 init();
2367                 setID(src.getID());
2368                 setName(src.getName());
2369                 setValidUntil(src.getValidUntil());
2370                 setCacheDuration(src.getCacheDuration());
2371                 if (src.getSignature())
2372                     setSignature(src.getSignature()->cloneSignature());
2373                 if (src.getExtensions())
2374                     setExtensions(src.getExtensions()->cloneExtensions());
2375                 
2376                 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
2377                     if (*i) {
2378                         EntityDescriptor* e=dynamic_cast<EntityDescriptor*>(*i);
2379                         if (e) {
2380                             getEntityDescriptors().push_back(e->cloneEntityDescriptor());
2381                             continue;
2382                         }
2383                         
2384                         EntitiesDescriptor* es=dynamic_cast<EntitiesDescriptor*>(*i);
2385                         if (es) {
2386                             getEntitiesDescriptors().push_back(es->cloneEntitiesDescriptor());
2387                             continue;
2388                         }
2389                     }
2390                 }
2391             }
2392
2393             IMPL_XMLOBJECT_CLONE(EntitiesDescriptor);
2394
2395             //IMPL_TYPED_CHILD(Signature);
2396             // Need customized setter.
2397         protected:
2398             Signature* m_Signature;
2399             list<XMLObject*>::iterator m_pos_Signature;
2400         public:
2401             Signature* getSignature() const {
2402                 return m_Signature;
2403             }
2404             
2405             void setSignature(Signature* sig) {
2406                 prepareForAssignment(m_Signature,sig);
2407                 *m_pos_Signature=m_Signature=sig;
2408                 // Sync content reference back up.
2409                 if (m_Signature)
2410                     m_Signature->setContentReference(new opensaml::ContentReference(*this));
2411             }
2412             
2413             IMPL_ID_ATTRIB(ID);
2414             IMPL_STRING_ATTRIB(Name);
2415             IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
2416             IMPL_DATETIME_ATTRIB(CacheDuration,0);
2417             IMPL_TYPED_CHILD(Extensions);
2418             IMPL_TYPED_CHILDREN(EntityDescriptor,m_children.end());
2419             IMPL_TYPED_CHILDREN(EntitiesDescriptor,m_children.end());
2420     
2421         protected:
2422             void marshallAttributes(DOMElement* domElement) const {
2423                 MARSHALL_ID_ATTRIB(ID,ID,NULL);
2424                 MARSHALL_STRING_ATTRIB(Name,NAME,NULL);
2425                 MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,NULL);
2426                 MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,NULL);
2427             }
2428
2429             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
2430                 PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLSIG_NS,false);
2431                 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
2432                 PROC_TYPED_CHILDREN(EntityDescriptor,SAML20MD_NS,false);
2433                 PROC_TYPED_CHILDREN(EntitiesDescriptor,SAML20MD_NS,false);
2434                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
2435             }
2436
2437             void processAttribute(const DOMAttr* attribute) {
2438                 PROC_ID_ATTRIB(ID,ID,NULL);
2439                 PROC_STRING_ATTRIB(Name,NAME,NULL);
2440                 PROC_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,NULL);
2441                 PROC_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,NULL);
2442             }
2443         };
2444
2445     };
2446 };
2447
2448 #if defined (_MSC_VER)
2449     #pragma warning( pop )
2450 #endif
2451
2452 // Builder Implementations
2453
2454 IMPL_XMLOBJECTBUILDER(AdditionalMetadataLocation);
2455 IMPL_XMLOBJECTBUILDER(AffiliateMember);
2456 IMPL_XMLOBJECTBUILDER(AffiliationDescriptor);
2457 IMPL_XMLOBJECTBUILDER(ArtifactResolutionService);
2458 IMPL_XMLOBJECTBUILDER(AssertionConsumerService);
2459 IMPL_XMLOBJECTBUILDER(AssertionIDRequestService);
2460 IMPL_XMLOBJECTBUILDER(AttributeAuthorityDescriptor);
2461 IMPL_XMLOBJECTBUILDER(AttributeConsumingService);
2462 IMPL_XMLOBJECTBUILDER(AttributeProfile);
2463 IMPL_XMLOBJECTBUILDER(AttributeQueryDescriptorType);
2464 IMPL_XMLOBJECTBUILDER(AttributeService);
2465 IMPL_XMLOBJECTBUILDER(AuthnAuthorityDescriptor);
2466 IMPL_XMLOBJECTBUILDER(AuthnQueryDescriptorType);
2467 IMPL_XMLOBJECTBUILDER(AuthnQueryService);
2468 IMPL_XMLOBJECTBUILDER(AuthzDecisionQueryDescriptorType);
2469 IMPL_XMLOBJECTBUILDER(AuthzService);
2470 IMPL_XMLOBJECTBUILDER(Company);
2471 IMPL_XMLOBJECTBUILDER(ContactPerson);
2472 IMPL_XMLOBJECTBUILDER(EmailAddress);
2473 IMPL_XMLOBJECTBUILDER(EndpointType);
2474 IMPL_XMLOBJECTBUILDER(EntitiesDescriptor);
2475 IMPL_XMLOBJECTBUILDER(EntityDescriptor);
2476 IMPL_XMLOBJECTBUILDER(Extensions);
2477 IMPL_XMLOBJECTBUILDER(GivenName);
2478 IMPL_XMLOBJECTBUILDER(IDPSSODescriptor);
2479 IMPL_XMLOBJECTBUILDER(IndexedEndpointType);
2480 IMPL_XMLOBJECTBUILDER(KeyDescriptor);
2481 IMPL_XMLOBJECTBUILDER(localizedNameType);
2482 IMPL_XMLOBJECTBUILDER(localizedURIType);
2483 IMPL_XMLOBJECTBUILDER(ManageNameIDService);
2484 IMPL_XMLOBJECTBUILDER(NameIDFormat);
2485 IMPL_XMLOBJECTBUILDER(NameIDMappingService);
2486 IMPL_XMLOBJECTBUILDER(Organization);
2487 IMPL_XMLOBJECTBUILDER(OrganizationName);
2488 IMPL_XMLOBJECTBUILDER(OrganizationDisplayName);
2489 IMPL_XMLOBJECTBUILDER(OrganizationURL);
2490 IMPL_XMLOBJECTBUILDER(PDPDescriptor);
2491 IMPL_XMLOBJECTBUILDER(RequestedAttribute);
2492 IMPL_XMLOBJECTBUILDER(ServiceDescription);
2493 IMPL_XMLOBJECTBUILDER(ServiceName);
2494 IMPL_XMLOBJECTBUILDER(SingleLogoutService);
2495 IMPL_XMLOBJECTBUILDER(SingleSignOnService);
2496 IMPL_XMLOBJECTBUILDER(SPSSODescriptor);
2497 IMPL_XMLOBJECTBUILDER(SurName);
2498 IMPL_XMLOBJECTBUILDER(TelephoneNumber);
2499
2500 IMPL_XMLOBJECTBUILDER(ActionNamespace);
2501 IMPL_XMLOBJECTBUILDER(SourceID);
2502
2503 const XMLCh ActionNamespace::LOCAL_NAME[] =             UNICODE_LITERAL_15(A,c,t,i,o,n,N,a,m,e,s,p,a,c,e);
2504 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);
2505 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);
2506 const XMLCh AdditionalMetadataLocation::NAMESPACE_ATTRIB_NAME[] =   UNICODE_LITERAL_9(n,a,m,e,s,p,a,c,e);
2507 const XMLCh AffiliateMember::LOCAL_NAME[] =             UNICODE_LITERAL_15(A,f,f,i,l,i,a,t,e,M,e,m,b,e,r);
2508 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);
2509 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);
2510 const XMLCh AffiliationDescriptor::ID_ATTRIB_NAME[] =   UNICODE_LITERAL_2(I,D);
2511 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);
2512 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);
2513 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);
2514 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);
2515 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);
2516 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);
2517 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);
2518 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);
2519 const XMLCh AttributeConsumingService::INDEX_ATTRIB_NAME[] =    UNICODE_LITERAL_5(i,n,d,e,x);
2520 const XMLCh AttributeConsumingService::ISDEFAULT_ATTRIB_NAME[] =    UNICODE_LITERAL_9(i,s,D,e,f,a,u,l,t);
2521 const XMLCh AttributeProfile::LOCAL_NAME[] =            UNICODE_LITERAL_16(A,t,t,r,i,b,u,t,e,P,r,o,f,i,l,e);
2522 const XMLCh AttributeQueryDescriptorType::LOCAL_NAME[] =UNICODE_LITERAL_14(R,o,l,e,D,e,s,c,r,i,p,t,o,r);
2523 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);
2524 const XMLCh AttributeService::LOCAL_NAME[] =            UNICODE_LITERAL_16(A,t,t,r,i,b,u,t,e,S,e,r,v,i,c,e);
2525 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);
2526 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);
2527 const XMLCh AuthnQueryDescriptorType::LOCAL_NAME[] =    UNICODE_LITERAL_14(R,o,l,e,D,e,s,c,r,i,p,t,o,r);
2528 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);
2529 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);
2530 const XMLCh AuthzDecisionQueryDescriptorType::LOCAL_NAME[] =    UNICODE_LITERAL_14(R,o,l,e,D,e,s,c,r,i,p,t,o,r);
2531 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);
2532 const XMLCh AuthzService::LOCAL_NAME[] =                UNICODE_LITERAL_12(A,u,t,h,z,S,e,r,v,i,c,e);
2533 const XMLCh CacheableSAMLObject::CACHEDURATION_ATTRIB_NAME[] =  UNICODE_LITERAL_13(c,a,c,h,e,D,u,r,a,t,i,o,n);
2534 const XMLCh Company::LOCAL_NAME[] =                     UNICODE_LITERAL_7(C,o,m,p,a,n,y);
2535 const XMLCh ContactPerson::LOCAL_NAME[] =               UNICODE_LITERAL_13(C,o,n,t,a,c,t,P,e,r,s,o,n);
2536 const XMLCh ContactPerson::TYPE_NAME[] =                UNICODE_LITERAL_11(C,o,n,t,a,c,t,T,y,p,e);
2537 const XMLCh ContactPerson::CONTACTTYPE_ATTRIB_NAME[] =  UNICODE_LITERAL_11(c,o,n,t,a,c,t,T,y,p,e);
2538 const XMLCh ContactPerson::CONTACT_TECHNICAL[] =        UNICODE_LITERAL_9(t,e,c,h,n,i,c,a,l);
2539 const XMLCh ContactPerson::CONTACT_SUPPORT[] =          UNICODE_LITERAL_7(s,u,p,p,o,r,t);
2540 const XMLCh ContactPerson::CONTACT_ADMINISTRATIVE[] =   UNICODE_LITERAL_14(a,d,m,i,n,i,s,t,r,a,t,i,v,e);
2541 const XMLCh ContactPerson::CONTACT_BILLING[] =          UNICODE_LITERAL_7(b,i,l,l,i,n,g);
2542 const XMLCh ContactPerson::CONTACT_OTHER[] =            UNICODE_LITERAL_5(o,t,h,e,r);
2543 const XMLCh EmailAddress::LOCAL_NAME[] =                UNICODE_LITERAL_12(E,m,a,i,l,A,d,d,r,e,s,s);
2544 const XMLCh EndpointType::LOCAL_NAME[] =                {chNull};
2545 const XMLCh EndpointType::TYPE_NAME[] =                 UNICODE_LITERAL_12(E,n,d,p,o,i,n,t,T,y,p,e);
2546 const XMLCh EndpointType::BINDING_ATTRIB_NAME[] =       UNICODE_LITERAL_7(B,i,n,d,i,n,g);
2547 const XMLCh EndpointType::LOCATION_ATTRIB_NAME[] =      UNICODE_LITERAL_8(L,o,c,a,t,i,o,n);
2548 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);
2549 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);
2550 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);
2551 const XMLCh EntitiesDescriptor::ID_ATTRIB_NAME[] =      UNICODE_LITERAL_2(I,D);
2552 const XMLCh EntitiesDescriptor::NAME_ATTRIB_NAME[] =    UNICODE_LITERAL_4(N,a,m,e);
2553 const XMLCh EntityDescriptor::LOCAL_NAME[] =            UNICODE_LITERAL_16(E,n,t,i,t,y,D,e,s,c,r,i,p,t,o,r);
2554 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);
2555 const XMLCh EntityDescriptor::ID_ATTRIB_NAME[] =        UNICODE_LITERAL_2(I,D);
2556 const XMLCh EntityDescriptor::ENTITYID_ATTRIB_NAME[] =  UNICODE_LITERAL_8(e,n,t,i,t,y,I,D);
2557 const XMLCh Extensions::LOCAL_NAME[] =                  UNICODE_LITERAL_10(E,x,t,e,n,s,i,o,n,s);
2558 const XMLCh Extensions::TYPE_NAME[] =                   UNICODE_LITERAL_14(E,x,t,e,n,s,i,o,n,s,T,y,p,e);
2559 const XMLCh GivenName::LOCAL_NAME[] =                   UNICODE_LITERAL_9(G,i,v,e,n,N,a,m,e);
2560 const XMLCh IDPSSODescriptor::LOCAL_NAME[] =            UNICODE_LITERAL_16(I,D,P,S,S,O,D,e,s,c,r,i,p,t,o,r);
2561 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);
2562 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);
2563 const XMLCh IndexedEndpointType::LOCAL_NAME[] =         {chNull};
2564 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);
2565 const XMLCh IndexedEndpointType::INDEX_ATTRIB_NAME[] =  UNICODE_LITERAL_5(i,n,d,e,x);
2566 const XMLCh IndexedEndpointType::ISDEFAULT_ATTRIB_NAME[] =  UNICODE_LITERAL_9(i,s,D,e,f,a,u,l,t);
2567 const XMLCh KeyDescriptor::LOCAL_NAME[] =               UNICODE_LITERAL_13(K,e,y,D,e,s,c,r,i,p,t,o,r);
2568 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);
2569 const XMLCh KeyDescriptor::USE_ATTRIB_NAME[] =          UNICODE_LITERAL_3(u,s,e);
2570 const XMLCh KeyDescriptor::KEYTYPE_ENCRYPTION[] =       UNICODE_LITERAL_10(e,n,c,r,y,p,t,i,o,n);
2571 const XMLCh KeyDescriptor::KEYTYPE_SIGNING[] =          UNICODE_LITERAL_7(s,i,g,n,i,n,g);
2572 const XMLCh localizedNameType::LOCAL_NAME[] =           {chNull};
2573 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);
2574 const XMLCh localizedNameType::LANG_ATTRIB_NAME[] =     UNICODE_LITERAL_4(l,a,n,g);
2575 const XMLCh localizedURIType::LOCAL_NAME[] =            {chNull};
2576 const XMLCh localizedURIType::TYPE_NAME[] =             UNICODE_LITERAL_16(l,o,c,a,l,i,z,e,d,U,R,I,T,y,p,e);
2577 const XMLCh localizedURIType::LANG_ATTRIB_NAME[] =      UNICODE_LITERAL_4(l,a,n,g);
2578 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);
2579 const XMLCh NameIDFormat::LOCAL_NAME[] =                UNICODE_LITERAL_12(N,a,m,e,I,D,F,o,r,m,a,t);
2580 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);
2581 const XMLCh Organization::LOCAL_NAME[] =                UNICODE_LITERAL_12(O,r,g,a,n,i,z,a,t,i,o,n);
2582 const XMLCh Organization::TYPE_NAME[] =                 UNICODE_LITERAL_16(O,r,g,a,n,i,z,a,t,i,o,n,T,y,p,e);
2583 const XMLCh OrganizationName::LOCAL_NAME[] =            UNICODE_LITERAL_16(O,r,g,a,n,i,z,a,t,i,o,n,N,a,m,e);
2584 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);
2585 const XMLCh OrganizationURL::LOCAL_NAME[] =             UNICODE_LITERAL_15(O,r,g,a,n,i,z,a,t,i,o,n,U,R,L);
2586 const XMLCh PDPDescriptor::LOCAL_NAME[] =               UNICODE_LITERAL_13(P,D,P,D,e,s,c,r,i,p,t,o,r);
2587 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);
2588 const XMLCh QueryDescriptorType::LOCAL_NAME[] =         {chNull};
2589 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);
2590 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);
2591 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);
2592 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);
2593 const XMLCh RequestedAttribute::ISREQUIRED_ATTRIB_NAME[] =  UNICODE_LITERAL_10(i,s,R,e,q,u,i,r,e,d);
2594 const XMLCh RoleDescriptor::LOCAL_NAME[] =              UNICODE_LITERAL_14(R,o,l,e,D,e,s,c,r,i,p,t,o,r);
2595 const XMLCh RoleDescriptor::ID_ATTRIB_NAME[] =          UNICODE_LITERAL_2(I,D);
2596 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);
2597 const XMLCh RoleDescriptor::ERRORURL_ATTRIB_NAME[] =    UNICODE_LITERAL_8(e,r,r,o,r,U,R,L);
2598 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);
2599 const XMLCh ServiceName::LOCAL_NAME[] =                 UNICODE_LITERAL_11(S,e,r,v,i,c,e,N,a,m,e);
2600 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);
2601 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);
2602 const XMLCh SourceID::LOCAL_NAME[] =                    UNICODE_LITERAL_8(S,o,u,r,c,e,I,D);
2603 const XMLCh SPSSODescriptor::LOCAL_NAME[] =             UNICODE_LITERAL_15(S,P,S,S,O,D,e,s,c,r,i,p,t,o,r);
2604 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);
2605 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);
2606 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);
2607 const XMLCh SSODescriptorType::LOCAL_NAME[] =           {chNull};
2608 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);
2609 const XMLCh SurName::LOCAL_NAME[] =                     UNICODE_LITERAL_7(S,u,r,N,a,m,e);
2610 const XMLCh TelephoneNumber::LOCAL_NAME[] =             UNICODE_LITERAL_15(T,e,l,e,p,h,o,n,e,N,u,m,b,e,r);
2611 const XMLCh TimeBoundSAMLObject::VALIDUNTIL_ATTRIB_NAME[] =   UNICODE_LITERAL_10(v,a,l,i,d,U,n,t,i,l);