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