Skip to content

Commit c71e9b2

Browse files
committed
Se expone mediante la interfaz XmlDocument::getDocumentElement()
1 parent e0d3e89 commit c71e9b2

2 files changed

Lines changed: 17 additions & 8 deletions

File tree

src/Contract/XmlDocumentInterface.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
namespace Derafu\Xml\Contract;
1414

1515
use Derafu\Xml\Exception\XmlException;
16+
use DOMElement;
1617
use DOMNode;
1718
use DOMNodeList;
1819
use JsonSerializable;
@@ -53,6 +54,14 @@ public function setFormatOutput(bool $formatOutput): static;
5354
*/
5455
public function setPreserveWhiteSpace(bool $preserveWhiteSpace): static;
5556

57+
/**
58+
* Returns the root element instance of the document.
59+
*
60+
* @return DOMElement|null The root element instance of the document or
61+
* `null` if it is not present.
62+
*/
63+
public function getDocumentElement(): ?DOMElement;
64+
5665
/**
5766
* Returns the name of the root tag of the XML.
5867
*

src/XmlDocument.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ public function setPreserveWhiteSpace(bool $preserveWhiteSpace): static
9191
return $this;
9292
}
9393

94+
/**
95+
* {@inheritDoc}
96+
*/
97+
public function getDocumentElement(): ?DOMElement
98+
{
99+
return $this->documentElement;
100+
}
101+
94102
/**
95103
* {@inheritDoc}
96104
*/
@@ -297,14 +305,6 @@ public function toArray(): array
297305
return $this->query('/');
298306
}
299307

300-
/**
301-
* {@inheritDoc}
302-
*/
303-
public function getDocumentElement(): ?DOMElement
304-
{
305-
return $this->documentElement;
306-
}
307-
308308
/**
309309
* {@inheritDoc}
310310
*/

0 commit comments

Comments
 (0)