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