sync the repo
[hiphop-php.git] / hphp / runtime / ext / domdocument / ext_domdocument.php
bloba6069e97b8d2e7d88c0974c958b7b9e19596b831
1 <?hh
3 <<__NativeData>>
4 class DOMNode {
6 public function __construct(): void {
9 /**
10 * This functions appends a child to an existing list of children or creates
11 * a new list of children. The child can be created with e.g.
12 * DOMDocument::createElement(), DOMDocument::createTextNode() etc. or
13 * simply by using any other node.
15 * @param DOMNode $newnode - The appended child.
17 * @return mixed - The node added.
20 <<__Native>>
21 public function appendChild(DOMNode $newnode): mixed;
23 /**
24 * Creates a copy of the node.
26 * @param bool $deep - Indicates whether to copy all descendant nodes. This
27 * parameter is defaulted to FALSE.
29 * @return mixed - The cloned node.
32 <<__Native>>
33 public function cloneNode(bool $deep = false): mixed;
35 /**
36 * Gets line number for where the node is defined.
38 * @return int - Always returns the line number where the node was defined
39 * in.
42 <<__Native>>
43 public function getLineNo(): int;
45 /**
46 * This method checks if the node has attributes. The tested node have to be
47 * an XML_ELEMENT_NODE.
49 * @return bool - Returns TRUE on success or FALSE on failure.
52 <<__Native>>
53 public function hasAttributes(): bool;
55 /**
56 * This function checks if the node has children.
58 * @return bool - Returns TRUE on success or FALSE on failure.
61 <<__Native>>
62 public function hasChildNodes(): bool;
64 /**
65 * This function inserts a new node right before the reference node. If you
66 * plan to do further modifications on the appended child you must use the
67 * returned node.
69 * @param DOMNode $newnode - The new node.
70 * @param DOMNode $refnode - The reference node. If not supplied, newnode is
71 * appended to the children.
73 * @return mixed - The inserted node.
76 <<__Native>>
77 public function insertBefore(DOMNode $newnode, ?DOMNode $refnode = null): mixed;
79 /**
80 * Tells whether namespaceURI is the default namespace.
82 * @param string $namespaceuri - The namespace URI to look for.
84 * @return bool - Return TRUE if namespaceURI is the default namespace,
85 * FALSE otherwise.
88 <<__Native>>
89 public function isDefaultNamespace(string $namespaceuri): bool;
91 /**
92 * This function indicates if two nodes are the same node. The comparison is
93 * not based on content
95 * @param DOMNode $node - The compared node.
97 * @return bool - Returns TRUE on success or FALSE on failure.
100 <<__Native>>
101 public function isSameNode(DOMNode $node): bool;
104 * Checks if the asked feature is supported for the specified version.
106 * @param string $feature - The feature to test. See the example of
107 * DOMImplementation::hasFeature() for a list of features.
109 * @param string $version - The version number of the feature to test.
111 * @return bool - Returns TRUE on success or FALSE on failure.
114 <<__Native>>
115 public function isSupported(string $feature, string $version): bool;
118 * Gets the namespace URI of the node based on the prefix.
120 * @param mixed $namespaceuri - The prefix of the namespace.
122 * @return mixed - The namespace URI of the node.
125 <<__Native>>
126 public function lookupNamespaceUri(mixed $namespaceuri): mixed;
129 * Gets the namespace prefix of the node based on the namespace URI.
131 * @param string $prefix - The namespace URI.
133 * @return mixed - The prefix of the namespace.
136 <<__Native>>
137 public function lookupPrefix(string $prefix): mixed;
140 * Normalizes the node.
143 <<__Native>>
144 public function normalize(): void;
147 * This functions removes a child from a list of children.
149 * @param DOMNode $node - The removed child.
151 * @return mixed - If the child could be removed the functions returns the
152 * old child.
155 <<__Native>>
156 public function removeChild(DOMNode $node): mixed;
159 * This function replaces the child oldnode with the passed new node. If the
160 * new node is already a child it will not be added a second time. If the
161 * replacement succeeds the old node is returned.
163 * @param DOMNode $newchildobj - The new node. It must be a member of the
164 * target document, i.e. created by one of the DOMDocument->createXXX()
165 * methods or imported in the document by DOMDocument::importNode.
166 * @param DOMNode $oldchildobj - The old node.
168 * @return mixed - The old node or FALSE if an error occur.
171 <<__Native>>
172 public function replaceChild(DOMNode $newchildobj, DOMNode $oldchildobj): mixed;
174 <<__Native>>
175 public function C14N(bool $exclusive = false,
176 bool $with_comments = false,
177 mixed $xpath = null,
178 mixed $ns_prefixes = null): mixed;
180 <<__Native>>
181 public function C14Nfile(string $uri,
182 bool $exclusive = false,
183 bool $with_comments = false,
184 mixed $xpath = null,
185 mixed $ns_prefixes = null): mixed;
187 <<__Native>>
188 public function getNodePath(): mixed;
191 * @return array - var_dump() compat output helper.
194 <<__Native>>
195 public function __debugInfo(): darray<string, mixed>;
199 * DOMAttr represents an attribute in the DOMElement object.
202 class DOMAttr extends DOMNode {
204 <<__Native>>
205 public function __construct(string $name, ?string $value = null): void;
208 * This function checks if the attribute is a defined ID. According to the
209 * DOM standard this requires a DTD which defines the attribute ID to be of
210 * type ID. You need to validate your document with DOMDocument::validate or
211 * DOMDocument::validateOnParse before using this function.
213 * @return bool - Returns TRUE on success or FALSE on failure.
216 <<__Native>>
217 public function isId(): bool;
220 * @return array - var_dump() compat output helper.
223 <<__Native>>
224 public function __debugInfo(): darray<string, mixed>;
228 * Represents nodes with character data. No nodes directly correspond to this
229 * class, but other nodes do inherit from it.
232 class DOMCharacterData extends DOMNode {
235 * Append the string data to the end of the character data of the node.
237 * @param string $arg - The string to append.
239 * @return bool - No value is returned.
242 <<__Native>>
243 public function appendData(string $arg): bool;
246 * Deletes count characters starting from position offset.
248 * @param int $offset - The offset from which to start removing.
249 * @param int $count - The number of characters to delete. If the sum of
250 * offset and count exceeds the length, then all characters to the end of
251 * the data are deleted.
253 * @return bool - No value is returned.
256 <<__Native>>
257 public function deleteData(int $offset, int $count): bool;
260 * Inserts string data at position offset.
262 * @param int $offset - The character offset at which to insert.
263 * @param string $data - The string to insert.
265 * @return bool - No value is returned.
268 <<__Native>>
269 public function insertData(int $offset, string $data): bool;
272 * Replace count characters starting from position offset with data.
274 * @param int $offset - The offset from which to start replacing.
275 * @param int $count - The number of characters to replace. If the sum of
276 * offset and count exceeds the length, then all characters to the end of
277 * the data are replaced.
278 * @param string $data - The string with which the range must be replaced.
280 * @return bool - No value is returned.
283 <<__Native>>
284 public function replaceData(int $offset, int $count, string $data): bool;
287 * Returns the specified substring.
289 * @param int $offset - Start offset of substring to extract.
290 * @param int $count - The number of characters to extract.
292 * @return string - The specified substring. If the sum of offset and count
293 * exceeds the length, then all 16-bit units to the end of the data are
294 * returned.
297 <<__Native>>
298 public function substringData(int $offset, int $count): string;
301 * @return array - var_dump() compat output helper.
304 <<__Native>>
305 public function __debugInfo(): darray<string, mixed>;
309 * Represents comment nodes, characters delimited by <!-- and -->.
312 class DOMComment extends DOMCharacterData {
314 <<__Native>>
315 public function __construct(?string $value = null): void;
319 * The DOMText class inherits from DOMCharacterData and represents the textual
320 * content of a DOMElement or DOMAttr.
323 class DOMText extends DOMCharacterData {
325 <<__Native>>
326 public function __construct(?string $value = null): void;
329 * Indicates whether this text node contains whitespace. The text node is
330 * determined to contain whitespace in element content during the load of
331 * the document.
333 * @return bool - Returns TRUE on success or FALSE on failure.
336 <<__Native>>
337 public function isWhitespaceInElementContent(): bool;
340 * Indicates whether this text node contains whitespace. The text node is
341 * determined to contain whitespace in element content during the load of
342 * the document.
344 * @return bool - Returns TRUE on success or FALSE on failure.
347 <<__Native>>
348 public function isElementContentWhitespace(): bool;
351 * Breaks this node into two nodes at the specified offset, keeping both in
352 * the tree as siblings. After being split, this node will contain all the
353 * content up to the offset. If the original node had a parent node, the new
354 * node is inserted as the next sibling of the original node. When the
355 * offset is equal to the length of this node, the new node has no data.
357 * @param int $offset - The offset at which to split, starting from 0.
359 * @return mixed - The new node of the same type, which contains all the
360 * content at and after the offset.
363 <<__Native>>
364 public function splitText(int $offset): mixed;
367 * @return array - var_dump() compat output helper.
370 <<__Native>>
371 public function __debugInfo(): darray<string, mixed>;
374 class DOMCdataSection extends DOMText {
376 <<__Native>>
377 public function __construct(string $value): void;
381 * Represents an entire HTML or XML document; serves as the root of the
382 * document tree.
385 class DOMDocument extends DOMNode {
387 <<__Native("NoRecording")>>
388 public function __construct(?string $version = null, ?string $encoding = null): void;
391 * This function creates a new instance of class DOMAttr. This node will not
392 * show up in the document unless it is inserted with (e.g.)
393 * DOMNode->appendChild().
395 * @param string $name - The name of the attribute.
397 * @return mixed - The new DOMAttr or FALSE if an error occurred.
400 <<__Native>>
401 public function createAttribute(string $name): mixed;
404 * This function creates a new instance of class DOMAttr. This node will not
405 * show up in the document unless it is inserted with (e.g.)
406 * DOMNode->appendChild().
408 * @param string $namespaceuri - The URI of the namespace.
409 * @param string $qualifiedname - The tag name and prefix of the attribute,
410 * as prefix:tagname.
412 * @return mixed - The new DOMAttr or FALSE if an error occurred.
415 <<__Native>>
416 public function createAttributeNS(string $namespaceuri,
417 string $qualifiedname): mixed;
420 * This function creates a new instance of class DOMCDATASection. This node
421 * will not show up in the document unless it is inserted with (e.g.)
422 * DOMNode->appendChild().
424 * @param string $data - The content of the cdata.
426 * @return mixed - The new DOMCDATASection or FALSE if an error occurred.
429 <<__Native>>
430 public function createCDATASection(string $data): mixed;
433 * This function creates a new instance of class DOMComment. This node will
434 * not show up in the document unless it is inserted with (e.g.)
435 * DOMNode->appendChild().
437 * @param string $data - The content of the comment.
439 * @return mixed - The new DOMComment or FALSE if an error occurred.
442 <<__Native>>
443 public function createComment(string $data): mixed;
446 * This function creates a new instance of class DOMDocumentFragment. This
447 * node will not show up in the document unless it is inserted with (e.g.)
448 * DOMNode->appendChild().
450 * @return mixed - The new DOMDocumentFragment or FALSE if an error occurred.
453 <<__Native>>
454 public function createDocumentFragment(): mixed;
457 * This function creates a new instance of class DOMElement. This node will
458 * not show up in the document unless it is inserted with (e.g.)
459 * DOMNode->appendChild().
461 * @param string $name - The tag name of the element.
462 * @param string $value - The value of the element. By default, an empty
463 * element will be created. The value can also be set later with
464 * DOMElement->nodeValue.
466 * @return mixed - Returns a new instance of class DOMElement or FALSE if an
467 * error occurred.
470 <<__Native>>
471 public function createElement(string $name, ?string $value = null): mixed;
474 * This function creates a new element node with an associated namespace.
475 * This node will not show up in the document unless it is inserted with
476 * (e.g.) DOMNode->appendChild().
478 * @param string $namespaceuri - The URI of the namespace.
479 * @param string $qualifiedname - The qualified name of the element, as
480 * prefix:tagname.
481 * @param string $value - The value of the element. By default, an empty
482 * element will be created. You can also set the value later with
483 * DOMElement->nodeValue.
485 * @return mixed - The new DOMElement or FALSE if an error occurred.
488 <<__Native>>
489 public function createElementNS(string $namespaceuri,
490 string $qualifiedname,
491 ?string $value = null): mixed;
494 * This function creates a new instance of class DOMEntityReference. This
495 * node will not show up in the document unless it is inserted with (e.g.)
496 * DOMNode->appendChild().
498 * @param string $name - The content of the entity reference, e.g. the
499 * entity reference minus the leading & and the trailing ; characters.
501 * @return mixed - The new DOMEntityReference or FALSE if an error occurred.
504 <<__Native>>
505 public function createEntityReference(string $name): mixed;
508 * This function creates a new instance of class DOMProcessingInstruction.
509 * This node will not show up in the document unless it is inserted with
510 * (e.g.) DOMNode->appendChild().
512 * @param string $target - The target of the processing instruction.
513 * @param string $data - The content of the processing instruction.
515 * @return mixed - The new DOMProcessingInstruction or FALSE if an error
516 * occurred.
519 <<__Native>>
520 public function createProcessingInstruction(string $target,
521 ?string $data = null): mixed;
524 * This function creates a new instance of class DOMText. This node will not
525 * show up in the document unless it is inserted with (e.g.)
526 * DOMNode->appendChild().
528 * @param string $data - The content of the text.
530 * @return mixed - The new DOMText or FALSE if an error occurred.
533 <<__Native>>
534 public function createTextNode(string $data): mixed;
537 * This function is similar to DOMDocument::getElementsByTagName but
538 * searches for an element with a given id. For this function to work, you
539 * will need either to set some ID attributes with
540 * DOMElement::setIdAttribute or a DTD which defines an attribute to be of
541 * type ID. In the later case, you will need to validate your document with
542 * DOMDocument::validate or DOMDocument->validateOnParse before using this
543 * function.
545 * @param string $elementid - The unique id value for an element.
547 * @return mixed - Returns the DOMElement or NULL if the element is not
548 * found.
551 <<__Native>>
552 public function getElementById(string $elementid): mixed;
555 * This function returns a new instance of class DOMNodeList containing the
556 * elements with a given tag name.
558 * @param string $name - The name of the tag to match on. The special value
559 * * matches all tags.
561 * @return DOMNodeList - A new DOMNodeList object containing all the matched
562 * elements.
565 <<__Native>>
566 public function getElementsByTagName(string $name): DOMNodeList;
569 * Returns a DOMNodeList of all elements with a given local name and a
570 * namespace URI.
572 * @param string $namespaceuri - The namespace URI of the elements to match
573 * on. The special value * matches all namespaces.
574 * @param string $localname - The local name of the elements to match on.
575 * The special value * matches all local names.
577 * @return DOMNodeList - A new DOMNodeList object containing all the matched
578 * elements.
581 <<__Native>>
582 public function getElementsByTagNameNS(
583 string $namespaceuri,
584 string $localname,
585 ): DOMNodeList;
588 * This function returns a copy of the node to import and associates it with
589 * the current document.
591 * @param DOMNode $importednode - The node to import.
592 * @param bool $deep - If set to TRUE, this method will recursively import
593 * the subtree under the importedNode. To copy the nodes attributes deep
594 * needs to be set to TRUE
596 * @return mixed - The copied node or FALSE, if it cannot be copied.
599 <<__Native>>
600 public function importNode(DOMNode $importednode, bool $deep = false): mixed;
603 * Internal helper function for load()/loadXML()
605 <<__Native("NoRecording")>>
606 private function _load(string $arg, int $options,
607 bool $isFile): bool;
610 * Internal helper function for loadHTMLFile()/loadHTML()
612 <<__Native>>
613 private function _loadHTML(string $arg, int $options,
614 bool $isFile): bool;
617 * Loads an XML document from a file. Warning Unix style paths with forward
618 * slashes can cause significant performance degradation on Windows systems;
619 * be sure to call realpath() in such a case.
621 * @param string $filename - The path to the XML document.
622 * @param int $options - Bitwise OR of the libxml option constants.
624 * @return bool - Returns TRUE on success or FALSE on failure.
626 public function load(string $filename, int $options = 0): bool {
627 return $this->_load($filename, $options, true);
631 * The function parses the HTML contained in the string source. Unlike
632 * loading XML, HTML does not have to be well-formed to load.
634 * @param string $source - The HTML string.
635 * @param int $options - Since PHP 5.4.0 and libxml 2.6.0, you may also use
636 * the options parameter to specify additional Libxml parameters
638 * @return bool - Returns TRUE on success or FALSE on failure.
640 public function loadHTML(string $source, int $options = 0): bool {
641 return $this->_loadHTML($source, $options, false);
646 * The function parses the HTML document in the file named filename. Unlike
647 * loading XML, HTML does not have to be well-formed to load.
649 * @param string $filename - The path to the HTML file.
650 * @param int $options - Since PHP 5.4.0 and libxml 2.6.0, you may also use
651 * the options parameter to specify additional Libxml parameters
653 * @return bool - Returns TRUE on success or FALSE on failure.
655 public function loadHTMLFile(string $filename, int $options = 0): bool {
656 return $this->_loadHTML($filename, $options, true);
660 * Loads an XML document from a string.
662 * @param string $source - The string containing the XML.
663 * @param int $options - Bitwise OR of the libxml option constants.
665 * @return bool - Returns TRUE on success or FALSE on failure.
667 public function loadXML(string $source, int $options = 0): bool {
668 return $this->_load($source, $options, false);
673 * This method acts as if you saved and then loaded the document, putting
674 * the document in a "normal" form.
677 <<__Native>>
678 public function normalizeDocument(): void;
681 * This method allows you to register your own extended DOM class to be used
682 * afterward by the PHP DOM extension. This method is not part of the DOM
683 * standard.
685 * @param string $baseclass - The DOM class that you want to extend. You can
686 * find a list of these classes in the chapter introduction.
687 * @param string $extendedclass - Your extended class name. If NULL is
688 * provided, any previously registered class extending baseclass will be
689 * removed.
691 * @return bool - Returns TRUE on success or FALSE on failure.
694 <<__Native>>
695 public function registerNodeClass(string $baseclass, string $extendedclass): bool;
698 * @param string $filename - The RNG file.
700 * @return bool - Returns TRUE on success or FALSE on failure.
703 <<__Native>>
704 public function relaxNGValidate(string $filename): bool;
707 * @param string $source - A string containing the RNG schema.
709 * @return bool - Returns TRUE on success or FALSE on failure.
712 <<__Native>>
713 public function relaxNGValidateSource(string $source): bool;
716 * Creates an XML document from the DOM representation. This function is
717 * usually called after building a new dom document from scratch as in the
718 * example below.
720 * @param string $file - The path to the saved XML document.
721 * @param int $options - Additional Options. Currently only
722 * LIBXML_NOEMPTYTAG is supported.
724 * @return mixed - Returns the number of bytes written or FALSE if an error
725 * occurred.
728 <<__Native>>
729 public function save(string $file, int $options = 0): mixed;
732 * Creates an HTML document from the DOM representation. This function is
733 * usually called after building a new dom document from scratch as in the
734 * example below.
736 * @param object $node - Optional parameter to output a subset of the
737 * document.
739 * @return mixed - Returns the HTML, or FALSE if an error occurred.
742 <<__Native>>
743 public function saveHTML(?DOMNode $node = null): mixed;
746 * Creates an HTML document from the DOM representation. This function is
747 * usually called after building a new dom document from scratch as in the
748 * example below.
750 * @param string $file - The path to the saved HTML document.
752 * @return mixed - Returns the number of bytes written or FALSE if an error
753 * occurred.
756 <<__Native>>
757 public function saveHTMLFile(string $file): mixed;
760 * Creates an XML document from the DOM representation. This function is
761 * usually called after building a new dom document from scratch as in the
762 * example below.
764 * @param DOMNode $node - Use this parameter to output only a specific node
765 * without XML declaration rather than the entire document.
766 * @param int $options - Additional Options. Currently only
767 * LIBXML_NOEMPTYTAG is supported.
769 * @return mixed - Returns the XML, or FALSE if an error occurred.
772 <<__Native>>
773 public function saveXML(?DOMNode $node = null, int $options = 0): mixed;
776 * Validates a document based on the given schema file.
778 * @param string $filename - The path to the schema.
780 * @return bool - Returns TRUE on success or FALSE on failure.
783 <<__Native>>
784 public function schemaValidate(string $filename): bool;
787 * Validates a document based on a schema defined in the given string.
789 * @param string $source - A string containing the schema.
791 * @return bool - Returns TRUE on success or FALSE on failure.
794 <<__Native>>
795 public function schemaValidateSource(string $source): bool;
798 * Validates the document based on its DTD. You can also use the
799 * validateOnParse property of DOMDocument to make a DTD validation.
801 * @return bool - Returns TRUE on success or FALSE on failure. If the
802 * document have no DTD attached, this method will return FALSE.
805 <<__Native>>
806 public function validate(): bool;
809 * @param int $options - libxml parameters. Available since PHP 5.1.0 and
810 * Libxml 2.6.7.
812 * @return mixed - Returns the number of XIncludes in the document, -1 if
813 * some processing failed, or FALSE if there were no substitutions.
816 <<__Native>>
817 public function xinclude(int $options = 0): mixed;
820 * @return array - var_dump() compat output helper.
823 <<__Native>>
824 public function __debugInfo(): darray<string, mixed>;
827 class DOMDocumentFragment extends DOMNode {
829 <<__Native>>
830 public function __construct(): void;
833 * Appends raw XML data to a DOMDocumentFragment. This method is not part
834 * of the DOM standard. It was created as a simpler approach for appending
835 * an XML DocumentFragment in a DOMDocument. If you want to stick to the
836 * standards, you will have to create a temporary DOMDocument with a dummy
837 * root and then loop through the child nodes of the root of your XML data
838 * to append them.
840 * @param string $data - XML to append.
842 * @return bool - Returns TRUE on success or FALSE on failure.
845 <<__Native>>
846 public function appendXML(string $data): bool;
850 * Each DOMDocument has a doctype attribute whose value is either NULL or a
851 * DOMDocumentType object.
854 class DOMDocumentType extends DOMNode {
857 * @return array - var_dump() compat output helper.
860 <<__Native>>
861 public function __debugInfo(): darray<string, mixed>;
864 <<__NativeData>>
865 class DOMElement extends DOMNode {
867 <<__Native>>
868 public function __construct(string $name,
869 ?string $value = null,
870 ?string $namespaceuri = null): void;
873 * Gets the value of the attribute with name name for the current node.
875 * @param string $name - The name of the attribute.
877 * @return string - The value of the attribute, or an empty string if no
878 * attribute with the given name is found.
881 <<__Native>>
882 public function getAttribute(string $name): string;
885 * Returns the attribute node with name name for the current element.
887 * @param string $name - The name of the attribute.
889 * @return mixed - The attribute node.
892 <<__Native>>
893 public function getAttributeNode(string $name): mixed;
896 * Returns the attribute node in namespace namespaceURI with local name
897 * localName for the current node.
899 * @param string $namespaceuri - The namespace URI.
900 * @param string $localname - The local name.
902 * @return ?DOMNode - The attribute node.
905 <<__Native>>
906 public function getAttributeNodeNS(
907 string $namespaceuri,
908 string $localname,
909 ): ?DOMNode;
912 * Gets the value of the attribute in namespace namespaceURI with local name
913 * localName for the current node.
915 * @param string $namespaceuri - The namespace URI.
916 * @param string $localname - The local name.
918 * @return string - The value of the attribute, or an empty string if no
919 * attribute with the given localName and namespaceURI is found.
922 <<__Native>>
923 public function getAttributeNS(string $namespaceuri, string $localname): string;
926 * This function returns a new instance of the class DOMNodeList of all
927 * descendant elements with a given tag name, in the order in which they are
928 * encountered in a preorder traversal of this element tree.
930 * @param string $name - The tag name. Use * to return all elements within
931 * the element tree.
933 * @return DOMNodeList - This function returns a new instance of the class
934 * DOMNodeList of all matched elements.
937 <<__Native>>
938 public function getElementsByTagName(string $name): DOMNodeList;
941 * This function fetch all the descendant elements with a given localName
942 * and namespaceURI.
944 * @param string $namespaceuri - The namespace URI.
945 * @param string $localname - The local name. Use * to return all elements
946 * within the element tree.
948 * @return DOMNodeList - This function returns a new instance of the class
949 * DOMNodeList of all matched elements in the order in which they are
950 * encountered in a preorder traversal of this element tree.
953 <<__Native>>
954 public function getElementsByTagNameNS(
955 string $namespaceuri,
956 string $localname,
957 ): DOMNodeList;
960 * Indicates whether attribute named name exists as a member of the element.
962 * @param string $name - The attribute name.
964 * @return bool - Returns TRUE on success or FALSE on failure.
967 <<__Native>>
968 public function hasAttribute(string $name): bool;
971 * Indicates whether attribute in namespace namespaceURI named localName
972 * exists as a member of the element.
974 * @param string $namespaceuri - The namespace URI.
975 * @param string $localname - The local name.
977 * @return bool - Returns TRUE on success or FALSE on failure.
980 <<__Native>>
981 public function hasAttributeNS(string $namespaceuri, string $localname): bool;
984 * Removes attribute named name from the element.
986 * @param string $name - The name of the attribute.
988 * @return bool - Returns TRUE on success or FALSE on failure.
991 <<__Native>>
992 public function removeAttribute(string $name): bool;
995 * Removes attribute oldnode from the element.
997 * @param DOMAttr $oldattr - The attribute node.
999 * @return mixed - Returns TRUE on success or FALSE on failure.
1002 <<__Native>>
1003 public function removeAttributeNode(DOMAttr $oldattr): mixed;
1006 * Removes attribute is namespace namespaceURI named localName from the
1007 * element.
1009 * @param string $namespaceuri - The namespace URI.
1010 * @param string $localname - The local name.
1012 * @return mixed - Returns TRUE on success or FALSE on failure.
1015 <<__Native>>
1016 public function removeAttributeNS(string $namespaceuri, string $localname): mixed;
1019 * Sets an attribute with name name to the given value. If the attribute
1020 * does not exist, it will be created.
1022 * @param string $name - The name of the attribute.
1023 * @param string $value - The value of the attribute.
1025 * @return mixed - The new DOMAttr or FALSE if an error occurred.
1028 <<__Native>>
1029 public function setAttribute(string $name, string $value): mixed;
1032 * Adds new attribute node attr to element.
1034 * @param DOMAttr $newattr - The attribute node.
1036 * @return mixed - Returns old node if the attribute has been replaced or
1037 * NULL.
1040 <<__Native>>
1041 public function setAttributeNode(DOMAttr $newattr): mixed;
1044 * Adds new attribute node attr to element.
1046 * @param DOMAttr $newattr - The attribute node.
1048 * @return mixed - Returns the old node if the attribute has been replaced.
1051 <<__Native>>
1052 public function setAttributeNodeNS(DOMAttr $newattr): mixed;
1055 * Sets an attribute with namespace namespaceURI and name name to the given
1056 * value. If the attribute does not exist, it will be created.
1058 * @param string $namespaceuri - The namespace URI.
1059 * @param string $name - The qualified name of the attribute, as
1060 * prefix:tagname.
1061 * @param string $value - The value of the attribute.
1063 * @return mixed - No value is returned.
1066 <<__Native>>
1067 public function setAttributeNS(string $namespaceuri,
1068 string $name,
1069 string $value): mixed;
1072 * Declares the attribute name to be of type ID.
1074 * @param string $name - The name of the attribute.
1075 * @param bool $isid - Set it to TRUE if you want name to be of type ID,
1076 * FALSE otherwise.
1078 * @return mixed - No value is returned.
1081 <<__Native>>
1082 public function setIDAttribute(string $name, bool $isid): mixed;
1085 * Declares the attribute specified by attr to be of type ID.
1087 * @param DOMAttr $idattr - The attribute node.
1088 * @param bool $isid - Set it to TRUE if you want name to be of type ID,
1089 * FALSE otherwise.
1091 * @return mixed - No value is returned.
1094 <<__Native>>
1095 public function setIDAttributeNode(DOMAttr $idattr, bool $isid): mixed;
1098 * Declares the attribute specified by localName and namespaceURI to be of
1099 * type ID.
1101 * @param string $namespaceuri - The namespace URI of the attribute.
1102 * @param string $localname - The local name of the attribute, as
1103 * prefix:tagname.
1104 * @param bool $isid - Set it to TRUE if you want name to be of type ID,
1105 * FALSE otherwise.
1107 * @return mixed - No value is returned.
1110 <<__Native>>
1111 public function setIDAttributeNS(string $namespaceuri,
1112 string $localname,
1113 bool $isid): mixed;
1116 * @return array - var_dump() compat output helper.
1119 <<__Native>>
1120 public function __debugInfo(): darray<string, mixed>;
1125 * This interface represents a known entity, either parsed or unparsed, in an
1126 * XML document.
1129 class DOMEntity extends DOMNode {
1132 * @return array - var_dump() compat output helper.
1135 <<__Native>>
1136 public function __debugInfo(): darray<string, mixed>;
1139 class DOMEntityReference extends DOMNode {
1141 <<__Native>>
1142 public function __construct(string $name): void;
1145 class DOMNotation extends DOMNode {
1148 * @return array - var_dump() compat output helper.
1151 <<__Native>>
1152 public function __debugInfo(): darray<string, mixed>;
1155 class DOMProcessingInstruction extends DOMNode {
1157 <<__Native>>
1158 public function __construct(string $name, ?string $value = null): void;
1161 * @return array - var_dump() compat output helper.
1164 <<__Native>>
1165 public function __debugInfo(): darray<string, mixed>;
1168 class DOMNameSpaceNode extends DOMNode {
1171 <<__NativeData>>
1172 class DOMNodeIterator implements Iterator<?DOMNode> {
1174 public function __construct(): void {
1177 <<__Native>>
1178 public function current(): ?DOMNode;
1180 <<__Native>>
1181 public function key(): mixed;
1183 <<__Native>>
1184 public function next(): void;
1186 <<__Native>>
1187 public function rewind(): void;
1189 <<__Native>>
1190 public function valid(): bool;
1193 <<__NativeData>>
1194 class DOMNamedNodeMap implements IteratorAggregate<?DOMNode> {
1196 public function __construct()[]: void {
1200 * Retrieves a node specified by its nodeName.
1202 * @param string $name - The nodeName of the node to retrieve.
1204 * @return mixed - A node (of any type) with the specified nodeName, or NULL
1205 * if no node is found.
1208 <<__Native>>
1209 public function getNamedItem(string $name): mixed;
1212 * Retrieves a node specified by localName and namespaceURI.
1214 * @param string $namespaceuri - The namespace URI of the node to retrieve.
1215 * @param string $localname - The local name of the node to retrieve.
1217 * @return mixed - A node (of any type) with the specified local name and
1218 * namespace URI, or NULL if no node is found.
1221 <<__Native>>
1222 public function getNamedItemNS(string $namespaceuri, string $localname): mixed;
1225 * Retrieves a node specified by index within the DOMNamedNodeMap object.
1227 * @param int $index - Index into this map.
1229 * @return mixed - The node at the indexth position in the map, or NULL if
1230 * that is not a valid index (greater than or equal to the number of nodes
1231 * in this map).
1234 <<__Native>>
1235 public function item(int $index): mixed;
1237 <<__Native>>
1238 public function getIterator()[]: DOMNodeIterator;
1241 <<__NativeData>>
1242 class DOMNodeList implements IteratorAggregate<?DOMNode> {
1244 public function __construct()[]: void {
1248 * Retrieves a node specified by index within the DOMNodeList object. Tip
1249 * If you need to know the number of nodes in the collection, use the length
1250 * property of the DOMNodeList object.
1252 * @param int $index - Index of the node into the collection.
1254 * @return mixed - The node at the indexth position in the DOMNodeList, or
1255 * NULL if that is not a valid index.
1258 <<__Native>>
1259 public function item(int $index): mixed;
1261 <<__Native>>
1262 public function getIterator()[]: DOMNodeIterator;
1265 * @return array - var_dump() compat output helper.
1268 <<__Native>>
1269 public function __debugInfo(): darray<string, mixed>;
1273 * The DOMImplementation interface provides a number of methods for performing
1274 * operations that are independent of any particular instance of the document
1275 * object model.
1278 class DOMImplementation {
1280 public function __construct(): void {
1284 * Creates a DOMDocument object of the specified type with its document
1285 * element.
1287 * @param string $namespaceuri - The namespace URI of the document element
1288 * to create.
1289 * @param string $qualifiedname - The qualified name of the document element
1290 * to create.
1291 * @param DOMDocumentType $doctypeobj - The type of document to create or
1292 * null.
1294 * @return mixed - A new DOMDocument object. If namespaceURI, qualifiedName,
1295 * and doctype are null, the returned DOMDocument is empty with no document
1296 * element
1299 <<__Native>>
1300 public function createDocument(?string $namespaceuri = null,
1301 ?string $qualifiedname = null,
1302 ?DOMDocumentType $doctypeobj = null): mixed;
1305 * Creates an empty DOMDocumentType object. Entity declarations and
1306 * notations are not made available. Entity reference expansions and default
1307 * attribute additions do not occur.
1309 * @param string $qualifiedname - The qualified name of the document type to
1310 * create.
1311 * @param string $publicid - The external subset public identifier.
1312 * @param string $systemid - The external subset system identifier.
1314 * @return mixed - A new DOMDocumentType node with its ownerDocument set to
1315 * NULL.
1318 <<__Native>>
1319 public function createDocumentType(?string $qualifiedname = null,
1320 ?string $publicid = null,
1321 ?string $systemid = null): mixed;
1324 * @param string $feature - The feature to test.
1325 * @param string $version - The version number of the feature to test. In
1326 * level 2, this can be either 2.0 or 1.0.
1328 * @return bool - Returns TRUE on success or FALSE on failure.
1331 <<__Native>>
1332 public function hasFeature(string $feature, string $version): bool;
1336 * Supports XPath 1.0
1339 <<__NativeData>>
1340 class DOMXPath {
1342 <<__Native>>
1343 public function __construct(mixed $doc): void;
1346 * Executes the given XPath expression and returns a typed result if
1347 * possible.
1349 * @param string $expr - The XPath expression to execute.
1350 * @param DOMNode $context - The optional contextnode can be specified for
1351 * doing relative XPath queries. By default, the queries are relative to the
1352 * root element.
1353 * @param bool $registgerNodeNS - disable automatic registration of the
1354 * context node.
1356 * @return mixed - Returns a typed result if possible or a DOMNodeList
1357 * containing all nodes matching the given XPath expression.
1360 <<__Native>>
1361 public function evaluate(string $expr,
1362 ?DOMNode $context = null,
1363 bool $registerNodeNS = true): mixed;
1366 * Executes the given XPath expression.
1368 * @param string $expr - The XPath expression to execute.
1369 * @param DOMNode $context - The optional contextnode can be specified for
1370 * doing relative XPath queries. By default, the queries are relative to the
1371 * root element.
1372 * @param bool $registgerNodeNS - disable automatic registration of the
1373 * context node.
1375 * @return mixed - Returns a DOMNodeList containing all nodes matching the
1376 * given XPath expression. Any expression which do not return nodes will
1377 * return an empty DOMNodeList.
1380 <<__Native>>
1381 public function query(string $expr,
1382 ?DOMNode $context = null,
1383 bool $registerNodeNS = true): mixed;
1386 * Registers the namespaceURI and prefix with the DOMXPath object.
1388 * @param string $prefix - The prefix.
1389 * @param string $uri - The URI of the namespace.
1391 * @return bool - Returns TRUE on success or FALSE on failure.
1394 <<__Native>>
1395 public function registerNamespace(string $prefix, string $uri): bool;
1398 * This method enables the ability to use PHP functions within XPath
1399 * expressions.
1401 * @param mixed $funcs - Use this parameter to only allow certain functions
1402 * to be called from XPath. This parameter can be either a string (a
1403 * function name) or an array of function names.
1405 * @return mixed - No value is returned.
1408 <<__Native>>
1409 public function registerPHPFunctions(mixed $funcs = null): mixed;
1411 <<__Native>>
1412 public function __debugInfo(): darray<string, mixed>;
1415 function dom_document_create_element(DOMDocument $obj,
1416 string $name,
1417 ?string $value = null): mixed {
1418 return $obj->createElement($name, $value);
1421 function dom_document_create_document_fragment(DOMDocument $obj): mixed {
1422 return $obj->createDocumentFragment();
1425 function dom_document_create_text_node(DOMDocument $obj, string $data): mixed {
1426 return $obj->createTextNode($data);
1429 function dom_document_create_comment(DOMDocument $obj, string $data): mixed {
1430 return $obj->createComment($data);
1433 function dom_document_create_cdatasection(DOMDocument $obj,
1434 string $data): mixed {
1435 return $obj->createCDATASection($data);
1438 function dom_document_create_processing_instruction(DOMDocument $obj,
1439 string $target, ?string $data = null): mixed {
1440 return $obj->createProcessingInstruction($target, $data);
1443 function dom_document_create_attribute(DOMDocument $obj, string $name): mixed {
1444 return $obj->createAttribute($name);
1447 function dom_document_create_entity_reference(DOMDocument $obj,
1448 string $name): mixed {
1449 return $obj->createEntityReference($name);
1452 function dom_document_get_elements_by_tag_name(
1453 DOMDocument $obj,
1454 string $name,
1455 ): DOMNodeList {
1456 return $obj->getElementsByTagName($name);
1459 function dom_document_import_node(DOMDocument $obj,
1460 DOMNode $importednode,
1461 bool $deep = false): mixed {
1462 return $obj->importNode($importednode, $deep);
1465 function dom_document_create_element_ns(DOMDocument $obj,
1466 string $namespaceuri,
1467 string $qualifiedname,
1468 ?string $value = null): mixed {
1469 return $obj->createElementNS($namespaceuri, $qualifiedname, $value);
1472 function dom_document_create_attribute_ns(DOMDocument $obj,
1473 string $namespaceuri,
1474 string $qualifiedname): mixed {
1475 return $obj->createAttributeNS($namespaceuri, $qualifiedname);
1478 function dom_document_get_elements_by_tag_name_ns(
1479 DOMDocument $obj,
1480 string $namespaceuri,
1481 string $localname,
1482 ): DOMNodeList {
1483 return $obj->getElementsByTagNameNS($namespaceuri, $localname);
1486 function dom_document_get_element_by_id(DOMDocument $obj,
1487 string $elementid): mixed {
1488 return $obj->getElementById($elementid);
1491 function dom_document_normalize_document(DOMDocument $obj): void {
1492 $obj->normalizeDocument();
1496 * Creates an XML document from the DOM representation. This function is
1497 * usually called after building a new dom document from scratch as in the
1498 * example below.
1500 * @param DOMDocument $obj
1501 * @param string $file - The path to the saved XML document.
1502 * @param int $options - Additional Options. Currently only
1503 * LIBXML_NOEMPTYTAG is supported.
1505 * @return mixed - Returns the number of bytes written or FALSE if an error
1506 * occurred.
1509 function dom_document_save(DOMDocument $obj,
1510 string $file,
1511 int $options = 0): mixed {
1512 return $obj->save($file, $options);
1516 * Creates an XML document from the DOM representation. This function is
1517 * usually called after building a new dom document from scratch as in the
1518 * example below.
1520 * @param DOMDocument $obj
1521 * @param DOMNode $node - Use this parameter to output only a specific node
1522 * without XML declaration rather than the entire document.
1523 * @param int $options - Additional Options. Currently only
1524 * LIBXML_NOEMPTYTAG is supported.
1526 * @return mixed - Returns the XML, or FALSE if an error occurred.
1529 function dom_document_savexml(DOMDocument $obj,
1530 ?DOMNode $node = null,
1531 int $options = 0): mixed {
1532 return $obj->saveXML($node, $options);
1536 * Validates the document based on its DTD. You can also use the
1537 * validateOnParse property of DOMDocument to make a DTD validation.
1539 * @return bool - Returns TRUE on success or FALSE on failure. If the
1540 * document have no DTD attached, this method will return FALSE.
1543 function dom_document_validate(DOMDocument $obj): bool {
1544 return $obj->validate();
1548 * @param DOMDocument $obj - libxml parameters. Available since PHP 5.1.0 and
1549 * Libxml 2.6.7.
1551 * @return mixed - Returns the number of XIncludes in the document, -1 if some
1552 * processing failed, or FALSE if there were no substitutions.
1555 function dom_document_xinclude(DOMDocument $obj,
1556 int $options = 0): mixed {
1557 return $obj->xinclude($options);
1561 * Creates an HTML document from the DOM representation. This function is
1562 * usually called after building a new dom document from scratch as in the
1563 * example below.
1565 * @param DOMDocument $obj
1566 * @param DOMNode $node - Optional parameter to output a subset of the
1567 * document.
1569 * @return mixed - Returns the HTML, or FALSE if an error occurred.
1572 function dom_document_save_html(DOMDocument $obj,
1573 ?DOMNode $node = null): mixed {
1574 return $obj->saveHTML($node);
1577 function dom_document_save_html_file(DOMDocument $obj,
1578 string $file): mixed {
1579 return $obj->saveHTMLFile($file);
1582 function dom_document_schema_validate_file(DOMDocument $obj,
1583 string $filename): bool {
1584 return $obj->schemaValidate($filename);
1587 function dom_document_schema_validate_xml(DOMDocument $obj,
1588 string $source): bool {
1589 return $obj->schemaValidate($source);
1592 function dom_document_relaxng_validate_file(DOMDocument $obj,
1593 string $filename): bool {
1594 return $obj->relaxNGValidate($filename);
1597 function dom_document_relaxng_validate_xml(DOMDocument $obj,
1598 string $source): bool {
1599 return $obj->relaxNGValidateSource($source);
1602 function dom_node_insert_before(DOMNode $obj,
1603 DOMNode $newnode,
1604 ?DOMNode $refnode = null): mixed {
1605 return $obj->insertBefore($newnode, $refnode);
1608 function dom_node_replace_child(DOMNode $obj,
1609 DOMNode $newchildobj,
1610 DOMNode $oldchildobj): mixed {
1611 return $obj->replaceChild($newchildobj, $oldchildobj);
1614 function dom_node_remove_child(DOMNode $obj,
1615 DOMNode $node): mixed {
1616 return $obj->removeChild($node);
1619 function dom_node_append_child(DOMNode $obj,
1620 DOMNode $newnode): mixed {
1621 return $obj->appendChild($newnode);
1624 function dom_node_has_child_nodes(DOMNode $obj): bool {
1625 return $obj->hasChildNodes();
1628 function dom_node_clone_node(DOMNode $obj,
1629 bool $deep = false): mixed {
1630 return $obj->cloneNode($deep);
1633 function dom_node_normalize(DOMNode $obj): void {
1634 $obj->normalize();
1637 function dom_node_is_supported(DOMNode $obj,
1638 string $feature,
1639 string $version): bool {
1640 return $obj->isSupported($feature, $version);
1643 function dom_node_has_attributes(DOMNode $obj): bool {
1644 return $obj->hasAttributes();
1647 function dom_node_is_same_node(DOMNode $obj,
1648 DOMNode $node): bool {
1649 return $obj->isSameNode($node);
1652 function dom_node_lookup_prefix(DOMNode $obj,
1653 string $prefix): mixed {
1654 return $obj->lookupPrefix($prefix);
1657 function dom_node_is_default_namespace(DOMNode $obj,
1658 string $namespaceuri): bool {
1659 return $obj->isDefaultNamespace($namespaceuri);
1662 function dom_node_lookup_namespace_uri(DOMNode $obj,
1663 string $namespaceuri): mixed {
1664 return $obj->lookupNamespaceUri($namespaceuri);
1668 * Retrieves a node specified by index within the DOMNodeList object. Tip
1669 * If you need to know the number of nodes in the collection, use the length
1670 * property of the DOMNodeList object.
1672 * @param DOMNodeList $obj
1673 * @param int $index - Index of the node into the collection.
1675 * @return mixed - The node at the indexth position in the DOMNodeList, or
1676 * NULL if that is not a valid index.
1679 function dom_nodelist_item(DOMNodeList $obj, int $index): mixed {
1680 return $obj->item($index);
1683 function dom_namednodemap_get_named_item(DOMNamedNodeMap $obj,
1684 string $name): mixed {
1685 return $obj->getNamedItem($name);
1689 * Retrieves a node specified by index within the DOMNamedNodeMap object.
1691 * @param DOMNamedNodeMap $obj
1692 * @param int $index - Index into this map.
1694 * @return mixed - The node at the indexth position in the map, or NULL if
1695 * that is not a valid index (greater than or equal to the number of nodes
1696 * in this map).
1699 function dom_namednodemap_item(DOMNamedNodeMap $obj, int $index): mixed {
1700 return $obj->item($index);
1703 function dom_namednodemap_get_named_item_ns(DOMNamedNodeMap $obj,
1704 string $namespaceuri,
1705 string $localname): mixed {
1706 return $obj->getNamedItemNS($namespaceuri, $localname);
1709 function dom_characterdata_substring_data(DOMCharacterData $obj,
1710 int $offset,
1711 int $count): string {
1712 return $obj->substringData($offset, $count);
1715 function dom_characterdata_append_data(DOMCharacterData $obj,
1716 string $arg): bool {
1717 return $obj->appendData($arg);
1720 function dom_characterdata_insert_data(DOMCharacterData $obj,
1721 int $offset,
1722 string $data): bool {
1723 return $obj->insertData($offset, $data);
1726 function dom_characterdata_delete_data(DOMCharacterData $obj,
1727 int $offset,
1728 int $count): bool {
1729 return $obj->deleteData($offset, $count);
1732 function dom_characterdata_replace_data(DOMCharacterData $obj,
1733 int $offset,
1734 int $count,
1735 string $data): bool {
1736 return $obj->replaceData($offset, $count, $data);
1739 function dom_attr_is_id(DOMAttr $obj): bool {
1740 return $obj->isId();
1743 function dom_element_get_attribute(DOMElement $obj, string $name): string {
1744 return $obj->getAttribute($name);
1747 function dom_element_set_attribute(DOMElement $obj,
1748 string $name,
1749 string $value): mixed {
1750 return $obj->setAttribute($name, $value);
1753 function dom_element_remove_attribute(DOMElement $obj, string $name): bool {
1754 return $obj->removeAttribute($name);
1757 function dom_element_get_attribute_node(DOMElement $obj, string $name): mixed {
1758 return $obj->getAttributeNode($name);
1761 function dom_element_set_attribute_node(DOMElement $obj,
1762 DOMAttr $newattr): mixed {
1763 return $obj->setAttributeNode($newattr);
1766 function dom_element_remove_attribute_node(DOMElement $obj,
1767 DOMAttr $oldattr): mixed {
1768 return $obj->removeAttributeNode($oldattr);
1771 function dom_element_get_elements_by_tag_name(
1772 DOMElement $obj,
1773 string $name,
1774 ): DOMNodeList {
1775 return $obj->getElementsByTagName($name);
1778 function dom_element_get_attribute_ns(DOMElement $obj,
1779 string $namespaceuri,
1780 string $localname): string {
1781 return $obj->getAttributeNS($namespaceuri, $localname);
1784 function dom_element_set_attribute_ns(DOMElement $obj,
1785 string $namespaceuri,
1786 string $name,
1787 string $value): mixed {
1788 return $obj->setAttributeNS($namespaceuri, $name, $value);
1791 function dom_element_remove_attribute_ns(DOMElement $obj,
1792 string $namespaceuri,
1793 string $localname): mixed {
1794 return $obj->removeAttributeNS($namespaceuri, $localname);
1797 function dom_element_get_attribute_node_ns(DOMElement $obj,
1798 string $namespaceuri,
1799 string $localname): ?DOMNode {
1800 return $obj->getAttributeNodeNS($namespaceuri, $localname);
1803 function dom_element_set_attribute_node_ns(DOMElement $obj,
1804 DOMAttr $newattr): mixed {
1805 return $obj->setAttributeNodeNS($newattr);
1808 function dom_element_get_elements_by_tag_name_ns(
1809 DOMElement $obj,
1810 string $namespaceuri,
1811 string $localname,
1812 ): DOMNodeList {
1813 return $obj->getElementsByTagNameNS($namespaceuri, $localname);
1816 function dom_element_has_attribute(DOMElement $obj, string $name): bool {
1817 return $obj->hasAttribute($name);
1820 function dom_element_has_attribute_ns(DOMElement $obj,
1821 string $namespaceuri,
1822 string $localname): bool {
1823 return $obj->hasAttributeNS($namespaceuri, $localname);
1826 function dom_element_set_id_attribute(DOMElement $obj,
1827 string $name,
1828 bool $isid): mixed {
1829 return $obj->setIDAttribute($name, $isid);
1832 function dom_element_set_id_attribute_ns(DOMElement $obj,
1833 string $namespaceuri,
1834 string $localname,
1835 bool $isid): mixed {
1836 return $obj->setIDAttributeNS($namespaceuri, $localname, $isid);
1839 function dom_element_set_id_attribute_node(DOMElement $obj,
1840 DOMAttr $idattr,
1841 bool $isid): mixed {
1842 return $obj->setIDAttributeNode($idattr, $isid);
1845 function dom_text_split_text(DOMText $obj, int $offset): mixed {
1846 return $obj->splitText($offset);
1849 function dom_text_is_whitespace_in_element_content(DOMText $obj): bool {
1850 return $obj->isWhitespaceInElementContent();
1853 function dom_xpath_register_ns(DOMXPath $obj,
1854 string $prefix,
1855 string $uri): mixed {
1856 return $obj->registerNamespace($prefix, $uri);
1860 * Executes the given XPath expression.
1862 * @param DOMXPath $obj
1863 * @param string $expr - The XPath expression to execute.
1864 * @param DOMNode $context - The optional contextnode can be specified for
1865 * doing relative XPath queries. By default, the queries are relative to the
1866 * root element.
1868 * @return mixed - Returns a DOMNodeList containing all nodes matching the
1869 * given XPath expression. Any expression which do not return nodes will
1870 * return an empty DOMNodeList.
1873 function dom_xpath_query(DOMXPath $obj,
1874 string $expr,
1875 ?DOMNode $context = null): mixed {
1876 return $obj->query($expr, $context);
1880 * Executes the given XPath expression and returns a typed result if
1881 * possible.
1883 * @param DOMXPath $obj
1884 * @param string $expr - The XPath expression to execute.
1885 * @param DOMNode $context - The optional contextnode can be specified for
1886 * doing relative XPath queries. By default, the queries are relative to the
1887 * root element.
1889 * @return mixed - Returns a typed result if possible or a DOMNodeList
1890 * containing all nodes matching the given XPath expression.
1893 function dom_xpath_evaluate(DOMXPath $obj,
1894 string $expr,
1895 ?DOMNode $context = null): mixed {
1896 return $obj->evaluate($expr, $context);
1899 function dom_xpath_register_php_functions(DOMXPath $obj,
1900 mixed $funcs = null): mixed {
1901 return $obj->registerPHPFunctions($funcs);
1905 * This function takes the node node of class SimpleXML and makes it into a
1906 * DOMElement node. This new object can then be used as a native DOMElement
1907 * node.
1909 * @param SimpleXMLElement $node - The SimpleXMLElement node.
1911 * @return mixed - The DOMElement node added or FALSE if any errors occur.
1914 <<__Native>>
1915 function dom_import_simplexml(SimpleXMLElement $node): mixed;