Reworked int/bool attribute handling.
[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,XMLConstants::XMLENC_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);
1017             IMPL_DATETIME_ATTRIB(CacheDuration);
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             void setAttribute(QName& qualifiedName, const XMLCh* value) {
1024                 if (!qualifiedName.hasNamespaceURI()) {
1025                     if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) {
1026                         setID(value);
1027                         return;
1028                     }
1029                     else if (XMLString::equals(qualifiedName.getLocalPart(),PROTOCOLSUPPORTENUMERATION_ATTRIB_NAME)) {
1030                         setProtocolSupportEnumeration(value);
1031                         return;
1032                     }
1033                     else if (XMLString::equals(qualifiedName.getLocalPart(),ERRORURL_ATTRIB_NAME)) {
1034                         setErrorURL(value);
1035                         return;
1036                     }
1037                     else if (XMLString::equals(qualifiedName.getLocalPart(),VALIDUNTIL_ATTRIB_NAME)) {
1038                         setValidUntil(value);
1039                         return;
1040                     }
1041                     else if (XMLString::equals(qualifiedName.getLocalPart(),CACHEDURATION_ATTRIB_NAME)) {
1042                         setCacheDuration(value);
1043                         return;
1044                     }
1045                 }
1046                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value);
1047             }
1048
1049         protected:
1050             void marshallAttributes(DOMElement* domElement) const {
1051                 MARSHALL_ID_ATTRIB(ID,ID,NULL);
1052                 MARSHALL_STRING_ATTRIB(ProtocolSupportEnumeration,PROTOCOLSUPPORTENUMERATION,NULL);
1053                 MARSHALL_STRING_ATTRIB(ErrorURL,ERRORURL,NULL);
1054                 MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,NULL);
1055                 MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,NULL);
1056                 
1057                 // Take care of wildcard.
1058                 for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
1059                     DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
1060                     if (i->first.hasPrefix())
1061                         attr->setPrefix(i->first.getPrefix());
1062                     attr->setNodeValue(i->second);
1063                     domElement->setAttributeNode(attr);
1064                 }
1065             }
1066
1067             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1068                 PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLConstants::XMLSIG_NS,false);
1069                 PROC_TYPED_CHILD(Extensions,SAMLConstants::SAML20MD_NS,false);
1070                 PROC_TYPED_CHILDREN(KeyDescriptor,SAMLConstants::SAML20MD_NS,false);
1071                 PROC_TYPED_CHILD(Organization,SAMLConstants::SAML20MD_NS,false);
1072                 PROC_TYPED_CHILDREN(ContactPerson,SAMLConstants::SAML20MD_NS,false);
1073                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
1074             }
1075
1076             void processAttribute(const DOMAttr* attribute) {
1077                 PROC_ID_ATTRIB(ID,ID,NULL);
1078                 QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix()); 
1079                 setAttribute(q,attribute->getNodeValue());
1080             }
1081         };
1082
1083         class SAML_DLLLOCAL SSODescriptorTypeImpl : public virtual SSODescriptorType, public RoleDescriptorImpl
1084         {
1085             void init() {
1086                 m_children.push_back(NULL);
1087                 m_children.push_back(NULL);
1088                 m_children.push_back(NULL);
1089                 m_children.push_back(NULL);
1090                 m_pos_ArtifactResolutionService=m_pos_ContactPerson;
1091                 ++m_pos_ArtifactResolutionService;
1092                 m_pos_SingleLogoutService=m_pos_ArtifactResolutionService;
1093                 ++m_pos_SingleLogoutService;
1094                 m_pos_ManageNameIDService=m_pos_SingleLogoutService;
1095                 ++m_pos_ManageNameIDService;
1096                 m_pos_NameIDFormat=m_pos_ManageNameIDService;
1097                 ++m_pos_NameIDFormat;
1098             }
1099         
1100         protected:
1101             list<XMLObject*>::iterator m_pos_ArtifactResolutionService;
1102             list<XMLObject*>::iterator m_pos_SingleLogoutService;
1103             list<XMLObject*>::iterator m_pos_ManageNameIDService;
1104             list<XMLObject*>::iterator m_pos_NameIDFormat;
1105             
1106             SSODescriptorTypeImpl() {
1107                 init();
1108             }
1109         
1110         public:
1111             virtual ~SSODescriptorTypeImpl() {}
1112     
1113             SSODescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1114                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1115                 init();
1116             }
1117                 
1118             SSODescriptorTypeImpl(const SSODescriptorTypeImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1119                 init();
1120                 VectorOf(ArtifactResolutionService) v=getArtifactResolutionServices();
1121                 for (vector<ArtifactResolutionService*>::const_iterator i=src.m_ArtifactResolutionServices.begin(); i!=src.m_ArtifactResolutionServices.end(); i++) {
1122                     if (*i) {
1123                         v.push_back((*i)->cloneArtifactResolutionService());
1124                     }
1125                 }
1126                 VectorOf(SingleLogoutService) w=getSingleLogoutServices();
1127                 for (vector<SingleLogoutService*>::const_iterator j=src.m_SingleLogoutServices.begin(); j!=src.m_SingleLogoutServices.end(); j++) {
1128                     if (*j) {
1129                         w.push_back((*j)->cloneSingleLogoutService());
1130                     }
1131                 }
1132                 VectorOf(ManageNameIDService) x=getManageNameIDServices();
1133                 for (vector<ManageNameIDService*>::const_iterator k=src.m_ManageNameIDServices.begin(); k!=src.m_ManageNameIDServices.end(); k++) {
1134                     if (*k) {
1135                         x.push_back((*k)->cloneManageNameIDService());
1136                     }
1137                 }
1138                 VectorOf(NameIDFormat) y=getNameIDFormats();
1139                 for (vector<NameIDFormat*>::const_iterator m=src.m_NameIDFormats.begin(); m!=src.m_NameIDFormats.end(); m++) {
1140                     if (*m) {
1141                         y.push_back((*m)->cloneNameIDFormat());
1142                     }
1143                 }
1144             }
1145             
1146             IMPL_TYPED_CHILDREN(ArtifactResolutionService,m_pos_ArtifactResolutionService);
1147             IMPL_TYPED_CHILDREN(SingleLogoutService,m_pos_SingleLogoutService);
1148             IMPL_TYPED_CHILDREN(ManageNameIDService,m_pos_ManageNameIDService);
1149             IMPL_TYPED_CHILDREN(NameIDFormat,m_pos_NameIDFormat);
1150
1151         protected:
1152             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1153                 PROC_TYPED_CHILDREN(ArtifactResolutionService,SAMLConstants::SAML20MD_NS,false);
1154                 PROC_TYPED_CHILDREN(SingleLogoutService,SAMLConstants::SAML20MD_NS,false);
1155                 PROC_TYPED_CHILDREN(ManageNameIDService,SAMLConstants::SAML20MD_NS,false);
1156                 PROC_TYPED_CHILDREN(NameIDFormat,SAMLConstants::SAML20MD_NS,false);
1157                 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1158             }
1159         };
1160
1161         class SAML_DLLLOCAL IDPSSODescriptorImpl : public virtual IDPSSODescriptor, public SSODescriptorTypeImpl
1162         {
1163             list<XMLObject*>::iterator m_pos_SingleSignOnService;
1164             list<XMLObject*>::iterator m_pos_NameIDMappingService;
1165             list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
1166             list<XMLObject*>::iterator m_pos_AttributeProfile;
1167             
1168             void init() {
1169                 m_WantAuthnRequestsSigned=XMLConstants::XML_BOOL_NULL;
1170                 m_children.push_back(NULL);
1171                 m_children.push_back(NULL);
1172                 m_children.push_back(NULL);
1173                 m_children.push_back(NULL);
1174                 m_pos_SingleSignOnService=m_pos_NameIDFormat;
1175                 ++m_pos_SingleSignOnService;
1176                 m_pos_NameIDMappingService=m_pos_SingleSignOnService;
1177                 ++m_pos_NameIDMappingService;
1178                 m_pos_AssertionIDRequestService=m_pos_NameIDMappingService;
1179                 ++m_pos_AssertionIDRequestService;
1180                 m_pos_AttributeProfile=m_pos_AssertionIDRequestService;
1181                 ++m_pos_AttributeProfile;
1182             }
1183         
1184         public:
1185             virtual ~IDPSSODescriptorImpl() {}
1186     
1187             IDPSSODescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1188                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1189                 init();
1190             }
1191                 
1192             IDPSSODescriptorImpl(const IDPSSODescriptorImpl& src) : AbstractXMLObject(src), SSODescriptorTypeImpl(src) {
1193                 init();
1194                 WantAuthnRequestsSigned(src.m_WantAuthnRequestsSigned);
1195                 VectorOf(SingleSignOnService) v=getSingleSignOnServices();
1196                 for (vector<SingleSignOnService*>::const_iterator i=src.m_SingleSignOnServices.begin(); i!=src.m_SingleSignOnServices.end(); i++) {
1197                     if (*i) {
1198                         v.push_back((*i)->cloneSingleSignOnService());
1199                     }
1200                 }
1201                 VectorOf(NameIDMappingService) w=getNameIDMappingServices();
1202                 for (vector<NameIDMappingService*>::const_iterator j=src.m_NameIDMappingServices.begin(); j!=src.m_NameIDMappingServices.end(); j++) {
1203                     if (*j) {
1204                         w.push_back((*j)->cloneNameIDMappingService());
1205                     }
1206                 }
1207                 VectorOf(AssertionIDRequestService) x=getAssertionIDRequestServices();
1208                 for (vector<AssertionIDRequestService*>::const_iterator k=src.m_AssertionIDRequestServices.begin(); k!=src.m_AssertionIDRequestServices.end(); k++) {
1209                     if (*k) {
1210                         x.push_back((*k)->cloneAssertionIDRequestService());
1211                     }
1212                 }
1213                 VectorOf(AttributeProfile) y=getAttributeProfiles();
1214                 for (vector<AttributeProfile*>::const_iterator m=src.m_AttributeProfiles.begin(); m!=src.m_AttributeProfiles.end(); m++) {
1215                     if (*m) {
1216                         y.push_back((*m)->cloneAttributeProfile());
1217                     }
1218                 }
1219                 VectorOf(Attribute) z=getAttributes();
1220                 for (vector<Attribute*>::const_iterator n=src.m_Attributes.begin(); n!=src.m_Attributes.end(); n++) {
1221                     if (*n) {
1222                         z.push_back((*n)->cloneAttribute());
1223                     }
1224                 }
1225             }
1226             
1227             IMPL_XMLOBJECT_CLONE(IDPSSODescriptor);
1228             SSODescriptorType* cloneSSODescriptorType() const {
1229                 return new IDPSSODescriptorImpl(*this);
1230             }
1231             RoleDescriptor* cloneRoleDescriptor() const {
1232                 return new IDPSSODescriptorImpl(*this);
1233             }
1234             
1235             IMPL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned);
1236             IMPL_TYPED_CHILDREN(SingleSignOnService,m_pos_SingleSignOnService);
1237             IMPL_TYPED_CHILDREN(NameIDMappingService,m_pos_NameIDMappingService);
1238             IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
1239             IMPL_TYPED_CHILDREN(AttributeProfile,m_pos_AttributeProfile);
1240             IMPL_TYPED_FOREIGN_CHILDREN(Attribute,saml2,m_children.end());
1241
1242             void setAttribute(QName& qualifiedName, const XMLCh* value) {
1243                 if (!qualifiedName.hasNamespaceURI()) {
1244                     if (XMLString::equals(qualifiedName.getLocalPart(),WANTAUTHNREQUESTSSIGNED_ATTRIB_NAME)) {
1245                         setWantAuthnRequestsSigned(value);
1246                         return;
1247                     }
1248                 }
1249                 RoleDescriptorImpl::setAttribute(qualifiedName, value);
1250             }
1251
1252         protected:
1253             void marshallAttributes(DOMElement* domElement) const {
1254                 MARSHALL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned,WANTAUTHNREQUESTSSIGNED,NULL);
1255                 RoleDescriptorImpl::marshallAttributes(domElement);
1256             }
1257             
1258             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1259                 PROC_TYPED_CHILDREN(SingleSignOnService,SAMLConstants::SAML20MD_NS,false);
1260                 PROC_TYPED_CHILDREN(NameIDMappingService,SAMLConstants::SAML20MD_NS,false);
1261                 PROC_TYPED_CHILDREN(AssertionIDRequestService,SAMLConstants::SAML20MD_NS,false);
1262                 PROC_TYPED_CHILDREN(AttributeProfile,SAMLConstants::SAML20MD_NS,false);
1263                 PROC_TYPED_FOREIGN_CHILDREN(Attribute,saml2,SAMLConstants::SAML20_NS,false);
1264                 SSODescriptorTypeImpl::processChildElement(childXMLObject,root);
1265             }
1266         };
1267
1268         class SAML_DLLLOCAL RequestedAttributeImpl : public virtual RequestedAttribute,
1269             public AbstractComplexElement,
1270             public AbstractAttributeExtensibleXMLObject,
1271             public AbstractDOMCachingXMLObject,
1272             public AbstractValidatingXMLObject,
1273             public AbstractXMLObjectMarshaller,
1274             public AbstractXMLObjectUnmarshaller
1275         {
1276             void init() {
1277                 m_Name=m_NameFormat=m_FriendlyName=NULL;
1278                 m_isRequired=XMLConstants::XML_BOOL_NULL;
1279             }
1280         public:
1281             virtual ~RequestedAttributeImpl() {
1282                 XMLString::release(&m_Name);
1283                 XMLString::release(&m_NameFormat);
1284                 XMLString::release(&m_FriendlyName);
1285             }
1286     
1287             RequestedAttributeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1288                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1289                 init();
1290             }
1291                 
1292             RequestedAttributeImpl(const RequestedAttributeImpl& src)
1293                     : AbstractXMLObject(src),
1294                         AbstractAttributeExtensibleXMLObject(src),
1295                         AbstractDOMCachingXMLObject(src),
1296                         AbstractValidatingXMLObject(src) {
1297                 init();
1298                 setName(src.getName());
1299                 setNameFormat(src.getNameFormat());
1300                 setFriendlyName(src.getFriendlyName());
1301                 isRequired(src.m_isRequired);
1302                 VectorOf(XMLObject) v=getAttributeValues();
1303                 for (vector<XMLObject*>::const_iterator i=src.m_AttributeValues.begin(); i!=src.m_AttributeValues.end(); i++) {
1304                     if (*i) {
1305                         v.push_back((*i)->clone());
1306                     }
1307                 }
1308             }
1309             
1310             IMPL_XMLOBJECT_CLONE(RequestedAttribute);
1311             Attribute* cloneAttribute() const {
1312                 return new RequestedAttributeImpl(*this);
1313             }
1314             
1315             IMPL_STRING_ATTRIB(Name);
1316             IMPL_STRING_ATTRIB(NameFormat);
1317             IMPL_STRING_ATTRIB(FriendlyName);
1318             IMPL_BOOLEAN_ATTRIB(isRequired);
1319             IMPL_XMLOBJECT_CHILDREN(AttributeValue,m_children.end());
1320     
1321             void setAttribute(QName& qualifiedName, const XMLCh* value) {
1322                 if (!qualifiedName.hasNamespaceURI()) {
1323                     if (XMLString::equals(qualifiedName.getLocalPart(),NAME_ATTRIB_NAME)) {
1324                         setName(value);
1325                         return;
1326                     }
1327                     else if (XMLString::equals(qualifiedName.getLocalPart(),NAMEFORMAT_ATTRIB_NAME)) {
1328                         setNameFormat(value);
1329                         return;
1330                     }
1331                     else if (XMLString::equals(qualifiedName.getLocalPart(),FRIENDLYNAME_ATTRIB_NAME)) {
1332                         setFriendlyName(value);
1333                         return;
1334                     }
1335                     else if (XMLString::equals(qualifiedName.getLocalPart(),ISREQUIRED_ATTRIB_NAME)) {
1336                         setisRequired(value);
1337                         return;
1338                     }
1339                 }
1340                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value);
1341             }
1342
1343         protected:
1344             void marshallAttributes(DOMElement* domElement) const {
1345                 MARSHALL_STRING_ATTRIB(Name,NAME,NULL);
1346                 MARSHALL_STRING_ATTRIB(NameFormat,NAMEFORMAT,NULL);
1347                 MARSHALL_STRING_ATTRIB(FriendlyName,FRIENDLYNAME,NULL);
1348                 MARSHALL_BOOLEAN_ATTRIB(isRequired,ISREQUIRED,NULL);
1349
1350                 // Take care of wildcard.
1351                 for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
1352                     DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
1353                     if (i->first.hasPrefix())
1354                         attr->setPrefix(i->first.getPrefix());
1355                     attr->setNodeValue(i->second);
1356                     domElement->setAttributeNode(attr);
1357                 }
1358             }
1359
1360             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1361                 getAttributeValues().push_back(childXMLObject);
1362             }
1363
1364             void processAttribute(const DOMAttr* attribute) {
1365                 QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix()); 
1366                 setAttribute(q,attribute->getNodeValue());
1367             }
1368         };
1369
1370         class SAML_DLLLOCAL AttributeConsumingServiceImpl : public virtual AttributeConsumingService,
1371             public AbstractComplexElement,
1372             public AbstractDOMCachingXMLObject,
1373             public AbstractValidatingXMLObject,
1374             public AbstractXMLObjectMarshaller,
1375             public AbstractXMLObjectUnmarshaller
1376         {
1377             list<XMLObject*>::iterator m_pos_ServiceDescription;
1378             list<XMLObject*>::iterator m_pos_RequestedAttribute;
1379             
1380                 void init() {
1381                 m_Index=NULL;
1382                 m_isDefault=XMLConstants::XML_BOOL_NULL;
1383                 m_children.push_back(NULL);
1384                 m_children.push_back(NULL);
1385                 m_pos_ServiceDescription=m_children.begin();
1386                 m_pos_RequestedAttribute=m_pos_ServiceDescription;
1387                 ++m_pos_RequestedAttribute;
1388             }
1389
1390         public:
1391             virtual ~AttributeConsumingServiceImpl() {
1392                 XMLString::release(&m_Index);
1393             }
1394     
1395             AttributeConsumingServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1396                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1397                 init();
1398             }
1399                 
1400             AttributeConsumingServiceImpl(const AttributeConsumingServiceImpl& src)
1401                     : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) {
1402                 init();
1403                 setIndex(src.m_Index);
1404                 isDefault(src.m_isDefault);
1405                 VectorOf(ServiceName) v=getServiceNames();
1406                 for (vector<ServiceName*>::const_iterator i=src.m_ServiceNames.begin(); i!=src.m_ServiceNames.end(); i++) {
1407                     if (*i) {
1408                         v.push_back((*i)->cloneServiceName());
1409                     }
1410                 }
1411                 VectorOf(ServiceDescription) w=getServiceDescriptions();
1412                 for (vector<ServiceDescription*>::const_iterator j=src.m_ServiceDescriptions.begin(); j!=src.m_ServiceDescriptions.end(); j++) {
1413                     if (*j) {
1414                         w.push_back((*j)->cloneServiceDescription());
1415                     }
1416                 }
1417                 VectorOf(RequestedAttribute) x=getRequestedAttributes();
1418                 for (vector<RequestedAttribute*>::const_iterator k=src.m_RequestedAttributes.begin(); k!=src.m_RequestedAttributes.end(); k++) {
1419                     if (*k) {
1420                         x.push_back((*k)->cloneRequestedAttribute());
1421                     }
1422                 }
1423             }
1424             
1425             IMPL_XMLOBJECT_CLONE(AttributeConsumingService);
1426             IMPL_INTEGER_ATTRIB(Index);
1427             IMPL_BOOLEAN_ATTRIB(isDefault);
1428             IMPL_TYPED_CHILDREN(ServiceName,m_pos_ServiceDescription);
1429             IMPL_TYPED_CHILDREN(ServiceDescription,m_pos_RequestedAttribute);
1430             IMPL_TYPED_CHILDREN(RequestedAttribute,m_children.end());
1431     
1432         protected:
1433             void marshallAttributes(DOMElement* domElement) const {
1434                 MARSHALL_INTEGER_ATTRIB(Index,INDEX,NULL);
1435                 MARSHALL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,NULL);
1436             }
1437
1438             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1439                 PROC_TYPED_CHILDREN(ServiceName,SAMLConstants::SAML20MD_NS,false);
1440                 PROC_TYPED_CHILDREN(ServiceDescription,SAMLConstants::SAML20MD_NS,false);
1441                 PROC_TYPED_CHILDREN(RequestedAttribute,SAMLConstants::SAML20MD_NS,false);
1442                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
1443             }
1444
1445             void processAttribute(const DOMAttr* attribute) {
1446                 PROC_INTEGER_ATTRIB(Index,INDEX,NULL);
1447                 PROC_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,NULL);
1448                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
1449             }
1450         };
1451
1452         class SAML_DLLLOCAL SPSSODescriptorImpl : public virtual SPSSODescriptor, public SSODescriptorTypeImpl
1453         {
1454             list<XMLObject*>::iterator m_pos_AssertionConsumerService;
1455             
1456             void init() {
1457                 m_AuthnRequestsSigned=XMLConstants::XML_BOOL_NULL;
1458                 m_WantAssertionsSigned=XMLConstants::XML_BOOL_NULL;
1459                 m_children.push_back(NULL);
1460                 m_pos_AssertionConsumerService=m_pos_NameIDFormat;
1461                 ++m_pos_AssertionConsumerService;
1462             }
1463         
1464         public:
1465             virtual ~SPSSODescriptorImpl() {}
1466     
1467             SPSSODescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1468                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1469                 init();
1470             }
1471                 
1472             SPSSODescriptorImpl(const SPSSODescriptorImpl& src) : AbstractXMLObject(src), SSODescriptorTypeImpl(src) {
1473                 init();
1474                 AuthnRequestsSigned(src.m_AuthnRequestsSigned);
1475                 WantAssertionsSigned(src.m_WantAssertionsSigned);
1476                 VectorOf(AssertionConsumerService) v=getAssertionConsumerServices();
1477                 for (vector<AssertionConsumerService*>::const_iterator i=src.m_AssertionConsumerServices.begin(); i!=src.m_AssertionConsumerServices.end(); i++) {
1478                     if (*i) {
1479                         v.push_back((*i)->cloneAssertionConsumerService());
1480                     }
1481                 }
1482                 VectorOf(AttributeConsumingService) w=getAttributeConsumingServices();
1483                 for (vector<AttributeConsumingService*>::const_iterator j=src.m_AttributeConsumingServices.begin(); j!=src.m_AttributeConsumingServices.end(); j++) {
1484                     if (*j) {
1485                         w.push_back((*j)->cloneAttributeConsumingService());
1486                     }
1487                 }
1488             }
1489             
1490             IMPL_XMLOBJECT_CLONE(SPSSODescriptor);
1491             SSODescriptorType* cloneSSODescriptorType() const {
1492                 return cloneSPSSODescriptor();
1493             }
1494             RoleDescriptor* cloneRoleDescriptor() const {
1495                 return cloneSPSSODescriptor();
1496             }
1497             
1498             IMPL_BOOLEAN_ATTRIB(AuthnRequestsSigned);
1499             IMPL_BOOLEAN_ATTRIB(WantAssertionsSigned);
1500             IMPL_TYPED_CHILDREN(AssertionConsumerService,m_pos_AssertionConsumerService);
1501             IMPL_TYPED_CHILDREN(AttributeConsumingService,m_children.end());
1502
1503             void setAttribute(QName& qualifiedName, const XMLCh* value) {
1504                 if (!qualifiedName.hasNamespaceURI()) {
1505                     if (XMLString::equals(qualifiedName.getLocalPart(),AUTHNREQUESTSSIGNED_ATTRIB_NAME)) {
1506                         setAuthnRequestsSigned(value);
1507                         return;
1508                     }
1509                     else if (XMLString::equals(qualifiedName.getLocalPart(),WANTASSERTIONSSIGNED_ATTRIB_NAME)) {
1510                         setWantAssertionsSigned(value);
1511                         return;
1512                     }
1513                 }
1514                 RoleDescriptorImpl::setAttribute(qualifiedName, value);
1515             }
1516
1517         protected:
1518             void marshallAttributes(DOMElement* domElement) const {
1519                 MARSHALL_BOOLEAN_ATTRIB(AuthnRequestsSigned,AUTHNREQUESTSSIGNED,NULL);
1520                 MARSHALL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,NULL);
1521                 RoleDescriptorImpl::marshallAttributes(domElement);
1522             }
1523             
1524             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1525                 PROC_TYPED_CHILDREN(AssertionConsumerService,SAMLConstants::SAML20MD_NS,false);
1526                 PROC_TYPED_CHILDREN(AttributeConsumingService,SAMLConstants::SAML20MD_NS,false);
1527                 SSODescriptorTypeImpl::processChildElement(childXMLObject,root);
1528             }
1529         };
1530
1531         class SAML_DLLLOCAL AuthnAuthorityDescriptorImpl : public virtual AuthnAuthorityDescriptor, public RoleDescriptorImpl
1532         {
1533             list<XMLObject*>::iterator m_pos_AuthnQueryService;
1534             list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
1535             
1536             void init() {
1537                 m_children.push_back(NULL);
1538                 m_children.push_back(NULL);
1539                 m_pos_AuthnQueryService=m_pos_ContactPerson;
1540                 ++m_pos_AuthnQueryService;
1541                 m_pos_AssertionIDRequestService=m_pos_AuthnQueryService;
1542                 ++m_pos_AssertionIDRequestService;
1543             }
1544         
1545         public:
1546             virtual ~AuthnAuthorityDescriptorImpl() {}
1547     
1548             AuthnAuthorityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1549                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1550                 init();
1551             }
1552                 
1553             AuthnAuthorityDescriptorImpl(const AuthnAuthorityDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1554                 init();
1555                 VectorOf(AuthnQueryService) v=getAuthnQueryServices();
1556                 for (vector<AuthnQueryService*>::const_iterator i=src.m_AuthnQueryServices.begin(); i!=src.m_AuthnQueryServices.end(); i++) {
1557                     if (*i) {
1558                         v.push_back((*i)->cloneAuthnQueryService());
1559                     }
1560                 }
1561                 VectorOf(AssertionIDRequestService) w=getAssertionIDRequestServices();
1562                 for (vector<AssertionIDRequestService*>::const_iterator j=src.m_AssertionIDRequestServices.begin(); j!=src.m_AssertionIDRequestServices.end(); j++) {
1563                     if (*j) {
1564                         w.push_back((*j)->cloneAssertionIDRequestService());
1565                     }
1566                 }
1567                 VectorOf(NameIDFormat) x=getNameIDFormats();
1568                 for (vector<NameIDFormat*>::const_iterator k=src.m_NameIDFormats.begin(); k!=src.m_NameIDFormats.end(); k++) {
1569                     if (*k) {
1570                         x.push_back((*k)->cloneNameIDFormat());
1571                     }
1572                 }
1573             }
1574             
1575             IMPL_XMLOBJECT_CLONE(AuthnAuthorityDescriptor);
1576             RoleDescriptor* cloneRoleDescriptor() const {
1577                 return cloneAuthnAuthorityDescriptor();
1578             }
1579             
1580             IMPL_TYPED_CHILDREN(AuthnQueryService,m_pos_AuthnQueryService);
1581             IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
1582             IMPL_TYPED_CHILDREN(NameIDFormat,m_children.end());
1583
1584         protected:
1585             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1586                 PROC_TYPED_CHILDREN(AuthnQueryService,SAMLConstants::SAML20MD_NS,false);
1587                 PROC_TYPED_CHILDREN(AssertionIDRequestService,SAMLConstants::SAML20MD_NS,false);
1588                 PROC_TYPED_CHILDREN(NameIDFormat,SAMLConstants::SAML20MD_NS,false);
1589                 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1590             }
1591         };
1592
1593         class SAML_DLLLOCAL PDPDescriptorImpl : public virtual PDPDescriptor, public RoleDescriptorImpl
1594         {
1595             list<XMLObject*>::iterator m_pos_AuthzService;
1596             list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
1597             
1598             void init() {
1599                 m_children.push_back(NULL);
1600                 m_children.push_back(NULL);
1601                 m_pos_AuthzService=m_pos_ContactPerson;
1602                 ++m_pos_AuthzService;
1603                 m_pos_AssertionIDRequestService=m_pos_AuthzService;
1604                 ++m_pos_AssertionIDRequestService;
1605             }
1606         
1607         public:
1608             virtual ~PDPDescriptorImpl() {}
1609     
1610             PDPDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1611                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1612                 init();
1613             }
1614                 
1615             PDPDescriptorImpl(const PDPDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1616                 init();
1617                 VectorOf(AuthzService) v=getAuthzServices();
1618                 for (vector<AuthzService*>::const_iterator i=src.m_AuthzServices.begin(); i!=src.m_AuthzServices.end(); i++) {
1619                     if (*i) {
1620                         v.push_back((*i)->cloneAuthzService());
1621                     }
1622                 }
1623                 VectorOf(AssertionIDRequestService) w=getAssertionIDRequestServices();
1624                 for (vector<AssertionIDRequestService*>::const_iterator j=src.m_AssertionIDRequestServices.begin(); j!=src.m_AssertionIDRequestServices.end(); j++) {
1625                     if (*j) {
1626                         w.push_back((*j)->cloneAssertionIDRequestService());
1627                     }
1628                 }
1629                 VectorOf(NameIDFormat) x=getNameIDFormats();
1630                 for (vector<NameIDFormat*>::const_iterator k=src.m_NameIDFormats.begin(); k!=src.m_NameIDFormats.end(); k++) {
1631                     if (*k) {
1632                         x.push_back((*k)->cloneNameIDFormat());
1633                     }
1634                 }
1635             }
1636             
1637             IMPL_XMLOBJECT_CLONE(PDPDescriptor);
1638             RoleDescriptor* cloneRoleDescriptor() const {
1639                 return clonePDPDescriptor();
1640             }
1641             
1642             IMPL_TYPED_CHILDREN(AuthzService,m_pos_AuthzService);
1643             IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
1644             IMPL_TYPED_CHILDREN(NameIDFormat,m_children.end());
1645
1646         protected:
1647             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1648                 PROC_TYPED_CHILDREN(AuthzService,SAMLConstants::SAML20MD_NS,false);
1649                 PROC_TYPED_CHILDREN(AssertionIDRequestService,SAMLConstants::SAML20MD_NS,false);
1650                 PROC_TYPED_CHILDREN(NameIDFormat,SAMLConstants::SAML20MD_NS,false);
1651                 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1652             }
1653         };
1654
1655         class SAML_DLLLOCAL AttributeAuthorityDescriptorImpl : public virtual AttributeAuthorityDescriptor, public RoleDescriptorImpl
1656         {
1657             list<XMLObject*>::iterator m_pos_AttributeService;
1658             list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
1659             list<XMLObject*>::iterator m_pos_NameIDFormat;
1660             list<XMLObject*>::iterator m_pos_AttributeProfile;
1661         
1662             void init() {
1663                 m_children.push_back(NULL);
1664                 m_children.push_back(NULL);
1665                 m_children.push_back(NULL);
1666                 m_children.push_back(NULL);
1667                 m_pos_AttributeService=m_pos_ContactPerson;
1668                 ++m_pos_AttributeService;
1669                 m_pos_AssertionIDRequestService=m_pos_AttributeService;
1670                 ++m_pos_AssertionIDRequestService;
1671                 m_pos_NameIDFormat=m_pos_AssertionIDRequestService;
1672                 ++m_pos_NameIDFormat;
1673                 m_pos_AttributeProfile=m_pos_NameIDFormat;
1674                 ++m_pos_AttributeProfile;
1675             }
1676         
1677         public:
1678             virtual ~AttributeAuthorityDescriptorImpl() {}
1679     
1680             AttributeAuthorityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1681                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1682                 init();
1683             }
1684                 
1685             AttributeAuthorityDescriptorImpl(const AttributeAuthorityDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1686                 init();
1687                 VectorOf(AttributeService) v=getAttributeServices();
1688                 for (vector<AttributeService*>::const_iterator i=src.m_AttributeServices.begin(); i!=src.m_AttributeServices.end(); i++) {
1689                     if (*i) {
1690                         v.push_back((*i)->cloneAttributeService());
1691                     }
1692                 }
1693                 VectorOf(AssertionIDRequestService) w=getAssertionIDRequestServices();
1694                 for (vector<AssertionIDRequestService*>::const_iterator j=src.m_AssertionIDRequestServices.begin(); j!=src.m_AssertionIDRequestServices.end(); j++) {
1695                     if (*j) {
1696                         w.push_back((*j)->cloneAssertionIDRequestService());
1697                     }
1698                 }
1699                 VectorOf(NameIDFormat) x=getNameIDFormats();
1700                 for (vector<NameIDFormat*>::const_iterator k=src.m_NameIDFormats.begin(); k!=src.m_NameIDFormats.end(); k++) {
1701                     if (*k) {
1702                         x.push_back((*k)->cloneNameIDFormat());
1703                     }
1704                 }
1705                 VectorOf(AttributeProfile) y=getAttributeProfiles();
1706                 for (vector<AttributeProfile*>::const_iterator m=src.m_AttributeProfiles.begin(); m!=src.m_AttributeProfiles.end(); m++) {
1707                     if (*m) {
1708                         y.push_back((*m)->cloneAttributeProfile());
1709                     }
1710                 }
1711                 VectorOf(Attribute) z=getAttributes();
1712                 for (vector<Attribute*>::const_iterator n=src.m_Attributes.begin(); n!=src.m_Attributes.end(); n++) {
1713                     if (*n) {
1714                         z.push_back((*n)->cloneAttribute());
1715                     }
1716                 }
1717             }
1718
1719             IMPL_XMLOBJECT_CLONE(AttributeAuthorityDescriptor);
1720             RoleDescriptor* cloneRoleDescriptor() const {
1721                 return cloneAttributeAuthorityDescriptor();
1722             }
1723             
1724             IMPL_TYPED_CHILDREN(AttributeService,m_pos_AttributeService);
1725             IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
1726             IMPL_TYPED_CHILDREN(NameIDFormat,m_pos_NameIDFormat);
1727             IMPL_TYPED_CHILDREN(AttributeProfile,m_pos_AttributeProfile);
1728             IMPL_TYPED_FOREIGN_CHILDREN(Attribute,saml2,m_children.end());
1729
1730         protected:
1731             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1732                 PROC_TYPED_CHILDREN(AttributeService,SAMLConstants::SAML20MD_NS,false);
1733                 PROC_TYPED_CHILDREN(AssertionIDRequestService,SAMLConstants::SAML20MD_NS,false);
1734                 PROC_TYPED_CHILDREN(NameIDFormat,SAMLConstants::SAML20MD_NS,false);
1735                 PROC_TYPED_CHILDREN(AttributeProfile,SAMLConstants::SAML20MD_NS,false);
1736                 PROC_TYPED_FOREIGN_CHILDREN(Attribute,saml2,SAMLConstants::SAML20_NS,false);
1737                 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1738             }
1739         };
1740
1741         class SAML_DLLLOCAL AffiliationDescriptorImpl : public virtual AffiliationDescriptor,
1742             public virtual SignableObject,
1743             public AbstractComplexElement,
1744             public AbstractAttributeExtensibleXMLObject,
1745             public AbstractDOMCachingXMLObject,
1746             public AbstractValidatingXMLObject,
1747             public AbstractXMLObjectMarshaller,
1748             public AbstractXMLObjectUnmarshaller
1749         {
1750             list<XMLObject*>::iterator m_pos_AffiliateMember;
1751
1752             void init() {
1753                 m_ID=m_AffiliationOwnerID=NULL;
1754                 m_ValidUntil=m_CacheDuration=NULL;
1755                 m_children.push_back(NULL);
1756                 m_children.push_back(NULL);
1757                 m_children.push_back(NULL);
1758                 m_Signature=NULL;
1759                 m_Extensions=NULL;
1760                 m_pos_Signature=m_children.begin();
1761                 m_pos_Extensions=m_pos_Signature;
1762                 ++m_pos_Extensions;
1763                 m_pos_AffiliateMember=m_pos_Extensions;
1764                 ++m_pos_AffiliateMember;
1765             }
1766             
1767         public:
1768             virtual ~AffiliationDescriptorImpl() {
1769                 XMLString::release(&m_ID);
1770                 XMLString::release(&m_AffiliationOwnerID);
1771                 delete m_ValidUntil;
1772                 delete m_CacheDuration;
1773             }
1774     
1775             AffiliationDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1776                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1777                 init();
1778             }
1779                 
1780             AffiliationDescriptorImpl(const AffiliationDescriptorImpl& src)
1781                     : AbstractXMLObject(src),
1782                         AbstractAttributeExtensibleXMLObject(src),
1783                         AbstractDOMCachingXMLObject(src),
1784                         AbstractValidatingXMLObject(src) {
1785                 init();
1786                 setID(src.getID());
1787                 setAffiliationOwnerID(src.getAffiliationOwnerID());
1788                 setValidUntil(src.getValidUntil());
1789                 setCacheDuration(src.getCacheDuration());
1790                 if (src.getSignature())
1791                     setSignature(src.getSignature()->cloneSignature());
1792                 if (src.getExtensions())
1793                     setExtensions(src.getExtensions()->cloneExtensions());
1794                 
1795                 VectorOf(KeyDescriptor) v=getKeyDescriptors();
1796                 for (vector<KeyDescriptor*>::const_iterator i=src.m_KeyDescriptors.begin(); i!=src.m_KeyDescriptors.end(); i++) {
1797                     if (*i) {
1798                         v.push_back((*i)->cloneKeyDescriptor());
1799                     }
1800                 }
1801                 VectorOf(AffiliateMember) w=getAffiliateMembers();
1802                 for (vector<AffiliateMember*>::const_iterator j=src.m_AffiliateMembers.begin(); j!=src.m_AffiliateMembers.end(); j++) {
1803                     if (*j) {
1804                         w.push_back((*j)->cloneAffiliateMember());
1805                     }
1806                 }
1807             }
1808
1809             IMPL_XMLOBJECT_CLONE(AffiliationDescriptor);
1810
1811             const XMLCh* getId() const {
1812                 return getID();
1813             }
1814
1815             //IMPL_TYPED_CHILD(Signature);
1816             // Need customized setter.
1817         protected:
1818             Signature* m_Signature;
1819             list<XMLObject*>::iterator m_pos_Signature;
1820         public:
1821             Signature* getSignature() const {
1822                 return m_Signature;
1823             }
1824             
1825             void setSignature(Signature* sig) {
1826                 prepareForAssignment(m_Signature,sig);
1827                 *m_pos_Signature=m_Signature=sig;
1828                 // Sync content reference back up.
1829                 if (m_Signature)
1830                     m_Signature->setContentReference(new opensaml::ContentReference(*this));
1831             }
1832             
1833             IMPL_STRING_ATTRIB(ID);
1834             IMPL_STRING_ATTRIB(AffiliationOwnerID);
1835             IMPL_DATETIME_ATTRIB(ValidUntil);
1836             IMPL_DATETIME_ATTRIB(CacheDuration);
1837             IMPL_TYPED_CHILD(Extensions);
1838             IMPL_TYPED_CHILDREN(AffiliateMember,m_pos_AffiliateMember);
1839             IMPL_TYPED_CHILDREN(KeyDescriptor,m_children.end());
1840     
1841             void setAttribute(QName& qualifiedName, const XMLCh* value) {
1842                 if (!qualifiedName.hasNamespaceURI()) {
1843                     if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) {
1844                         setID(value);
1845                         return;
1846                     }
1847                     else if (XMLString::equals(qualifiedName.getLocalPart(),AFFILIATIONOWNERID_ATTRIB_NAME)) {
1848                         setAffiliationOwnerID(value);
1849                         return;
1850                     }
1851                     else if (XMLString::equals(qualifiedName.getLocalPart(),VALIDUNTIL_ATTRIB_NAME)) {
1852                         setValidUntil(value);
1853                         return;
1854                     }
1855                     else if (XMLString::equals(qualifiedName.getLocalPart(),CACHEDURATION_ATTRIB_NAME)) {
1856                         setCacheDuration(value);
1857                         return;
1858                     }
1859                 }
1860                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value);
1861             }
1862
1863         protected:
1864             void marshallAttributes(DOMElement* domElement) const {
1865                 MARSHALL_ID_ATTRIB(ID,ID,NULL);
1866                 MARSHALL_STRING_ATTRIB(AffiliationOwnerID,AFFILIATIONOWNERID,NULL);
1867                 MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,NULL);
1868                 MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,NULL);
1869                 
1870                 // Take care of wildcard.
1871                 for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
1872                     DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
1873                     if (i->first.hasPrefix())
1874                         attr->setPrefix(i->first.getPrefix());
1875                     attr->setNodeValue(i->second);
1876                     domElement->setAttributeNode(attr);
1877                 }
1878             }
1879
1880             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1881                 PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLConstants::XMLSIG_NS,false);
1882                 PROC_TYPED_CHILD(Extensions,SAMLConstants::SAML20MD_NS,false);
1883                 PROC_TYPED_CHILDREN(AffiliateMember,SAMLConstants::SAML20MD_NS,false);
1884                 PROC_TYPED_CHILDREN(KeyDescriptor,SAMLConstants::SAML20MD_NS,false);
1885                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
1886             }
1887
1888             void processAttribute(const DOMAttr* attribute) {
1889                 PROC_ID_ATTRIB(ID,ID,NULL);
1890                 QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix()); 
1891                 setAttribute(q,attribute->getNodeValue());
1892             }
1893         };
1894
1895         class SAML_DLLLOCAL EntityDescriptorImpl : public virtual EntityDescriptor,
1896             public virtual SignableObject,
1897             public AbstractComplexElement,
1898             public AbstractAttributeExtensibleXMLObject,
1899             public AbstractDOMCachingXMLObject,
1900             public AbstractValidatingXMLObject,
1901             public AbstractXMLObjectMarshaller,
1902             public AbstractXMLObjectUnmarshaller
1903         {
1904             list<XMLObject*>::iterator m_pos_ContactPerson;
1905
1906             void init() {
1907                 m_ID=m_EntityID=NULL;
1908                 m_ValidUntil=m_CacheDuration=NULL;
1909                 m_children.push_back(NULL);
1910                 m_children.push_back(NULL);
1911                 m_children.push_back(NULL);
1912                 m_children.push_back(NULL);
1913                 m_children.push_back(NULL);
1914                 m_Signature=NULL;
1915                 m_Extensions=NULL;
1916                 m_AffiliationDescriptor=NULL;
1917                 m_Organization=NULL;
1918                 m_pos_Signature=m_children.begin();
1919                 m_pos_Extensions=m_pos_Signature;
1920                 ++m_pos_Extensions;
1921                 m_pos_AffiliationDescriptor=m_pos_Extensions;
1922                 ++m_pos_AffiliationDescriptor;
1923                 m_pos_Organization=m_pos_AffiliationDescriptor;
1924                 ++m_pos_Organization;
1925                 m_pos_ContactPerson=m_pos_Organization;
1926                 ++m_pos_ContactPerson;
1927             }
1928             
1929         public:
1930             virtual ~EntityDescriptorImpl() {
1931                 XMLString::release(&m_ID);
1932                 XMLString::release(&m_EntityID);
1933                 delete m_ValidUntil;
1934                 delete m_CacheDuration;
1935             }
1936     
1937             EntityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
1938                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1939                 init();
1940             }
1941                 
1942             EntityDescriptorImpl(const EntityDescriptorImpl& src)
1943                     : AbstractXMLObject(src),
1944                         AbstractAttributeExtensibleXMLObject(src),
1945                         AbstractDOMCachingXMLObject(src),
1946                         AbstractValidatingXMLObject(src) {
1947                 init();
1948                 setID(src.getID());
1949                 setEntityID(src.getEntityID());
1950                 setValidUntil(src.getValidUntil());
1951                 setCacheDuration(src.getCacheDuration());
1952                 if (src.getSignature())
1953                     setSignature(src.getSignature()->cloneSignature());
1954                 if (src.getExtensions())
1955                     setExtensions(src.getExtensions()->cloneExtensions());
1956                 if (src.getAffiliationDescriptor())
1957                     setAffiliationDescriptor(src.getAffiliationDescriptor()->cloneAffiliationDescriptor());
1958                 if (src.getOrganization())
1959                     setOrganization(src.getOrganization()->cloneOrganization());
1960                 
1961                 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
1962                     if (*i) {
1963                         IDPSSODescriptor* idp=dynamic_cast<IDPSSODescriptor*>(*i);
1964                         if (idp) {
1965                             getIDPSSODescriptors().push_back(idp->cloneIDPSSODescriptor());
1966                             continue;
1967                         }
1968                         
1969                         SPSSODescriptor* sp=dynamic_cast<SPSSODescriptor*>(*i);
1970                         if (sp) {
1971                             getSPSSODescriptors().push_back(sp->cloneSPSSODescriptor());
1972                             continue;
1973                         }
1974
1975                         AuthnAuthorityDescriptor* authn=dynamic_cast<AuthnAuthorityDescriptor*>(*i);
1976                         if (authn) {
1977                             getAuthnAuthorityDescriptors().push_back(authn->cloneAuthnAuthorityDescriptor());
1978                             continue;
1979                         }
1980
1981                         AttributeAuthorityDescriptor* attr=dynamic_cast<AttributeAuthorityDescriptor*>(*i);
1982                         if (attr) {
1983                             getAttributeAuthorityDescriptors().push_back(attr->cloneAttributeAuthorityDescriptor());
1984                             continue;
1985                         }
1986
1987                         PDPDescriptor* pdp=dynamic_cast<PDPDescriptor*>(*i);
1988                         if (pdp) {
1989                             getPDPDescriptors().push_back(pdp->clonePDPDescriptor());
1990                             continue;
1991                         }
1992     
1993                         RoleDescriptor* role=dynamic_cast<RoleDescriptor*>(*i);
1994                         if (role) {
1995                             getRoleDescriptors().push_back(role->cloneRoleDescriptor());
1996                             continue;
1997                         }
1998                     }
1999                 }
2000
2001                 VectorOf(ContactPerson) v=getContactPersons();
2002                 for (vector<ContactPerson*>::const_iterator j=src.m_ContactPersons.begin(); j!=src.m_ContactPersons.end(); j++) {
2003                     if (*j) {
2004                         v.push_back((*j)->cloneContactPerson());
2005                     }
2006                 }
2007                 VectorOf(AdditionalMetadataLocation) w=getAdditionalMetadataLocations();
2008                 for (vector<AdditionalMetadataLocation*>::const_iterator k=src.m_AdditionalMetadataLocations.begin(); k!=src.m_AdditionalMetadataLocations.end(); k++) {
2009                     if (*k) {
2010                         w.push_back((*k)->cloneAdditionalMetadataLocation());
2011                     }
2012                 }
2013             }
2014
2015             IMPL_XMLOBJECT_CLONE(EntityDescriptor);
2016
2017             const XMLCh* getId() const {
2018                 return getID();
2019             }
2020
2021             //IMPL_TYPED_CHILD(Signature);
2022             // Need customized setter.
2023         protected:
2024             Signature* m_Signature;
2025             list<XMLObject*>::iterator m_pos_Signature;
2026         public:
2027             Signature* getSignature() const {
2028                 return m_Signature;
2029             }
2030             
2031             void setSignature(Signature* sig) {
2032                 prepareForAssignment(m_Signature,sig);
2033                 *m_pos_Signature=m_Signature=sig;
2034                 // Sync content reference back up.
2035                 if (m_Signature)
2036                     m_Signature->setContentReference(new opensaml::ContentReference(*this));
2037             }
2038             
2039             IMPL_STRING_ATTRIB(ID);
2040             IMPL_STRING_ATTRIB(EntityID);
2041             IMPL_DATETIME_ATTRIB(ValidUntil);
2042             IMPL_DATETIME_ATTRIB(CacheDuration);
2043             IMPL_TYPED_CHILD(Extensions);
2044             IMPL_TYPED_CHILDREN(RoleDescriptor,m_pos_AffiliationDescriptor);
2045             IMPL_TYPED_CHILDREN(IDPSSODescriptor,m_pos_AffiliationDescriptor);
2046             IMPL_TYPED_CHILDREN(SPSSODescriptor,m_pos_AffiliationDescriptor);
2047             IMPL_TYPED_CHILDREN(AuthnAuthorityDescriptor,m_pos_AffiliationDescriptor);
2048             IMPL_TYPED_CHILDREN(AttributeAuthorityDescriptor,m_pos_AffiliationDescriptor);
2049             IMPL_TYPED_CHILDREN(PDPDescriptor,m_pos_AffiliationDescriptor);
2050             IMPL_TYPED_CHILD(AffiliationDescriptor);
2051             IMPL_TYPED_CHILD(Organization);
2052             IMPL_TYPED_CHILDREN(ContactPerson,m_pos_ContactPerson);
2053             IMPL_TYPED_CHILDREN(AdditionalMetadataLocation,m_children.end());
2054     
2055             void setAttribute(QName& qualifiedName, const XMLCh* value) {
2056                 if (!qualifiedName.hasNamespaceURI()) {
2057                     if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) {
2058                         setID(value);
2059                         return;
2060                     }
2061                     else if (XMLString::equals(qualifiedName.getLocalPart(),ENTITYID_ATTRIB_NAME)) {
2062                         setEntityID(value);
2063                         return;
2064                     }
2065                     else if (XMLString::equals(qualifiedName.getLocalPart(),VALIDUNTIL_ATTRIB_NAME)) {
2066                         setValidUntil(value);
2067                         return;
2068                     }
2069                     else if (XMLString::equals(qualifiedName.getLocalPart(),CACHEDURATION_ATTRIB_NAME)) {
2070                         setCacheDuration(value);
2071                         return;
2072                     }
2073                 }
2074                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value);
2075             }
2076
2077         protected:
2078             void marshallAttributes(DOMElement* domElement) const {
2079                 MARSHALL_ID_ATTRIB(ID,ID,NULL);
2080                 MARSHALL_STRING_ATTRIB(EntityID,ENTITYID,NULL);
2081                 MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,NULL);
2082                 MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,NULL);
2083                 
2084                 // Take care of wildcard.
2085                 for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
2086                     DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
2087                     if (i->first.hasPrefix())
2088                         attr->setPrefix(i->first.getPrefix());
2089                     attr->setNodeValue(i->second);
2090                     domElement->setAttributeNode(attr);
2091                 }
2092             }
2093
2094             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
2095                 PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLConstants::XMLSIG_NS,false);
2096                 PROC_TYPED_CHILD(Extensions,SAMLConstants::SAML20MD_NS,false);
2097                 PROC_TYPED_CHILDREN(RoleDescriptor,SAMLConstants::SAML20MD_NS,false);
2098                 PROC_TYPED_CHILDREN(IDPSSODescriptor,SAMLConstants::SAML20MD_NS,false);
2099                 PROC_TYPED_CHILDREN(SPSSODescriptor,SAMLConstants::SAML20MD_NS,false);
2100                 PROC_TYPED_CHILDREN(AuthnAuthorityDescriptor,SAMLConstants::SAML20MD_NS,false);
2101                 PROC_TYPED_CHILDREN(AttributeAuthorityDescriptor,SAMLConstants::SAML20MD_NS,false);
2102                 PROC_TYPED_CHILDREN(PDPDescriptor,SAMLConstants::SAML20MD_NS,false);
2103                 PROC_TYPED_CHILD(AffiliationDescriptor,SAMLConstants::SAML20MD_NS,false);
2104                 PROC_TYPED_CHILD(Organization,SAMLConstants::SAML20MD_NS,false);
2105                 PROC_TYPED_CHILDREN(ContactPerson,SAMLConstants::SAML20MD_NS,false);
2106                 PROC_TYPED_CHILDREN(AdditionalMetadataLocation,SAMLConstants::SAML20MD_NS,false);
2107                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
2108             }
2109
2110             void processAttribute(const DOMAttr* attribute) {
2111                 PROC_ID_ATTRIB(ID,ID,NULL);
2112                 QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix()); 
2113                 setAttribute(q,attribute->getNodeValue());
2114             }
2115         };
2116
2117         class SAML_DLLLOCAL EntitiesDescriptorImpl : public virtual EntitiesDescriptor,
2118             public virtual SignableObject,
2119             public AbstractComplexElement,
2120             public AbstractDOMCachingXMLObject,
2121             public AbstractValidatingXMLObject,
2122             public AbstractXMLObjectMarshaller,
2123             public AbstractXMLObjectUnmarshaller
2124         {
2125             void init() {
2126                 m_ID=m_Name=NULL;
2127                 m_ValidUntil=m_CacheDuration=NULL;
2128                 m_children.push_back(NULL);
2129                 m_children.push_back(NULL);
2130                 m_Signature=NULL;
2131                 m_Extensions=NULL;
2132                 m_pos_Signature=m_children.begin();
2133                 m_pos_Extensions=m_pos_Signature;
2134                 ++m_pos_Extensions;
2135             }
2136             
2137         public:
2138             virtual ~EntitiesDescriptorImpl() {
2139                 XMLString::release(&m_ID);
2140                 XMLString::release(&m_Name);
2141                 delete m_ValidUntil;
2142                 delete m_CacheDuration;
2143             }
2144     
2145             EntitiesDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
2146                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
2147                 init();
2148             }
2149                 
2150             EntitiesDescriptorImpl(const EntitiesDescriptorImpl& src)
2151                     : AbstractXMLObject(src),
2152                         AbstractDOMCachingXMLObject(src),
2153                         AbstractValidatingXMLObject(src) {
2154                 init();
2155                 setID(src.getID());
2156                 setName(src.getName());
2157                 setValidUntil(src.getValidUntil());
2158                 setCacheDuration(src.getCacheDuration());
2159                 if (src.getSignature())
2160                     setSignature(src.getSignature()->cloneSignature());
2161                 if (src.getExtensions())
2162                     setExtensions(src.getExtensions()->cloneExtensions());
2163                 
2164                 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
2165                     if (*i) {
2166                         EntityDescriptor* e=dynamic_cast<EntityDescriptor*>(*i);
2167                         if (e) {
2168                             getEntityDescriptors().push_back(e->cloneEntityDescriptor());
2169                             continue;
2170                         }
2171                         
2172                         EntitiesDescriptor* es=dynamic_cast<EntitiesDescriptor*>(*i);
2173                         if (es) {
2174                             getEntitiesDescriptors().push_back(es->cloneEntitiesDescriptor());
2175                             continue;
2176                         }
2177                     }
2178                 }
2179             }
2180
2181             IMPL_XMLOBJECT_CLONE(EntitiesDescriptor);
2182
2183             const XMLCh* getId() const {
2184                 return getID();
2185             }
2186
2187             //IMPL_TYPED_CHILD(Signature);
2188             // Need customized setter.
2189         protected:
2190             Signature* m_Signature;
2191             list<XMLObject*>::iterator m_pos_Signature;
2192         public:
2193             Signature* getSignature() const {
2194                 return m_Signature;
2195             }
2196             
2197             void setSignature(Signature* sig) {
2198                 prepareForAssignment(m_Signature,sig);
2199                 *m_pos_Signature=m_Signature=sig;
2200                 // Sync content reference back up.
2201                 if (m_Signature)
2202                     m_Signature->setContentReference(new opensaml::ContentReference(*this));
2203             }
2204             
2205             IMPL_STRING_ATTRIB(ID);
2206             IMPL_STRING_ATTRIB(Name);
2207             IMPL_DATETIME_ATTRIB(ValidUntil);
2208             IMPL_DATETIME_ATTRIB(CacheDuration);
2209             IMPL_TYPED_CHILD(Extensions);
2210             IMPL_TYPED_CHILDREN(EntityDescriptor,m_children.end());
2211             IMPL_TYPED_CHILDREN(EntitiesDescriptor,m_children.end());
2212     
2213         protected:
2214             void marshallAttributes(DOMElement* domElement) const {
2215                 MARSHALL_ID_ATTRIB(ID,ID,NULL);
2216                 MARSHALL_STRING_ATTRIB(Name,NAME,NULL);
2217                 MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,NULL);
2218                 MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,NULL);
2219             }
2220
2221             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
2222                 PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLConstants::XMLSIG_NS,false);
2223                 PROC_TYPED_CHILD(Extensions,SAMLConstants::SAML20MD_NS,false);
2224                 PROC_TYPED_CHILDREN(EntityDescriptor,SAMLConstants::SAML20MD_NS,false);
2225                 PROC_TYPED_CHILDREN(EntitiesDescriptor,SAMLConstants::SAML20MD_NS,false);
2226                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
2227             }
2228
2229             void processAttribute(const DOMAttr* attribute) {
2230                 PROC_ID_ATTRIB(ID,ID,NULL);
2231                 PROC_STRING_ATTRIB(Name,NAME,NULL);
2232                 PROC_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,NULL);
2233                 PROC_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,NULL);
2234             }
2235         };
2236
2237     };
2238 };
2239
2240 #if defined (_MSC_VER)
2241     #pragma warning( pop )
2242 #endif
2243
2244 // Builder Implementations
2245
2246 IMPL_XMLOBJECTBUILDER(AdditionalMetadataLocation);
2247 IMPL_XMLOBJECTBUILDER(AffiliateMember);
2248 IMPL_XMLOBJECTBUILDER(AffiliationDescriptor);
2249 IMPL_XMLOBJECTBUILDER(ArtifactResolutionService);
2250 IMPL_XMLOBJECTBUILDER(AssertionConsumerService);
2251 IMPL_XMLOBJECTBUILDER(AssertionIDRequestService);
2252 IMPL_XMLOBJECTBUILDER(AttributeAuthorityDescriptor);
2253 IMPL_XMLOBJECTBUILDER(AttributeConsumingService);
2254 IMPL_XMLOBJECTBUILDER(AttributeProfile);
2255 IMPL_XMLOBJECTBUILDER(AttributeService);
2256 IMPL_XMLOBJECTBUILDER(AuthnAuthorityDescriptor);
2257 IMPL_XMLOBJECTBUILDER(AuthnQueryService);
2258 IMPL_XMLOBJECTBUILDER(AuthzService);
2259 IMPL_XMLOBJECTBUILDER(Company);
2260 IMPL_XMLOBJECTBUILDER(ContactPerson);
2261 IMPL_XMLOBJECTBUILDER(EmailAddress);
2262 IMPL_XMLOBJECTBUILDER(EndpointType);
2263 IMPL_XMLOBJECTBUILDER(EntitiesDescriptor);
2264 IMPL_XMLOBJECTBUILDER(EntityDescriptor);
2265 IMPL_XMLOBJECTBUILDER(Extensions);
2266 IMPL_XMLOBJECTBUILDER(GivenName);
2267 IMPL_XMLOBJECTBUILDER(IDPSSODescriptor);
2268 IMPL_XMLOBJECTBUILDER(IndexedEndpointType);
2269 IMPL_XMLOBJECTBUILDER(KeyDescriptor);
2270 IMPL_XMLOBJECTBUILDER(localizedNameType);
2271 IMPL_XMLOBJECTBUILDER(localizedURIType);
2272 IMPL_XMLOBJECTBUILDER(ManageNameIDService);
2273 IMPL_XMLOBJECTBUILDER(NameIDFormat);
2274 IMPL_XMLOBJECTBUILDER(NameIDMappingService);
2275 IMPL_XMLOBJECTBUILDER(Organization);
2276 IMPL_XMLOBJECTBUILDER(OrganizationName);
2277 IMPL_XMLOBJECTBUILDER(OrganizationDisplayName);
2278 IMPL_XMLOBJECTBUILDER(OrganizationURL);
2279 IMPL_XMLOBJECTBUILDER(PDPDescriptor);
2280 IMPL_XMLOBJECTBUILDER(RequestedAttribute);
2281 IMPL_XMLOBJECTBUILDER(ServiceDescription);
2282 IMPL_XMLOBJECTBUILDER(ServiceName);
2283 IMPL_XMLOBJECTBUILDER(SingleLogoutService);
2284 IMPL_XMLOBJECTBUILDER(SingleSignOnService);
2285 IMPL_XMLOBJECTBUILDER(SPSSODescriptor);
2286 IMPL_XMLOBJECTBUILDER(SurName);
2287 IMPL_XMLOBJECTBUILDER(TelephoneNumber);
2288
2289 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);
2290 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);
2291 const XMLCh AdditionalMetadataLocation::NAMESPACE_ATTRIB_NAME[] =   UNICODE_LITERAL_9(n,a,m,e,s,p,a,c,e);
2292 const XMLCh AffiliateMember::LOCAL_NAME[] =             UNICODE_LITERAL_15(A,f,f,i,l,i,a,t,e,M,e,m,b,e,r);
2293 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);
2294 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);
2295 const XMLCh AffiliationDescriptor::ID_ATTRIB_NAME[] =   UNICODE_LITERAL_2(I,D);
2296 const XMLCh AffiliationDescriptor::VALIDUNTIL_ATTRIB_NAME[] =   UNICODE_LITERAL_10(v,a,l,i,d,U,n,t,i,l);
2297 const XMLCh AffiliationDescriptor::CACHEDURATION_ATTRIB_NAME[] =    UNICODE_LITERAL_13(c,a,c,h,e,D,u,r,a,t,i,o,n);
2298 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);
2299 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);
2300 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);
2301 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);
2302 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);
2303 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);
2304 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);
2305 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);
2306 const XMLCh AttributeConsumingService::INDEX_ATTRIB_NAME[] =    UNICODE_LITERAL_5(i,n,d,e,x);
2307 const XMLCh AttributeConsumingService::ISDEFAULT_ATTRIB_NAME[] =    UNICODE_LITERAL_9(i,s,D,e,f,a,u,l,t);
2308 const XMLCh AttributeProfile::LOCAL_NAME[] =            UNICODE_LITERAL_16(A,t,t,r,i,b,u,t,e,P,r,o,f,i,l,e);
2309 const XMLCh AttributeService::LOCAL_NAME[] =            UNICODE_LITERAL_16(A,t,t,r,i,b,u,t,e,S,e,r,v,i,c,e);
2310 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);
2311 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);
2312 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);
2313 const XMLCh AuthzService::LOCAL_NAME[] =                UNICODE_LITERAL_12(A,u,t,h,z,S,e,r,v,i,c,e);
2314 const XMLCh Company::LOCAL_NAME[] =                     UNICODE_LITERAL_7(C,o,m,p,a,n,y);
2315 const XMLCh ContactPerson::LOCAL_NAME[] =               UNICODE_LITERAL_13(C,o,n,t,a,c,t,P,e,r,s,o,n);
2316 const XMLCh ContactPerson::TYPE_NAME[] =                UNICODE_LITERAL_11(C,o,n,t,a,c,t,T,y,p,e);
2317 const XMLCh ContactPerson::CONTACTTYPE_ATTRIB_NAME[] =  UNICODE_LITERAL_11(c,o,n,t,a,c,t,T,y,p,e);
2318 const XMLCh ContactPerson::CONTACT_TECHNICAL[] =        UNICODE_LITERAL_9(t,e,c,h,n,i,c,a,l);
2319 const XMLCh ContactPerson::CONTACT_SUPPORT[] =          UNICODE_LITERAL_7(s,u,p,p,o,r,t);
2320 const XMLCh ContactPerson::CONTACT_ADMINISTRATIVE[] =   UNICODE_LITERAL_14(a,d,m,i,n,i,s,t,r,a,t,i,v,e);
2321 const XMLCh ContactPerson::CONTACT_BILLING[] =          UNICODE_LITERAL_7(b,i,l,l,i,n,g);
2322 const XMLCh ContactPerson::CONTACT_OTHER[] =            UNICODE_LITERAL_5(o,t,h,e,r);
2323 const XMLCh EmailAddress::LOCAL_NAME[] =                UNICODE_LITERAL_12(E,m,a,i,l,A,d,d,r,e,s,s);
2324 const XMLCh EndpointType::LOCAL_NAME[] =                {chNull};
2325 const XMLCh EndpointType::TYPE_NAME[] =                 UNICODE_LITERAL_12(E,n,d,p,o,i,n,t,T,y,p,e);
2326 const XMLCh EndpointType::BINDING_ATTRIB_NAME[] =       UNICODE_LITERAL_7(B,i,n,d,i,n,g);
2327 const XMLCh EndpointType::LOCATION_ATTRIB_NAME[] =      UNICODE_LITERAL_8(L,o,c,a,t,i,o,n);
2328 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);
2329 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);
2330 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);
2331 const XMLCh EntitiesDescriptor::ID_ATTRIB_NAME[] =      UNICODE_LITERAL_2(I,D);
2332 const XMLCh EntitiesDescriptor::VALIDUNTIL_ATTRIB_NAME[] =    UNICODE_LITERAL_10(v,a,l,i,d,U,n,t,i,l);
2333 const XMLCh EntitiesDescriptor::CACHEDURATION_ATTRIB_NAME[] = UNICODE_LITERAL_13(c,a,c,h,e,D,u,r,a,t,i,o,n);
2334 const XMLCh EntitiesDescriptor::NAME_ATTRIB_NAME[] =    UNICODE_LITERAL_4(N,a,m,e);
2335 const XMLCh EntityDescriptor::LOCAL_NAME[] =            UNICODE_LITERAL_16(E,n,t,i,t,y,D,e,s,c,r,i,p,t,o,r);
2336 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);
2337 const XMLCh EntityDescriptor::ID_ATTRIB_NAME[] =        UNICODE_LITERAL_2(I,D);
2338 const XMLCh EntityDescriptor::VALIDUNTIL_ATTRIB_NAME[] =    UNICODE_LITERAL_10(v,a,l,i,d,U,n,t,i,l);
2339 const XMLCh EntityDescriptor::CACHEDURATION_ATTRIB_NAME[] = UNICODE_LITERAL_13(c,a,c,h,e,D,u,r,a,t,i,o,n);
2340 const XMLCh EntityDescriptor::ENTITYID_ATTRIB_NAME[] =  UNICODE_LITERAL_8(e,n,t,i,t,y,I,D);
2341 const XMLCh Extensions::LOCAL_NAME[] =                  UNICODE_LITERAL_10(E,x,t,e,n,s,i,o,n,s);
2342 const XMLCh Extensions::TYPE_NAME[] =                   UNICODE_LITERAL_14(E,x,t,e,n,s,i,o,n,s,T,y,p,e);
2343 const XMLCh GivenName::LOCAL_NAME[] =                   UNICODE_LITERAL_9(G,i,v,e,n,N,a,m,e);
2344 const XMLCh IDPSSODescriptor::LOCAL_NAME[] =            UNICODE_LITERAL_16(I,D,P,S,S,O,D,e,s,c,r,i,p,t,o,r);
2345 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);
2346 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);
2347 const XMLCh IndexedEndpointType::LOCAL_NAME[] =         {chNull};
2348 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);
2349 const XMLCh IndexedEndpointType::INDEX_ATTRIB_NAME[] =  UNICODE_LITERAL_5(i,n,d,e,x);
2350 const XMLCh IndexedEndpointType::ISDEFAULT_ATTRIB_NAME[] =  UNICODE_LITERAL_9(i,s,D,e,f,a,u,l,t);
2351 const XMLCh KeyDescriptor::LOCAL_NAME[] =               UNICODE_LITERAL_13(K,e,y,D,e,s,c,r,i,p,t,o,r);
2352 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);
2353 const XMLCh KeyDescriptor::USE_ATTRIB_NAME[] =          UNICODE_LITERAL_3(u,s,e);
2354 const XMLCh KeyDescriptor::KEYTYPE_ENCRYPTION[] =       UNICODE_LITERAL_10(e,n,c,r,y,p,t,i,o,n);
2355 const XMLCh KeyDescriptor::KEYTYPE_SIGNING[] =          UNICODE_LITERAL_7(s,i,g,n,i,n,g);
2356 const XMLCh localizedNameType::LOCAL_NAME[] =           {chNull};
2357 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);
2358 const XMLCh localizedNameType::LANG_ATTRIB_NAME[] =     UNICODE_LITERAL_4(l,a,n,g);
2359 const XMLCh localizedURIType::LOCAL_NAME[] =            {chNull};
2360 const XMLCh localizedURIType::TYPE_NAME[] =             UNICODE_LITERAL_16(l,o,c,a,l,i,z,e,d,U,R,I,T,y,p,e);
2361 const XMLCh localizedURIType::LANG_ATTRIB_NAME[] =      UNICODE_LITERAL_4(l,a,n,g);
2362 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);
2363 const XMLCh NameIDFormat::LOCAL_NAME[] =                UNICODE_LITERAL_12(N,a,m,e,I,D,F,o,r,m,a,t);
2364 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);
2365 const XMLCh Organization::LOCAL_NAME[] =                UNICODE_LITERAL_12(O,r,g,a,n,i,z,a,t,i,o,n);
2366 const XMLCh Organization::TYPE_NAME[] =                 UNICODE_LITERAL_16(O,r,g,a,n,i,z,a,t,i,o,n,T,y,p,e);
2367 const XMLCh OrganizationName::LOCAL_NAME[] =            UNICODE_LITERAL_16(O,r,g,a,n,i,z,a,t,i,o,n,N,a,m,e);
2368 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);
2369 const XMLCh OrganizationURL::LOCAL_NAME[] =             UNICODE_LITERAL_15(O,r,g,a,n,i,z,a,t,i,o,n,U,R,L);
2370 const XMLCh PDPDescriptor::LOCAL_NAME[] =               UNICODE_LITERAL_13(P,D,P,D,e,s,c,r,i,p,t,o,r);
2371 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);
2372 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);
2373 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);
2374 const XMLCh RequestedAttribute::ISREQUIRED_ATTRIB_NAME[] =  UNICODE_LITERAL_10(i,s,R,e,q,u,i,r,e,d);
2375 const XMLCh RoleDescriptor::LOCAL_NAME[] =              UNICODE_LITERAL_14(R,o,l,e,D,e,s,c,r,i,p,t,o,r);
2376 const XMLCh RoleDescriptor::ID_ATTRIB_NAME[] =          UNICODE_LITERAL_2(I,D);
2377 const XMLCh RoleDescriptor::VALIDUNTIL_ATTRIB_NAME[] =  UNICODE_LITERAL_10(v,a,l,i,d,U,n,t,i,l);
2378 const XMLCh RoleDescriptor::CACHEDURATION_ATTRIB_NAME[] =   UNICODE_LITERAL_13(c,a,c,h,e,D,u,r,a,t,i,o,n);
2379 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);
2380 const XMLCh RoleDescriptor::ERRORURL_ATTRIB_NAME[] =    UNICODE_LITERAL_8(e,r,r,o,r,U,R,L);
2381 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);
2382 const XMLCh ServiceName::LOCAL_NAME[] =                 UNICODE_LITERAL_11(S,e,r,v,i,c,e,N,a,m,e);
2383 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);
2384 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);
2385 const XMLCh SPSSODescriptor::LOCAL_NAME[] =             UNICODE_LITERAL_15(S,P,S,S,O,D,e,s,c,r,i,p,t,o,r);
2386 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);
2387 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);
2388 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);
2389 const XMLCh SSODescriptorType::LOCAL_NAME[] =           {chNull};
2390 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);
2391 const XMLCh SurName::LOCAL_NAME[] =                     UNICODE_LITERAL_7(S,u,r,N,a,m,e);
2392 const XMLCh TelephoneNumber::LOCAL_NAME[] =             UNICODE_LITERAL_15(T,e,l,e,p,h,o,n,e,N,u,m,b,e,r);