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