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