diff --git a/src/SAML11/XML/saml/AbstractAttributeType.php b/src/SAML11/XML/saml/AbstractAttributeType.php index bed1bbf..d2ede37 100644 --- a/src/SAML11/XML/saml/AbstractAttributeType.php +++ b/src/SAML11/XML/saml/AbstractAttributeType.php @@ -63,8 +63,8 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); $attributeValue = AttributeValue::getChildrenOfClass($xml); - $AttributeName = self::getOptionalAttribute($xml, 'AttributeName'); - $AttributeNamespace = self::getOptionalAttribute($xml, 'AttributeNamespace'); + $AttributeName = self::getAttribute($xml, 'AttributeName'); + $AttributeNamespace = self::getAttribute($xml, 'AttributeNamespace'); return new static($AttributeName, $AttributeNamespace, $attributeValue); } @@ -79,14 +79,8 @@ public static function fromXML(DOMElement $xml): static public function toXML(DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - - if ($this->getAttributeName() !== null) { - $e->setAttribute('AttributeName', $this->getAttributeName()); - } - - if ($this->getAttributeNamespace() !== null) { - $e->setAttribute('AttributeNamespace', $this->getAttributeNamespace()); - } + $e->setAttribute('AttributeName', $this->getAttributeName()); + $e->setAttribute('AttributeNamespace', $this->getAttributeNamespace()); foreach ($this->getAttributeValue() as $av) { $av->toXML($e);