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