/*
- * Copyright 2001-2006 Internet2
+ * Copyright 2001-2007 Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "saml1/core/Assertions.h"
#include <xmltooling/AbstractComplexElement.h>
-#include <xmltooling/AbstractElementProxy.h>
#include <xmltooling/AbstractSimpleElement.h>
#include <xmltooling/impl/AnyElement.h>
#include <xmltooling/io/AbstractXMLObjectMarshaller.h>
#include <xercesc/util/XMLUniDefs.hpp>
using namespace opensaml::saml1;
-using namespace opensaml;
using namespace xmlsignature;
using namespace xmltooling;
using namespace std;
continue;
}
- getOthers().push_back((*i)->clone());
+ getUnknownXMLObjects().push_back((*i)->clone());
}
}
}
IMPL_XMLOBJECT_CLONE(Advice);
IMPL_TYPED_CHILDREN(AssertionIDReference,m_children.end());
IMPL_TYPED_CHILDREN(Assertion,m_children.end());
- IMPL_XMLOBJECT_CHILDREN(Other,m_children.end());
+ IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
protected:
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
// Unknown child.
const XMLCh* nsURI=root->getNamespaceURI();
if (!XMLString::equals(nsURI,SAML1_NS) && nsURI && *nsURI) {
- getOthers().push_back(childXMLObject);
+ getUnknownXMLObjects().push_back(childXMLObject);
return;
}
MARSHALL_INTEGER_ATTRIB(MinorVersion,MINORVERSION,NULL);
if (!m_AssertionID)
const_cast<AssertionImpl*>(this)->m_AssertionID=SAMLConfig::getConfig().generateIdentifier();
- MARSHALL_ID_ATTRIB(AssertionID,ASSERTIONID,NULL);
+ domElement->setAttributeNS(NULL, ASSERTIONID_ATTRIB_NAME, m_AssertionID);
+ if (*m_MinorVersion!=chDigit_0)
+ domElement->setIdAttributeNS(NULL, ASSERTIONID_ATTRIB_NAME);
MARSHALL_STRING_ATTRIB(Issuer,ISSUER,NULL);
if (!m_IssueInstant) {
const_cast<AssertionImpl*>(this)->m_IssueInstantEpoch=time(NULL);
AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
}
+ void unmarshallAttributes(const DOMElement* domElement) {
+ // Standard processing, but then we check IDness.
+ AbstractXMLObjectUnmarshaller::unmarshallAttributes(domElement);
+ if (m_AssertionID && (!m_MinorVersion || *m_MinorVersion!=chDigit_0))
+ const_cast<DOMElement*>(domElement)->setIdAttributeNS(NULL, ASSERTIONID_ATTRIB_NAME);
+ }
+
void processAttribute(const DOMAttr* attribute) {
static const XMLCh MAJORVERSION[] = UNICODE_LITERAL_12(M,a,j,o,r,V,e,r,s,i,o,n);
if (XMLHelper::isNodeNamed(attribute,NULL,MAJORVERSION)) {
throw UnmarshallingException("Assertion has invalid major version.");
}
PROC_INTEGER_ATTRIB(MinorVersion,MINORVERSION,NULL);
- PROC_ID_ATTRIB(AssertionID,ASSERTIONID,NULL);
+ PROC_STRING_ATTRIB(AssertionID,ASSERTIONID,NULL);
PROC_STRING_ATTRIB(Issuer,ISSUER,NULL);
PROC_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,NULL);
}