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