Removed ValidatingXMLObject interface and implementations, first draft of metadata...
[shibboleth/cpp-opensaml.git] / saml / saml1 / core / impl / AssertionsImpl.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  * AssertionsImpl.cpp
19  * 
20  * Implementation classes for SAML 1.x Assertions schema
21  */
22
23 #include "internal.h"
24 #include "exceptions.h"
25 #include "saml1/core/Assertions.h"
26
27 #include <xmltooling/AbstractChildlessElement.h>
28 #include <xmltooling/AbstractComplexElement.h>
29 #include <xmltooling/AbstractElementProxy.h>
30 #include <xmltooling/AbstractSimpleElement.h>
31 #include <xmltooling/impl/AnyElement.h>
32 #include <xmltooling/io/AbstractXMLObjectMarshaller.h>
33 #include <xmltooling/io/AbstractXMLObjectUnmarshaller.h>
34 #include <xmltooling/util/XMLHelper.h>
35
36 #include <ctime>
37 #include <xercesc/util/XMLUniDefs.hpp>
38
39 using namespace opensaml::saml1;
40 using namespace opensaml;
41 using namespace xmlsignature;
42 using namespace xmltooling;
43 using namespace std;
44
45 #if defined (_MSC_VER)
46     #pragma warning( push )
47     #pragma warning( disable : 4250 4251 )
48 #endif
49
50 namespace opensaml {
51     namespace saml1 {
52     
53         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,AssertionIDReference);
54         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,Audience);
55         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,ConfirmationMethod);
56         
57         class SAML_DLLLOCAL AudienceRestrictionConditionImpl : public virtual AudienceRestrictionCondition,
58             public AbstractComplexElement,
59             public AbstractDOMCachingXMLObject,
60             public AbstractXMLObjectMarshaller,
61             public AbstractXMLObjectUnmarshaller
62         {
63         public:
64             virtual ~AudienceRestrictionConditionImpl() {}
65     
66             AudienceRestrictionConditionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
67                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
68             }
69                 
70             AudienceRestrictionConditionImpl(const AudienceRestrictionConditionImpl& src)
71                     : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) {
72                 VectorOf(Audience) v=getAudiences();
73                 for (vector<Audience*>::const_iterator i=src.m_Audiences.begin(); i!=src.m_Audiences.end(); i++) {
74                     if (*i) {
75                         v.push_back((*i)->cloneAudience());
76                     }
77                 }
78             }
79             
80             IMPL_XMLOBJECT_CLONE(AudienceRestrictionCondition);
81             Condition* cloneCondition() const {
82                 return cloneAudienceRestrictionCondition();
83             }
84             IMPL_TYPED_CHILDREN(Audience,m_children.end());
85     
86         protected:
87             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
88                 PROC_TYPED_CHILDREN(Audience,SAMLConstants::SAML1_NS,false);
89                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
90             }
91         };
92
93         class SAML_DLLLOCAL DoNotCacheConditionImpl : public virtual DoNotCacheCondition,
94             public AbstractChildlessElement,
95             public AbstractDOMCachingXMLObject,
96             public AbstractXMLObjectMarshaller,
97             public AbstractXMLObjectUnmarshaller
98         {
99         public:
100             virtual ~DoNotCacheConditionImpl() {}
101     
102             DoNotCacheConditionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
103                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
104             }
105                 
106             DoNotCacheConditionImpl(const DoNotCacheConditionImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) {
107             }
108             
109             IMPL_XMLOBJECT_CLONE(DoNotCacheCondition);
110             Condition* cloneCondition() const {
111                 return cloneDoNotCacheCondition();
112             }
113         };
114
115         class SAML_DLLLOCAL ConditionsImpl : public virtual Conditions,
116             public AbstractComplexElement,
117             public AbstractDOMCachingXMLObject,
118             public AbstractXMLObjectMarshaller,
119             public AbstractXMLObjectUnmarshaller
120         {
121         public:
122             virtual ~ConditionsImpl() {
123                 delete m_NotBefore;
124                 delete m_NotOnOrAfter;
125             }
126     
127             ConditionsImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
128                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
129                 init();
130             }
131                 
132             ConditionsImpl(const ConditionsImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) {
133                 init();
134                 setNotBefore(src.getNotBefore());
135                 setNotOnOrAfter(src.getNotOnOrAfter());
136
137                 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
138                     if (*i) {
139                         AudienceRestrictionCondition* arc=dynamic_cast<AudienceRestrictionCondition*>(*i);
140                         if (arc) {
141                             getAudienceRestrictionConditions().push_back(arc->cloneAudienceRestrictionCondition());
142                             continue;
143                         }
144     
145                         DoNotCacheCondition* dncc=dynamic_cast<DoNotCacheCondition*>(*i);
146                         if (dncc) {
147                             getDoNotCacheConditions().push_back(dncc->cloneDoNotCacheCondition());
148                             continue;
149                         }
150     
151                         Condition* c=dynamic_cast<Condition*>(*i);
152                         if (c) {
153                             getConditions().push_back(c->cloneCondition());
154                             continue;
155                         }
156                     }
157                 }
158             }
159             
160             void init() {
161                 m_NotBefore=m_NotOnOrAfter=NULL;
162             }
163             
164             IMPL_XMLOBJECT_CLONE(Conditions);
165             IMPL_DATETIME_ATTRIB(NotBefore,0);
166             IMPL_DATETIME_ATTRIB(NotOnOrAfter,LLONG_MAX);
167             IMPL_TYPED_CHILDREN(AudienceRestrictionCondition, m_children.end());
168             IMPL_TYPED_CHILDREN(DoNotCacheCondition,m_children.end());
169             IMPL_TYPED_CHILDREN(Condition,m_children.end());
170     
171         protected:
172             void marshallAttributes(DOMElement* domElement) const {
173                 MARSHALL_DATETIME_ATTRIB(NotBefore,NOTBEFORE,NULL);
174                 MARSHALL_DATETIME_ATTRIB(NotOnOrAfter,NOTONORAFTER,NULL);
175             }
176     
177             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
178                 PROC_TYPED_CHILDREN(AudienceRestrictionCondition,SAMLConstants::SAML1_NS,true);
179                 PROC_TYPED_CHILDREN(DoNotCacheCondition,SAMLConstants::SAML1_NS,true);
180                 PROC_TYPED_CHILDREN(Condition,SAMLConstants::SAML1_NS,true);
181                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
182             }
183     
184             void processAttribute(const DOMAttr* attribute) {
185                 PROC_DATETIME_ATTRIB(NotBefore,NOTBEFORE,NULL);
186                 PROC_DATETIME_ATTRIB(NotOnOrAfter,NOTONORAFTER,NULL);
187             }
188         };
189
190         class SAML_DLLLOCAL NameIdentifierImpl : public virtual NameIdentifier,
191             public AbstractSimpleElement,
192             public AbstractChildlessElement,
193             public AbstractDOMCachingXMLObject,
194             public AbstractXMLObjectMarshaller,
195             public AbstractXMLObjectUnmarshaller
196         {
197         public:
198             virtual ~NameIdentifierImpl() {
199                 XMLString::release(&m_Format);
200                 XMLString::release(&m_NameQualifier);
201             }
202     
203             NameIdentifierImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
204                     : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
205                 init();
206             }
207                 
208             NameIdentifierImpl(const NameIdentifierImpl& src)
209                     : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
210                 init();
211                 setFormat(src.getFormat());
212                 setNameQualifier(src.getNameQualifier());
213             }
214             
215             void init() {
216                 m_Format=m_NameQualifier=NULL;
217             }
218             
219             IMPL_XMLOBJECT_CLONE(NameIdentifier);
220             IMPL_STRING_ATTRIB(Format);
221             IMPL_STRING_ATTRIB(NameQualifier);
222             IMPL_XMLOBJECT_CONTENT;
223     
224         protected:
225             void marshallAttributes(DOMElement* domElement) const {
226                 MARSHALL_STRING_ATTRIB(Format,FORMAT,NULL);
227                 MARSHALL_STRING_ATTRIB(NameQualifier,NAMEQUALIFIER,NULL);
228             }
229
230             void processAttribute(const DOMAttr* attribute) {
231                 PROC_STRING_ATTRIB(Format,FORMAT,NULL);
232                 PROC_STRING_ATTRIB(NameQualifier,NAMEQUALIFIER,NULL);
233             }
234         };
235
236         class SAML_DLLLOCAL SubjectConfirmationDataImpl : public virtual SubjectConfirmationData, public AnyElementImpl
237         {
238         public:
239             virtual ~SubjectConfirmationDataImpl() {}
240     
241             SubjectConfirmationDataImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
242                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
243             }
244                 
245             SubjectConfirmationDataImpl(const SubjectConfirmationDataImpl& src)
246                 : AnyElementImpl(src) {
247             }
248             
249             IMPL_XMLOBJECT_CLONE(SubjectConfirmationData);
250         };
251
252         class SAML_DLLLOCAL SubjectConfirmationImpl : public virtual SubjectConfirmation,
253             public AbstractComplexElement,
254             public AbstractDOMCachingXMLObject,
255             public AbstractXMLObjectMarshaller,
256             public AbstractXMLObjectUnmarshaller
257         {
258         public:
259             virtual ~SubjectConfirmationImpl() {}
260     
261             SubjectConfirmationImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
262                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
263                 init();
264             }
265                 
266             SubjectConfirmationImpl(const SubjectConfirmationImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) {
267                 init();
268                 if (src.getSubjectConfirmationData())
269                     setSubjectConfirmationData(src.getSubjectConfirmationData()->clone());
270                 if (src.getKeyInfo())
271                     setKeyInfo(src.getKeyInfo()->cloneKeyInfo());
272                 VectorOf(ConfirmationMethod) v=getConfirmationMethods();
273                 for (vector<ConfirmationMethod*>::const_iterator i=src.m_ConfirmationMethods.begin(); i!=src.m_ConfirmationMethods.end(); i++) {
274                     if (*i) {
275                         v.push_back((*i)->cloneConfirmationMethod());
276                     }
277                 }
278             }
279             
280             void init() {
281                 m_SubjectConfirmationData=NULL;
282                 m_KeyInfo=NULL;
283                 m_children.push_back(NULL);
284                 m_children.push_back(NULL);
285                 m_pos_SubjectConfirmationData=m_children.begin();
286                 m_pos_KeyInfo=m_pos_SubjectConfirmationData;
287                 ++m_pos_KeyInfo;
288             }
289
290             IMPL_XMLOBJECT_CLONE(SubjectConfirmation);
291             IMPL_TYPED_CHILDREN(ConfirmationMethod,m_pos_SubjectConfirmationData);
292             IMPL_XMLOBJECT_CHILD(SubjectConfirmationData);
293             IMPL_TYPED_CHILD(KeyInfo);
294     
295         protected:
296             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
297                 PROC_TYPED_CHILDREN(ConfirmationMethod,SAMLConstants::SAML1_NS,false);
298                 PROC_TYPED_CHILD(KeyInfo,XMLConstants::XMLSIG_NS,false);
299                 
300                 // Anything else we'll assume is the data.
301                 if (getSubjectConfirmationData())
302                     throw UnmarshallingException("Invalid child element: $1",params(1,childXMLObject->getElementQName().toString().c_str()));
303                 setSubjectConfirmationData(childXMLObject);
304             }
305         };
306
307         class SAML_DLLLOCAL SubjectImpl : public virtual Subject,
308             public AbstractComplexElement,
309             public AbstractDOMCachingXMLObject,
310             public AbstractXMLObjectMarshaller,
311             public AbstractXMLObjectUnmarshaller
312         {
313         public:
314             virtual ~SubjectImpl() {}
315     
316             SubjectImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
317                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
318                 init();
319             }
320                 
321             SubjectImpl(const SubjectImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) {
322                 init();
323                 if (src.getNameIdentifier())
324                     setNameIdentifier(src.getNameIdentifier()->cloneNameIdentifier());
325                 if (src.getSubjectConfirmation())
326                     setSubjectConfirmation(src.getSubjectConfirmation()->cloneSubjectConfirmation());
327             }
328             
329             void init() {
330                 m_NameIdentifier=NULL;
331                 m_SubjectConfirmation=NULL;
332                 m_children.push_back(NULL);
333                 m_children.push_back(NULL);
334                 m_pos_NameIdentifier=m_children.begin();
335                 m_pos_SubjectConfirmation=m_pos_NameIdentifier;
336                 ++m_pos_SubjectConfirmation;
337             }
338
339             IMPL_XMLOBJECT_CLONE(Subject);
340             IMPL_TYPED_CHILD(NameIdentifier);
341             IMPL_TYPED_CHILD(SubjectConfirmation);
342     
343         protected:
344             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
345                 PROC_TYPED_CHILD(NameIdentifier,SAMLConstants::SAML1_NS,true);
346                 PROC_TYPED_CHILD(SubjectConfirmation,SAMLConstants::SAML1_NS,true);
347                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
348             }
349         };
350
351         class SAML_DLLLOCAL SubjectStatementImpl : public virtual SubjectStatement,
352             public AbstractComplexElement,
353             public AbstractDOMCachingXMLObject,
354             public AbstractXMLObjectMarshaller,
355             public AbstractXMLObjectUnmarshaller
356         {
357             void init() {
358                 m_Subject=NULL;
359                 m_children.push_back(NULL);
360                 m_pos_Subject=m_children.begin();
361             }
362         protected:
363             SubjectStatementImpl() {
364                 init();
365             }
366         public:
367             virtual ~SubjectStatementImpl() {}
368     
369             SubjectStatementImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
370                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
371                 init();
372             }
373                 
374             SubjectStatementImpl(const SubjectStatementImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) {
375                 init();
376                 if (src.getSubject())
377                     setSubject(src.getSubject()->cloneSubject());
378             }
379             
380             IMPL_TYPED_CHILD(Subject);
381     
382         protected:
383             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
384                 PROC_TYPED_CHILD(Subject,SAMLConstants::SAML1_NS,true);
385                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
386             }
387         };
388
389         class SAML_DLLLOCAL SubjectLocalityImpl : public virtual SubjectLocality,
390             public AbstractChildlessElement,
391             public AbstractDOMCachingXMLObject,
392             public AbstractXMLObjectMarshaller,
393             public AbstractXMLObjectUnmarshaller
394         {
395         public:
396             virtual ~SubjectLocalityImpl() {
397                 XMLString::release(&m_IPAddress);
398                 XMLString::release(&m_DNSAddress);
399             }
400     
401             SubjectLocalityImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
402                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
403                 init();
404             }
405                 
406             SubjectLocalityImpl(const SubjectLocalityImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) {
407                 init();
408                 setIPAddress(src.getIPAddress());
409                 setDNSAddress(src.getDNSAddress());
410             }
411             
412             void init() {
413                 m_IPAddress=m_DNSAddress=NULL;
414             }
415             
416             IMPL_XMLOBJECT_CLONE(SubjectLocality);
417             IMPL_STRING_ATTRIB(IPAddress);
418             IMPL_STRING_ATTRIB(DNSAddress);
419     
420         protected:
421             void marshallAttributes(DOMElement* domElement) const {
422                 MARSHALL_STRING_ATTRIB(IPAddress,IPADDRESS,NULL);
423                 MARSHALL_STRING_ATTRIB(DNSAddress,DNSADDRESS,NULL);
424             }
425     
426             void processAttribute(const DOMAttr* attribute) {
427                 PROC_STRING_ATTRIB(IPAddress,IPADDRESS,NULL);
428                 PROC_STRING_ATTRIB(DNSAddress,DNSADDRESS,NULL);
429             }
430         };
431
432         class SAML_DLLLOCAL AuthorityBindingImpl : public virtual AuthorityBinding,
433             public AbstractChildlessElement,
434             public AbstractDOMCachingXMLObject,
435             public AbstractXMLObjectMarshaller,
436             public AbstractXMLObjectUnmarshaller
437         {
438         public:
439             virtual ~AuthorityBindingImpl() {
440                 delete m_AuthorityKind;
441                 XMLString::release(&m_Location);
442                 XMLString::release(&m_Binding);
443             }
444     
445             AuthorityBindingImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
446                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
447                 init();
448             }
449                 
450             AuthorityBindingImpl(const AuthorityBindingImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) {
451                 init();
452                 setAuthorityKind(src.getAuthorityKind());
453                 setLocation(src.getLocation());
454                 setBinding(src.getBinding());
455             }
456             
457             void init() {
458                 m_AuthorityKind=NULL;
459                 m_Location=m_Binding=NULL;
460             }
461             
462             IMPL_XMLOBJECT_CLONE(AuthorityBinding);
463             IMPL_XMLOBJECT_ATTRIB(AuthorityKind,QName);
464             IMPL_STRING_ATTRIB(Location);
465             IMPL_STRING_ATTRIB(Binding);
466     
467         protected:
468             void marshallAttributes(DOMElement* domElement) const {
469                 MARSHALL_QNAME_ATTRIB(AuthorityKind,AUTHORITYKIND,NULL);
470                 MARSHALL_STRING_ATTRIB(Location,LOCATION,NULL);
471                 MARSHALL_STRING_ATTRIB(Binding,BINDING,NULL);
472             }
473     
474             void processAttribute(const DOMAttr* attribute) {
475                 PROC_QNAME_ATTRIB(AuthorityKind,AUTHORITYKIND,NULL);
476                 PROC_STRING_ATTRIB(Location,LOCATION,NULL);
477                 PROC_STRING_ATTRIB(Binding,BINDING,NULL);
478             }
479         };
480
481         class SAML_DLLLOCAL AuthenticationStatementImpl : public virtual AuthenticationStatement, public SubjectStatementImpl
482         {
483         public:
484             virtual ~AuthenticationStatementImpl() {
485                 XMLString::release(&m_AuthenticationMethod);
486                 delete m_AuthenticationInstant;
487             }
488     
489             AuthenticationStatementImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
490                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
491                 init();
492             }
493                 
494             AuthenticationStatementImpl(const AuthenticationStatementImpl& src) : AbstractXMLObject(src), SubjectStatementImpl(src) {
495                 init();
496                 setAuthenticationMethod(src.getAuthenticationMethod());
497                 setAuthenticationInstant(src.getAuthenticationInstant());
498                 if (src.getSubjectLocality())
499                     setSubjectLocality(src.getSubjectLocality()->cloneSubjectLocality());
500                 VectorOf(AuthorityBinding) v=getAuthorityBindings();
501                 for (vector<AuthorityBinding*>::const_iterator i=src.m_AuthorityBindings.begin(); i!=src.m_AuthorityBindings.end(); i++) {
502                     if (*i) {
503                         v.push_back((*i)->cloneAuthorityBinding());
504                     }
505                 }
506             }
507             
508             void init() {
509                 m_AuthenticationMethod=NULL;
510                 m_AuthenticationInstant=NULL;
511                 m_SubjectLocality=NULL;
512                 m_children.push_back(NULL);
513                 m_pos_SubjectLocality=m_pos_Subject;
514                 ++m_pos_SubjectLocality;
515             }
516             
517             IMPL_XMLOBJECT_CLONE(AuthenticationStatement);
518             SubjectStatement* cloneSubjectStatement() const {
519                 return cloneAuthenticationStatement();
520             }
521             Statement* cloneStatement() const {
522                 return cloneAuthenticationStatement();
523             }
524             IMPL_STRING_ATTRIB(AuthenticationMethod);
525             IMPL_DATETIME_ATTRIB(AuthenticationInstant,0);
526             IMPL_TYPED_CHILD(SubjectLocality);
527             IMPL_TYPED_CHILDREN(AuthorityBinding, m_children.end());
528     
529         protected:
530             void marshallAttributes(DOMElement* domElement) const {
531                 MARSHALL_STRING_ATTRIB(AuthenticationMethod,AUTHENTICATIONMETHOD,NULL);
532                 MARSHALL_DATETIME_ATTRIB(AuthenticationInstant,AUTHENTICATIONINSTANT,NULL);
533                 SubjectStatementImpl::marshallAttributes(domElement);
534             }
535     
536             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
537                 PROC_TYPED_CHILD(SubjectLocality,SAMLConstants::SAML1_NS,false);
538                 PROC_TYPED_CHILDREN(AuthorityBinding,SAMLConstants::SAML1_NS,false);
539                 SubjectStatementImpl::processChildElement(childXMLObject,root);
540             }
541     
542             void processAttribute(const DOMAttr* attribute) {
543                 PROC_STRING_ATTRIB(AuthenticationMethod,AUTHENTICATIONMETHOD,NULL);
544                 PROC_DATETIME_ATTRIB(AuthenticationInstant,AUTHENTICATIONINSTANT,NULL);
545                 SubjectStatementImpl::processAttribute(attribute);
546             }
547         };
548
549         class SAML_DLLLOCAL ActionImpl : public virtual Action,
550             public AbstractSimpleElement,
551             public AbstractChildlessElement,
552             public AbstractDOMCachingXMLObject,
553             public AbstractXMLObjectMarshaller,
554             public AbstractXMLObjectUnmarshaller
555         {
556         public:
557             virtual ~ActionImpl() {
558                 XMLString::release(&m_Namespace);
559             }
560     
561             ActionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
562                     : AbstractXMLObject(nsURI, localName, prefix, schemaType), m_Namespace(NULL) {
563             }
564                 
565             ActionImpl(const ActionImpl& src) : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
566                 setNamespace(src.getNamespace());
567             }
568             
569             IMPL_XMLOBJECT_CLONE(Action);
570             IMPL_STRING_ATTRIB(Namespace);
571             IMPL_XMLOBJECT_CONTENT;
572     
573         protected:
574             void marshallAttributes(DOMElement* domElement) const {
575                 MARSHALL_STRING_ATTRIB(Namespace,NAMESPACE,NULL);
576             }
577
578             void processAttribute(const DOMAttr* attribute) {
579                 PROC_STRING_ATTRIB(Namespace,NAMESPACE,NULL);
580             }
581         };
582
583         class SAML_DLLLOCAL EvidenceImpl : public virtual Evidence,
584             public AbstractComplexElement,
585             public AbstractDOMCachingXMLObject,
586             public AbstractXMLObjectMarshaller,
587             public AbstractXMLObjectUnmarshaller
588         {
589         public:
590             virtual ~EvidenceImpl() {}
591     
592             EvidenceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
593                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
594             }
595                 
596             EvidenceImpl(const EvidenceImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) {
597     
598                 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
599                     if (*i) {
600                         AssertionIDReference* ref=dynamic_cast<AssertionIDReference*>(*i);
601                         if (ref) {
602                             getAssertionIDReferences().push_back(ref->cloneAssertionIDReference());
603                             continue;
604                         }
605     
606                         Assertion* assertion=dynamic_cast<Assertion*>(*i);
607                         if (assertion) {
608                             getAssertions().push_back(assertion->cloneAssertion());
609                             continue;
610                         }
611                     }
612                 }
613             }
614             
615             IMPL_XMLOBJECT_CLONE(Evidence);
616             IMPL_TYPED_CHILDREN(AssertionIDReference,m_children.end());
617             IMPL_TYPED_CHILDREN(Assertion,m_children.end());
618     
619         protected:
620             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
621                 PROC_TYPED_CHILDREN(AssertionIDReference,SAMLConstants::SAML1_NS,false);
622                 PROC_TYPED_CHILDREN(Assertion,SAMLConstants::SAML1_NS,true);
623                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
624             }
625         };
626
627         class SAML_DLLLOCAL AuthorizationDecisionStatementImpl
628             : public virtual AuthorizationDecisionStatement, public SubjectStatementImpl
629         {
630         public:
631             virtual ~AuthorizationDecisionStatementImpl() {
632                 XMLString::release(&m_Resource);
633                 XMLString::release(&m_Decision);
634             }
635     
636             AuthorizationDecisionStatementImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
637                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
638                 init();
639             }
640                 
641             AuthorizationDecisionStatementImpl(const AuthorizationDecisionStatementImpl& src)
642                     : AbstractXMLObject(src), SubjectStatementImpl(src) {
643                 init();
644                 setResource(src.getResource());
645                 setDecision(src.getDecision());
646                 if (src.getEvidence())
647                     setEvidence(src.getEvidence()->cloneEvidence());
648                 VectorOf(Action) v=getActions();
649                 for (vector<Action*>::const_iterator i=src.m_Actions.begin(); i!=src.m_Actions.end(); i++) {
650                     if (*i) {
651                         v.push_back((*i)->cloneAction());
652                     }
653                 }
654             }
655             
656             void init() {
657                 m_Resource=NULL;
658                 m_Decision=NULL;
659                 m_Evidence=NULL;
660                 m_children.push_back(NULL);
661                 m_pos_Evidence=m_pos_Subject;
662                 ++m_pos_Evidence;
663             }
664             
665             IMPL_XMLOBJECT_CLONE(AuthorizationDecisionStatement);
666             SubjectStatement* cloneSubjectStatement() const {
667                 return cloneAuthorizationDecisionStatement();
668             }
669             Statement* cloneStatement() const {
670                 return cloneAuthorizationDecisionStatement();
671             }
672             IMPL_STRING_ATTRIB(Resource);
673             IMPL_STRING_ATTRIB(Decision);
674             IMPL_TYPED_CHILD(Evidence);
675             IMPL_TYPED_CHILDREN(Action, m_pos_Evidence);
676     
677         protected:
678             void marshallAttributes(DOMElement* domElement) const {
679                 MARSHALL_STRING_ATTRIB(Resource,RESOURCE,NULL);
680                 MARSHALL_STRING_ATTRIB(Decision,DECISION,NULL);
681                 SubjectStatementImpl::marshallAttributes(domElement);
682             }
683     
684             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
685                 PROC_TYPED_CHILD(Evidence,SAMLConstants::SAML1_NS,false);
686                 PROC_TYPED_CHILDREN(Action,SAMLConstants::SAML1_NS,false);
687                 SubjectStatementImpl::processChildElement(childXMLObject,root);
688             }
689     
690             void processAttribute(const DOMAttr* attribute) {
691                 PROC_STRING_ATTRIB(Resource,RESOURCE,NULL);
692                 PROC_STRING_ATTRIB(Decision,DECISION,NULL);
693                 SubjectStatementImpl::processAttribute(attribute);
694             }
695         };
696
697         class SAML_DLLLOCAL AttributeDesignatorImpl : public virtual AttributeDesignator,
698             public AbstractChildlessElement,
699             public AbstractDOMCachingXMLObject,
700             public AbstractXMLObjectMarshaller,
701             public AbstractXMLObjectUnmarshaller
702         {
703         public:
704             virtual ~AttributeDesignatorImpl() {
705                 XMLString::release(&m_AttributeName);
706                 XMLString::release(&m_AttributeNamespace);
707             }
708     
709             AttributeDesignatorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
710                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
711                 init();
712             }
713                 
714             AttributeDesignatorImpl(const AttributeDesignatorImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) {
715                 init();
716                 setAttributeName(src.getAttributeName());
717                 setAttributeNamespace(src.getAttributeNamespace());
718             }
719             
720             void init() {
721                 m_AttributeName=m_AttributeNamespace=NULL;
722             }
723             
724             IMPL_XMLOBJECT_CLONE(AttributeDesignator);
725             IMPL_STRING_ATTRIB(AttributeName);
726             IMPL_STRING_ATTRIB(AttributeNamespace);
727     
728         protected:
729             void marshallAttributes(DOMElement* domElement) const {
730                 MARSHALL_STRING_ATTRIB(AttributeName,ATTRIBUTENAME,NULL);
731                 MARSHALL_STRING_ATTRIB(AttributeNamespace,ATTRIBUTENAMESPACE,NULL);
732             }
733     
734             void processAttribute(const DOMAttr* attribute) {
735                 PROC_STRING_ATTRIB(AttributeName,ATTRIBUTENAME,NULL);
736                 PROC_STRING_ATTRIB(AttributeNamespace,ATTRIBUTENAMESPACE,NULL);
737             }
738         };
739
740         class SAML_DLLLOCAL AttributeImpl : public virtual Attribute,
741             public AbstractComplexElement,
742             public AbstractDOMCachingXMLObject,
743             public AbstractXMLObjectMarshaller,
744             public AbstractXMLObjectUnmarshaller
745         {
746         public:
747             virtual ~AttributeImpl() {
748                 XMLString::release(&m_AttributeName);
749                 XMLString::release(&m_AttributeNamespace);
750             }
751     
752             AttributeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
753                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
754                 init();
755             }
756                 
757             AttributeImpl(const AttributeImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) {
758                 init();
759                 setAttributeName(src.getAttributeName());
760                 setAttributeNamespace(src.getAttributeNamespace());
761                 VectorOf(XMLObject) v=getAttributeValues();
762                 for (vector<XMLObject*>::const_iterator i=src.m_AttributeValues.begin(); i!=src.m_AttributeValues.end(); i++) {
763                     if (*i) {
764                         v.push_back((*i)->clone());
765                     }
766                 }
767             }
768             
769             void init() {
770                 m_AttributeName=m_AttributeNamespace=NULL;
771             }
772             
773             IMPL_XMLOBJECT_CLONE(Attribute);
774             AttributeDesignator* cloneAttributeDesignator() const {
775                 return cloneAttribute();
776             }
777             IMPL_STRING_ATTRIB(AttributeName);
778             IMPL_STRING_ATTRIB(AttributeNamespace);
779             IMPL_XMLOBJECT_CHILDREN(AttributeValue,m_children.end());
780     
781         protected:
782             void marshallAttributes(DOMElement* domElement) const {
783                 MARSHALL_STRING_ATTRIB(AttributeName,ATTRIBUTENAME,NULL);
784                 MARSHALL_STRING_ATTRIB(AttributeNamespace,ATTRIBUTENAMESPACE,NULL);
785             }
786
787             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
788                 getAttributeValues().push_back(childXMLObject);
789             }
790
791             void processAttribute(const DOMAttr* attribute) {
792                 PROC_STRING_ATTRIB(AttributeName,ATTRIBUTENAME,NULL);
793                 PROC_STRING_ATTRIB(AttributeNamespace,ATTRIBUTENAMESPACE,NULL);
794             }
795         };
796
797         class SAML_DLLLOCAL AttributeValueImpl : public virtual AttributeValue, public AnyElementImpl
798         {
799         public:
800             virtual ~AttributeValueImpl() {}
801     
802             AttributeValueImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
803                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
804             }
805                 
806             AttributeValueImpl(const AttributeValueImpl& src) : AnyElementImpl(src) {}
807             
808             IMPL_XMLOBJECT_CLONE(AttributeValue);
809         };
810
811         class SAML_DLLLOCAL AttributeStatementImpl : public virtual AttributeStatement, public SubjectStatementImpl
812         {
813         public:
814             virtual ~AttributeStatementImpl() {}
815     
816             AttributeStatementImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
817                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
818             }
819                 
820             AttributeStatementImpl(const AttributeStatementImpl& src)
821                     : AbstractXMLObject(src), SubjectStatementImpl(src) {
822                 VectorOf(Attribute) v=getAttributes();
823                 for (vector<Attribute*>::const_iterator i=src.m_Attributes.begin(); i!=src.m_Attributes.end(); i++) {
824                     if (*i) {
825                         v.push_back((*i)->cloneAttribute());
826                     }
827                 }
828             }
829             
830             IMPL_XMLOBJECT_CLONE(AttributeStatement);
831             SubjectStatement* cloneSubjectStatement() const {
832                 return cloneAttributeStatement();
833             }
834             Statement* cloneStatement() const {
835                 return cloneAttributeStatement();
836             }
837             IMPL_TYPED_CHILDREN(Attribute, m_children.end());
838     
839         protected:
840             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
841                 PROC_TYPED_CHILDREN(Attribute,SAMLConstants::SAML1_NS,true);
842                 SubjectStatementImpl::processChildElement(childXMLObject,root);
843             }
844         };
845
846         class SAML_DLLLOCAL AdviceImpl : public virtual Advice,
847             public AbstractComplexElement,
848             public AbstractDOMCachingXMLObject,
849             public AbstractXMLObjectMarshaller,
850             public AbstractXMLObjectUnmarshaller
851         {
852         public:
853             virtual ~AdviceImpl() {}
854     
855             AdviceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
856                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
857             }
858                 
859             AdviceImpl(const AdviceImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) {
860     
861                 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
862                     if (*i) {
863                         AssertionIDReference* ref=dynamic_cast<AssertionIDReference*>(*i);
864                         if (ref) {
865                             getAssertionIDReferences().push_back(ref->cloneAssertionIDReference());
866                             continue;
867                         }
868     
869                         Assertion* assertion=dynamic_cast<Assertion*>(*i);
870                         if (assertion) {
871                             getAssertions().push_back(assertion->cloneAssertion());
872                             continue;
873                         }
874     
875                         getOthers().push_back((*i)->clone());
876                     }
877                 }
878             }
879             
880             IMPL_XMLOBJECT_CLONE(Advice);
881             IMPL_TYPED_CHILDREN(AssertionIDReference,m_children.end());
882             IMPL_TYPED_CHILDREN(Assertion,m_children.end());
883             IMPL_XMLOBJECT_CHILDREN(Other,m_children.end());
884     
885         protected:
886             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
887                 PROC_TYPED_CHILDREN(AssertionIDReference,SAMLConstants::SAML1_NS,false);
888                 PROC_TYPED_CHILDREN(Assertion,SAMLConstants::SAML1_NS,true);
889                 
890                 // Unknown child.
891                 const XMLCh* nsURI=root->getNamespaceURI();
892                 if (!XMLString::equals(nsURI,SAMLConstants::SAML1_NS) && nsURI && *nsURI) {
893                     getOthers().push_back(childXMLObject);
894                     return;
895                 }
896                 
897                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
898             }
899         };
900
901         class SAML_DLLLOCAL AssertionImpl : public virtual Assertion,
902             public AbstractComplexElement,
903             public AbstractDOMCachingXMLObject,
904             public AbstractXMLObjectMarshaller,
905             public AbstractXMLObjectUnmarshaller
906         {
907             void init() {
908                 m_MinorVersion=NULL;
909                 m_AssertionID=NULL;
910                 m_Issuer=NULL;
911                 m_IssueInstant=NULL;
912                 m_children.push_back(NULL);
913                 m_children.push_back(NULL);
914                 m_children.push_back(NULL);
915                 m_Conditions=NULL;
916                 m_Advice=NULL;
917                 m_Signature=NULL;
918                 m_pos_Conditions=m_children.begin();
919                 m_pos_Advice=m_pos_Conditions;
920                 ++m_pos_Advice;
921                 m_pos_Signature=m_pos_Advice;
922                 ++m_pos_Signature;
923             }
924         public:
925             virtual ~AssertionImpl() {
926                 XMLString::release(&m_MinorVersion);
927                 XMLString::release(&m_AssertionID);
928                 XMLString::release(&m_Issuer);
929                 delete m_IssueInstant;
930             }
931     
932             AssertionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
933                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
934                 init();
935             }
936                 
937             AssertionImpl(const AssertionImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) {
938                 init();
939                 setMinorVersion(src.m_MinorVersion);
940                 setAssertionID(src.getAssertionID());
941                 setIssuer(src.getIssuer());
942                 setIssueInstant(src.getIssueInstant());
943                 if (src.getConditions())
944                     setConditions(src.getConditions()->cloneConditions());
945                 if (src.getAdvice())
946                     setAdvice(src.getAdvice()->cloneAdvice());
947                 if (src.getSignature())
948                     setSignature(src.getSignature()->cloneSignature());
949                 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
950                     if (*i) {
951                         AuthenticationStatement* authst=dynamic_cast<AuthenticationStatement*>(*i);
952                         if (authst) {
953                             getAuthenticationStatements().push_back(authst->cloneAuthenticationStatement());
954                             continue;
955                         }
956
957                         AttributeStatement* attst=dynamic_cast<AttributeStatement*>(*i);
958                         if (attst) {
959                             getAttributeStatements().push_back(attst->cloneAttributeStatement());
960                             continue;
961                         }
962
963                         AuthorizationDecisionStatement* authzst=dynamic_cast<AuthorizationDecisionStatement*>(*i);
964                         if (authzst) {
965                             getAuthorizationDecisionStatements().push_back(authzst->cloneAuthorizationDecisionStatement());
966                             continue;
967                         }
968     
969                         SubjectStatement* subst=dynamic_cast<SubjectStatement*>(*i);
970                         if (subst) {
971                             getSubjectStatements().push_back(subst->cloneSubjectStatement());
972                             continue;
973                         }
974     
975                         Statement* st=dynamic_cast<Statement*>(*i);
976                         if (st) {
977                             getStatements().push_back(st->cloneStatement());
978                             continue;
979                         }
980                     }
981                 }
982             }
983             
984             const XMLCh* getId() const {
985                 return getAssertionID();
986             }
987
988             //IMPL_TYPED_CHILD(Signature);
989             // Need customized setter.
990         protected:
991             Signature* m_Signature;
992             list<XMLObject*>::iterator m_pos_Signature;
993         public:
994             Signature* getSignature() const {
995                 return m_Signature;
996             }
997             
998             void setSignature(Signature* sig) {
999                 prepareForAssignment(m_Signature,sig);
1000                 *m_pos_Signature=m_Signature=sig;
1001                 // Sync content reference back up.
1002                 if (m_Signature)
1003                     m_Signature->setContentReference(new opensaml::ContentReference(*this));
1004             }
1005             
1006             IMPL_XMLOBJECT_CLONE(Assertion);
1007             IMPL_INTEGER_ATTRIB(MinorVersion);
1008             IMPL_STRING_ATTRIB(AssertionID);
1009             IMPL_STRING_ATTRIB(Issuer);
1010             IMPL_DATETIME_ATTRIB(IssueInstant,0);
1011             IMPL_TYPED_CHILD(Conditions);
1012             IMPL_TYPED_CHILD(Advice);
1013             IMPL_TYPED_CHILDREN(Statement, m_pos_Signature);
1014             IMPL_TYPED_CHILDREN(SubjectStatement, m_pos_Signature);
1015             IMPL_TYPED_CHILDREN(AuthenticationStatement, m_pos_Signature);
1016             IMPL_TYPED_CHILDREN(AttributeStatement, m_pos_Signature);
1017             IMPL_TYPED_CHILDREN(AuthorizationDecisionStatement, m_pos_Signature);
1018     
1019         protected:
1020             void marshallAttributes(DOMElement* domElement) const {
1021                 static const XMLCh MAJORVERSION[] = UNICODE_LITERAL_12(M,a,j,o,r,V,e,r,s,i,o,n);
1022                 domElement->setAttributeNS(NULL,MAJORVERSION,XMLConstants::XML_ONE);
1023                 if (!m_MinorVersion)
1024                     const_cast<AssertionImpl*>(this)->m_MinorVersion=XMLString::replicate(XMLConstants::XML_ONE);
1025                 MARSHALL_INTEGER_ATTRIB(MinorVersion,MINORVERSION,NULL);
1026                 if (!m_AssertionID)
1027                     const_cast<AssertionImpl*>(this)->m_AssertionID=SAMLConfig::getConfig().generateIdentifier();
1028                 MARSHALL_ID_ATTRIB(AssertionID,ASSERTIONID,NULL);
1029                 MARSHALL_STRING_ATTRIB(Issuer,ISSUER,NULL);
1030                 if (!m_IssueInstant) {
1031                     const_cast<AssertionImpl*>(this)->m_IssueInstantEpoch=time(NULL);
1032                     const_cast<AssertionImpl*>(this)->m_IssueInstant=new DateTime(m_IssueInstantEpoch);
1033                 }
1034                 MARSHALL_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,NULL);
1035             }
1036     
1037             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1038                 PROC_TYPED_CHILD(Conditions,SAMLConstants::SAML1_NS,false);
1039                 PROC_TYPED_CHILD(Advice,SAMLConstants::SAML1_NS,false);
1040                 PROC_TYPED_CHILD(Signature,XMLConstants::XMLSIG_NS,false);
1041                 PROC_TYPED_CHILDREN(AuthenticationStatement,SAMLConstants::SAML1_NS,false);
1042                 PROC_TYPED_CHILDREN(AttributeStatement,SAMLConstants::SAML1_NS,false);
1043                 PROC_TYPED_CHILDREN(AuthorizationDecisionStatement,SAMLConstants::SAML1_NS,false);
1044                 PROC_TYPED_CHILDREN(SubjectStatement,SAMLConstants::SAML1_NS,true);
1045                 PROC_TYPED_CHILDREN(Statement,SAMLConstants::SAML1_NS,true);
1046                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
1047             }
1048     
1049             void processAttribute(const DOMAttr* attribute) {
1050                 static const XMLCh MAJORVERSION[] = UNICODE_LITERAL_12(M,a,j,o,r,V,e,r,s,i,o,n);
1051                 if (XMLHelper::isNodeNamed(attribute,NULL,MAJORVERSION)) {
1052                     if (!XMLString::equals(attribute->getValue(),XMLConstants::XML_ONE))
1053                         throw UnmarshallingException("Assertion has invalid major version.");
1054                 }
1055                 PROC_INTEGER_ATTRIB(MinorVersion,MINORVERSION,NULL);
1056                 PROC_ID_ATTRIB(AssertionID,ASSERTIONID,NULL);
1057                 PROC_STRING_ATTRIB(Issuer,ISSUER,NULL);
1058                 PROC_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,NULL);
1059             }
1060         };
1061     
1062     };
1063 };
1064
1065 #if defined (_MSC_VER)
1066     #pragma warning( pop )
1067 #endif
1068
1069 // Builder Implementations
1070
1071 IMPL_XMLOBJECTBUILDER(Action);
1072 IMPL_XMLOBJECTBUILDER(Advice);
1073 IMPL_XMLOBJECTBUILDER(Assertion);
1074 IMPL_XMLOBJECTBUILDER(AssertionIDReference);
1075 IMPL_XMLOBJECTBUILDER(Attribute);
1076 IMPL_XMLOBJECTBUILDER(AttributeDesignator);
1077 IMPL_XMLOBJECTBUILDER(AttributeStatement);
1078 IMPL_XMLOBJECTBUILDER(AttributeValue);
1079 IMPL_XMLOBJECTBUILDER(Audience);
1080 IMPL_XMLOBJECTBUILDER(AudienceRestrictionCondition);
1081 IMPL_XMLOBJECTBUILDER(AuthenticationStatement);
1082 IMPL_XMLOBJECTBUILDER(AuthorizationDecisionStatement);
1083 IMPL_XMLOBJECTBUILDER(AuthorityBinding);
1084 IMPL_XMLOBJECTBUILDER(Conditions);
1085 IMPL_XMLOBJECTBUILDER(ConfirmationMethod);
1086 IMPL_XMLOBJECTBUILDER(DoNotCacheCondition);
1087 IMPL_XMLOBJECTBUILDER(Evidence);
1088 IMPL_XMLOBJECTBUILDER(NameIdentifier);
1089 IMPL_XMLOBJECTBUILDER(Subject);
1090 IMPL_XMLOBJECTBUILDER(SubjectConfirmation);
1091 IMPL_XMLOBJECTBUILDER(SubjectConfirmationData);
1092 IMPL_XMLOBJECTBUILDER(SubjectLocality);
1093
1094 // Unicode literals
1095 const XMLCh Action::LOCAL_NAME[] =                  UNICODE_LITERAL_6(A,c,t,i,o,n);
1096 const XMLCh Action::TYPE_NAME[] =                   UNICODE_LITERAL_10(A,c,t,i,o,n,T,y,p,e);
1097 const XMLCh Action::NAMESPACE_ATTRIB_NAME[] =       UNICODE_LITERAL_9(N,a,m,e,s,p,a,c,e);
1098 const XMLCh Advice::LOCAL_NAME[] =                  UNICODE_LITERAL_6(A,d,v,i,c,e);
1099 const XMLCh Advice::TYPE_NAME[] =                   UNICODE_LITERAL_10(A,d,v,i,c,e,T,y,p,e);
1100 const XMLCh Assertion::LOCAL_NAME[] =               UNICODE_LITERAL_9(A,s,s,e,r,t,i,o,n);
1101 const XMLCh Assertion::TYPE_NAME[] =                UNICODE_LITERAL_13(A,s,s,e,r,t,i,o,n,T,y,p,e);
1102 const XMLCh Assertion::MINORVERSION_ATTRIB_NAME[] = UNICODE_LITERAL_12(M,i,n,o,r,V,e,r,s,i,o,n);
1103 const XMLCh Assertion::ASSERTIONID_ATTRIB_NAME[] =  UNICODE_LITERAL_11(A,s,s,e,r,t,i,o,n,I,D);
1104 const XMLCh Assertion::ISSUER_ATTRIB_NAME[] =       UNICODE_LITERAL_6(I,s,s,u,e,r);
1105 const XMLCh Assertion::ISSUEINSTANT_ATTRIB_NAME[] = UNICODE_LITERAL_12(I,s,s,u,e,I,n,s,t,a,n,t);
1106 const XMLCh AssertionIDReference::LOCAL_NAME[] =    UNICODE_LITERAL_20(A,s,s,e,r,t,i,o,n,I,D,R,e,f,e,r,e,n,c,e);
1107 const XMLCh Attribute::LOCAL_NAME[] =               UNICODE_LITERAL_9(A,t,t,r,i,b,u,t,e);
1108 const XMLCh Attribute::TYPE_NAME[] =                UNICODE_LITERAL_13(A,t,t,r,i,b,u,t,e,T,y,p,e);
1109 const XMLCh AttributeDesignator::LOCAL_NAME[] =     UNICODE_LITERAL_19(A,t,t,r,i,b,u,t,e,D,e,s,i,g,n,a,t,o,r);
1110 const XMLCh AttributeDesignator::TYPE_NAME[] =      UNICODE_LITERAL_23(A,t,t,r,i,b,u,t,e,D,e,s,i,g,n,a,t,o,r,T,y,p,e);
1111 const XMLCh AttributeDesignator::ATTRIBUTENAME_ATTRIB_NAME[] =              UNICODE_LITERAL_13(A,t,t,r,i,b,u,t,e,N,a,m,e);
1112 const XMLCh AttributeDesignator::ATTRIBUTENAMESPACE_ATTRIB_NAME[] =         UNICODE_LITERAL_18(A,t,t,r,i,b,u,t,e,N,a,m,e,s,p,a,c,e);
1113 const XMLCh AttributeStatement::LOCAL_NAME[] =      UNICODE_LITERAL_18(A,t,t,r,i,b,u,t,e,S,t,a,t,e,m,e,n,t);
1114 const XMLCh AttributeStatement::TYPE_NAME[] =       UNICODE_LITERAL_22(A,t,t,r,i,b,u,t,e,S,t,a,t,e,m,e,n,t,T,y,p,e);
1115 const XMLCh AttributeValue::LOCAL_NAME[] =          UNICODE_LITERAL_14(A,t,t,r,i,b,u,t,e,V,a,l,u,e);
1116 const XMLCh Audience::LOCAL_NAME[] =                UNICODE_LITERAL_8(A,u,d,i,e,n,c,e);
1117 const XMLCh AudienceRestrictionCondition::LOCAL_NAME[] =    UNICODE_LITERAL_28(A,u,d,i,e,n,c,e,R,e,s,t,r,i,c,t,i,o,n,C,o,n,d,i,t,i,o,n);
1118 const XMLCh AudienceRestrictionCondition::TYPE_NAME[] =     UNICODE_LITERAL_32(A,u,d,i,e,n,c,e,R,e,s,t,r,i,c,t,i,o,n,C,o,n,d,i,t,i,o,n,T,y,p,e);
1119 const XMLCh AuthenticationStatement::LOCAL_NAME[] = UNICODE_LITERAL_23(A,u,t,h,e,n,t,i,c,a,t,i,o,n,S,t,a,t,e,m,e,n,t);
1120 const XMLCh AuthenticationStatement::TYPE_NAME[] =  UNICODE_LITERAL_27(A,u,t,h,e,n,t,i,c,a,t,i,o,n,S,t,a,t,e,m,e,n,t,T,y,p,e);
1121 const XMLCh AuthenticationStatement::AUTHENTICATIONMETHOD_ATTRIB_NAME[] =   UNICODE_LITERAL_20(A,u,t,h,e,n,t,i,c,a,t,i,o,n,M,e,t,h,o,d);
1122 const XMLCh AuthenticationStatement::AUTHENTICATIONINSTANT_ATTRIB_NAME[] =  UNICODE_LITERAL_21(A,u,t,h,e,n,t,i,c,a,t,i,o,n,I,n,s,t,a,n,t);
1123 const XMLCh AuthorityBinding::LOCAL_NAME[] =        UNICODE_LITERAL_16(A,u,t,h,o,r,i,t,y,B,i,n,d,i,n,g);
1124 const XMLCh AuthorityBinding::TYPE_NAME[] =         UNICODE_LITERAL_20(A,u,t,h,o,r,i,t,y,B,i,n,d,i,n,g,T,y,p,e);
1125 const XMLCh AuthorityBinding::AUTHORITYKIND_ATTRIB_NAME[] = UNICODE_LITERAL_13(A,u,t,h,o,r,i,t,y,K,i,n,d);
1126 const XMLCh AuthorityBinding::LOCATION_ATTRIB_NAME[] =      UNICODE_LITERAL_8(L,o,c,a,t,i,o,n);
1127 const XMLCh AuthorityBinding::BINDING_ATTRIB_NAME[] =       UNICODE_LITERAL_7(B,i,n,d,i,n,g);
1128 const XMLCh AuthorizationDecisionStatement::LOCAL_NAME[] =  UNICODE_LITERAL_30(A,u,t,h,o,r,i,z,a,t,i,o,n,D,e,c,i,s,i,o,n,S,t,a,t,e,m,e,n,t);
1129 const XMLCh AuthorizationDecisionStatement::TYPE_NAME[] =   UNICODE_LITERAL_34(A,u,t,h,o,r,i,z,a,t,i,o,n,D,e,c,i,s,i,o,n,S,t,a,t,e,m,e,n,t,T,y,p,e);
1130 const XMLCh AuthorizationDecisionStatement::RESOURCE_ATTRIB_NAME[] =        UNICODE_LITERAL_8(R,e,s,o,u,r,c,e);
1131 const XMLCh AuthorizationDecisionStatement::DECISION_ATTRIB_NAME[] =        UNICODE_LITERAL_8(D,e,c,i,s,i,o,n);
1132 const XMLCh AuthorizationDecisionStatement::DECISION_PERMIT[] =             UNICODE_LITERAL_6(P,e,r,m,i,t);
1133 const XMLCh AuthorizationDecisionStatement::DECISION_DENY[] =               UNICODE_LITERAL_4(D,e,n,y);
1134 const XMLCh AuthorizationDecisionStatement::DECISION_INDETERMINATE[] =      UNICODE_LITERAL_13(I,n,d,e,t,e,r,m,i,n,a,t,e);
1135 const XMLCh Condition::LOCAL_NAME[] =               UNICODE_LITERAL_9(C,o,n,d,i,t,i,o,n);
1136 const XMLCh Conditions::LOCAL_NAME[] =              UNICODE_LITERAL_10(C,o,n,d,i,t,i,o,n,s);
1137 const XMLCh Conditions::TYPE_NAME[] =               UNICODE_LITERAL_14(C,o,n,d,i,t,i,o,n,s,T,y,p,e);
1138 const XMLCh Conditions::NOTBEFORE_ATTRIB_NAME[] =   UNICODE_LITERAL_9(N,o,t,B,e,f,o,r,e);
1139 const XMLCh Conditions::NOTONORAFTER_ATTRIB_NAME[] =UNICODE_LITERAL_12(N,o,t,O,n,O,r,A,f,t,e,r);
1140 const XMLCh ConfirmationMethod::LOCAL_NAME[] =      UNICODE_LITERAL_18(C,o,n,f,i,r,m,a,t,i,o,n,M,e,t,h,o,d);
1141 const XMLCh DoNotCacheCondition::LOCAL_NAME[] =     UNICODE_LITERAL_19(D,o,N,o,t,C,a,c,h,e,C,o,n,d,i,t,i,o,n);
1142 const XMLCh DoNotCacheCondition::TYPE_NAME[] =      UNICODE_LITERAL_23(D,o,N,o,t,C,a,c,h,e,C,o,n,d,i,t,i,o,n,T,y,p,e);
1143 const XMLCh Evidence::LOCAL_NAME[] =                UNICODE_LITERAL_8(E,v,i,d,e,n,c,e);
1144 const XMLCh Evidence::TYPE_NAME[] =                 UNICODE_LITERAL_12(E,v,i,d,e,n,c,e,T,y,p,e);
1145 const XMLCh NameIdentifier::LOCAL_NAME[] =          UNICODE_LITERAL_14(N,a,m,e,I,d,e,n,t,i,f,i,e,r);
1146 const XMLCh NameIdentifier::TYPE_NAME[] =           UNICODE_LITERAL_18(N,a,m,e,I,d,e,n,t,i,f,i,e,r,T,y,p,e);
1147 const XMLCh NameIdentifier::NAMEQUALIFIER_ATTRIB_NAME[] =   UNICODE_LITERAL_13(N,a,m,e,Q,u,a,l,i,f,i,e,r);
1148 const XMLCh NameIdentifier::FORMAT_ATTRIB_NAME[] =  UNICODE_LITERAL_6(F,o,r,m,a,t);
1149 const XMLCh Statement::LOCAL_NAME[] =               UNICODE_LITERAL_9(S,t,a,t,e,m,e,n,t);
1150 const XMLCh Subject::LOCAL_NAME[] =                 UNICODE_LITERAL_7(S,u,b,j,e,c,t);
1151 const XMLCh Subject::TYPE_NAME[] =                  UNICODE_LITERAL_11(S,u,b,j,e,c,t,T,y,p,e);
1152 const XMLCh SubjectConfirmation::LOCAL_NAME[] =     UNICODE_LITERAL_19(S,u,b,j,e,c,t,C,o,n,f,i,r,m,a,t,i,o,n);
1153 const XMLCh SubjectConfirmation::TYPE_NAME[] =      UNICODE_LITERAL_23(S,u,b,j,e,c,t,C,o,n,f,i,r,m,a,t,i,o,n,T,y,p,e);
1154 const XMLCh SubjectConfirmationData::LOCAL_NAME[] = UNICODE_LITERAL_23(S,u,b,j,e,c,t,C,o,n,f,i,r,m,a,t,i,o,n,D,a,t,a);
1155 const XMLCh SubjectLocality::LOCAL_NAME[] =         UNICODE_LITERAL_15(S,u,b,j,e,c,t,L,o,c,a,l,i,t,y);
1156 const XMLCh SubjectLocality::TYPE_NAME[] =          UNICODE_LITERAL_19(S,u,b,j,e,c,t,L,o,c,a,l,i,t,y,T,y,p,e);
1157 const XMLCh SubjectLocality::IPADDRESS_ATTRIB_NAME[] =      UNICODE_LITERAL_9(I,P,A,d,d,r,e,s,s);
1158 const XMLCh SubjectLocality::DNSADDRESS_ATTRIB_NAME[] =     UNICODE_LITERAL_10(D,N,S,A,d,d,r,e,s,s);
1159 const XMLCh SubjectStatement::LOCAL_NAME[] =        UNICODE_LITERAL_16(S,u,b,j,e,c,t,S,t,a,t,e,m,e,n,t);
1160
1161 #define XCH(ch) chLatin_##ch
1162 #define XNUM(d) chDigit_##d