public function toUnsignedXML()
{
$this->document = DOMDocumentFactory::create();
$root = $this->document->createElementNS(Constants::NS_SAMLP, 'samlp:' . $this->tagName);
$this->document->appendChild($root);
/* Ugly hack to add another namespace declaration to the root element. */
$root->setAttributeNS(Constants::NS_SAML, 'saml:tmp', 'tmp');
$root->removeAttributeNS(Constants::NS_SAML, 'tmp');
$root->setAttribute('ID', $this->id);
$root->setAttribute('Version', '2.0');
$root->setAttribute('IssueInstant', gmdate('Y-m-d\\TH:i:s\\Z', $this->issueInstant));
if ($this->destination !== null) {
$root->setAttribute('Destination', $this->destination);
}
if ($this->consent !== null && $this->consent !== Constants::CONSENT_UNSPECIFIED) {
$root->setAttribute('Consent', $this->consent);
}
if ($this->issuer !== null) {
if (is_string($this->issuer)) {
Utils::addString($root, \SAML2_Const::NS_SAML, 'saml:Issuer', $this->issuer);
} elseif ($this->issuer instanceof XML\saml\Issuer) {
$this->issuer->toXML($root);
}
}
if (!empty($this->extensions)) {
Extensions::addList($root, $this->extensions);
}
return $root;
}