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