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