diff --git a/language-snippets.ent b/language-snippets.ent index a9d17708997c..b3ec9e106c7a 100644 --- a/language-snippets.ent +++ b/language-snippets.ent @@ -1587,6 +1587,38 @@ it is inserted with (e.g.) DOMNo of the libxml option constants. '> + + DOM_HIERARCHY_REQUEST_ERR + + + Raised if the parent is of a type that does not allow children of the + type of one of the passed nodes, or if the node to + put in is one of this node's ancestors or this node itself. + + +'> + + + DOM_HIERARCHY_REQUEST_ERR + + + Raised if this node is of a type that does not allow children of the + type of one of the passed nodes, or if the node to + put in is one of this node's ancestors or this node itself. + + +'> + + + DOM_WRONG_DOCUMENT_ERR + + + Raised if one of the passed nodes was created from a different + document than the one that created this node. + + +'> + Upon failure, an E_WARNING is emitted. diff --git a/reference/dom/domcharacterdata/after.xml b/reference/dom/domcharacterdata/after.xml new file mode 100644 index 000000000000..81ec1448e49a --- /dev/null +++ b/reference/dom/domcharacterdata/after.xml @@ -0,0 +1,81 @@ + + + + DOMCharacterData::after + Adds nodes after the character data + + + + &reftitle.description; + + public voidDOMCharacterData::after + DOMNodestringnodes + + + Adds the passed nodes after the element. + + + + + + + + + &reftitle.examples; + + <methodname>DOMCharacterData::after</methodname> example + + Adds nodes after the character data. + + +loadXML(""); +$cdata = $doc->documentElement->firstChild; + +$cdata->after("beautiful", $doc->createElement("world")); + +echo $doc->saveXML(); +?> +]]> + + &example.outputs; + + +beautiful +]]> + + + + + + &reftitle.seealso; + + DOMChildNode::after + DOMCharacterData::before + + + + + diff --git a/reference/dom/domcharacterdata/before.xml b/reference/dom/domcharacterdata/before.xml new file mode 100644 index 000000000000..5a37b1b0de2d --- /dev/null +++ b/reference/dom/domcharacterdata/before.xml @@ -0,0 +1,81 @@ + + + + DOMCharacterData::before + Adds nodes before the node + + + + &reftitle.description; + + public voidDOMCharacterData::before + DOMNodestringnodes + + + Adds the passed nodes before the node. + + + + + + + + + &reftitle.examples; + + <methodname>DOMCharacterData::before</methodname> example + + Adds nodes before the character data. + + +loadXML(""); +$cdata = $doc->documentElement->firstChild; + +$cdata->before("hello", $doc->createElement("beautiful")); + +echo $doc->saveXML(); +?> +]]> + + &example.outputs; + + +hello +]]> + + + + + + &reftitle.seealso; + + DOMChildNode::before + DOMCharacterData::after + + + + + diff --git a/reference/dom/domcharacterdata/remove.xml b/reference/dom/domcharacterdata/remove.xml new file mode 100644 index 000000000000..9c178b2bc7d1 --- /dev/null +++ b/reference/dom/domcharacterdata/remove.xml @@ -0,0 +1,83 @@ + + + + DOMCharacterData::remove + Removes the character data + + + + &reftitle.description; + + public voidDOMCharacterData::remove + + + + Removes the character data. + + + + + + + + &reftitle.examples; + + <methodname>DOMCharacterData::remove</methodname> example + + Removes the character data. + + +loadXML(""); +$cdata = $doc->documentElement->firstChild; + +$cdata->remove(); + +echo $doc->saveXML(); +?> +]]> + + &example.outputs; + + + +]]> + + + + + + &reftitle.seealso; + + DOMChildNode::remove + DOMCharacterData::after + DOMCharacterData::before + DOMCharacterData::replaceWith + DOMNode::removeChild + + + + + diff --git a/reference/dom/domcharacterdata/replacewith.xml b/reference/dom/domcharacterdata/replacewith.xml new file mode 100644 index 000000000000..be2d2e9b8f92 --- /dev/null +++ b/reference/dom/domcharacterdata/replacewith.xml @@ -0,0 +1,83 @@ + + + + DOMCharacterData::replaceWith + Replaces the character data with new nodes + + + + &reftitle.description; + + public voidDOMCharacterData::replaceWith + DOMNodestringnodes + + + Replaces the character data with new nodes. + + + + + + + + + &reftitle.examples; + + <methodname>DOMCharacterData::replaceWith</methodname> example + + Replaces the character data with new nodes. + + +loadXML(""); +$cdata = $doc->documentElement->firstChild; + +$cdata->replaceWith("beautiful", $doc->createElement("world")); + +echo $doc->saveXML(); +?> +]]> + + &example.outputs; + + +beautiful +]]> + + + + + + &reftitle.seealso; + + DOMChildNode::replaceWith + DOMCharacterData::after + DOMCharacterData::before + DOMCharacterData::remove + + + + + diff --git a/reference/dom/domchildnode/after.xml b/reference/dom/domchildnode/after.xml index b87abd96e7c5..1844c0a95244 100644 --- a/reference/dom/domchildnode/after.xml +++ b/reference/dom/domchildnode/after.xml @@ -25,6 +25,7 @@ Nodes to be added after the node. + Strings are automatically converted to text nodes. @@ -39,6 +40,14 @@ + + &reftitle.errors; + + &dom.errors.hierarchy.parent; + &dom.errors.wrong_document; + + + &reftitle.seealso; diff --git a/reference/dom/domchildnode/before.xml b/reference/dom/domchildnode/before.xml index 368c530d2430..236f14014471 100644 --- a/reference/dom/domchildnode/before.xml +++ b/reference/dom/domchildnode/before.xml @@ -25,6 +25,7 @@ Nodes to be added before the node. + Strings are automatically converted to text nodes. @@ -39,6 +40,14 @@ + + &reftitle.errors; + + &dom.errors.hierarchy.parent; + &dom.errors.wrong_document; + + + &reftitle.seealso; diff --git a/reference/dom/domchildnode/replacewith.xml b/reference/dom/domchildnode/replacewith.xml index bbadba4332d4..f94e40826a33 100644 --- a/reference/dom/domchildnode/replacewith.xml +++ b/reference/dom/domchildnode/replacewith.xml @@ -13,7 +13,6 @@ Replaces the node with new nodes. - A combination of DOMChildNode::remove and DOMChildNode::append. @@ -26,6 +25,7 @@ The replacement nodes. + Strings are automatically converted to text nodes. @@ -40,6 +40,14 @@ + + &reftitle.errors; + + &dom.errors.hierarchy.parent; + &dom.errors.wrong_document; + + + &reftitle.seealso; diff --git a/reference/dom/domdocument/adoptnode.xml b/reference/dom/domdocument/adoptnode.xml new file mode 100644 index 000000000000..1e97a51aa7b1 --- /dev/null +++ b/reference/dom/domdocument/adoptnode.xml @@ -0,0 +1,119 @@ + + + + DOMDocument::adoptNode + Transfer a node from another document + + + + &reftitle.description; + + public DOMNodefalseDOMDocument::adoptNode + DOMNodenode + + + Transfer a node from another document into the current document. + + + + + &reftitle.parameters; + + + + node + + + The node to transfer. + + + + + + + + + &reftitle.returnvalues; + + The node that was transfered, or &false; on error. + + + + + &reftitle.errors; + + + DOM_NOT_SUPPORTED_ERR + + + Raised if the node type is not supported for document transfers. + + + + + + + + &reftitle.examples; + + <methodname>DOMDocument::adoptNode</methodname> example + + Transfers the hello element from the first document to the second one. + + +loadXML(""); +$hello = $doc1->documentElement->firstChild; + +$doc2 = new DOMDocument; +$doc2->loadXML(""); +$doc2->documentElement->appendChild($doc2->adoptNode($hello)); + +echo $doc1->saveXML() . PHP_EOL; +echo $doc2->saveXML(); +?> +]]> + + &example.outputs; + + + + + + +]]> + + + + + + &reftitle.seealso; + + DOMDocument::importNode + + + + + diff --git a/reference/dom/domdocument/append.xml b/reference/dom/domdocument/append.xml new file mode 100644 index 000000000000..2a621b801c45 --- /dev/null +++ b/reference/dom/domdocument/append.xml @@ -0,0 +1,81 @@ + + + + DOMDocument::append + Appends nodes after the last child node + + + + &reftitle.description; + + public voidDOMDocument::append + DOMNodestringnodes + + + Appends one or many nodes to the list of children after the last child node. + + + + + + + + + &reftitle.examples; + + <methodname>DOMDocument::append</methodname> example + + Adds nodes after the document root. + + +loadXML(""); + +$doc->append("beautiful", $doc->createElement("world")); + +echo $doc->saveXML(); +?> +]]> + + &example.outputs; + + +beautiful + +]]> + + + + + + &reftitle.seealso; + + DOMParentNode::append + DOMDocument::prepend + + + + + diff --git a/reference/dom/domdocument/prepend.xml b/reference/dom/domdocument/prepend.xml new file mode 100644 index 000000000000..26d2ee3a7be1 --- /dev/null +++ b/reference/dom/domdocument/prepend.xml @@ -0,0 +1,82 @@ + + + + DOMDocument::prepend + Prepends nodes before the first child node + + + + &reftitle.description; + + public voidDOMDocument::prepend + DOMNodestringnodes + + + Prepends one or many nodes to the list of children before the first child node. + + + + + + + + + &reftitle.examples; + + <methodname>DOMDocument::prepend</methodname> example + + Adds nodes before the document root. + + +loadXML(""); + +$doc->prepend($doc->createElement("hello"), "beautiful"); + +echo $doc->saveXML(); +?> +]]> + + &example.outputs; + + + +beautiful + +]]> + + + + + + &reftitle.seealso; + + DOMParentNode::prepend + DOMDocument::append + + + + + diff --git a/reference/dom/domdocument/replacechildren.xml b/reference/dom/domdocument/replacechildren.xml new file mode 100644 index 000000000000..a31a0d002656 --- /dev/null +++ b/reference/dom/domdocument/replacechildren.xml @@ -0,0 +1,82 @@ + + + + DOMDocument::replaceChildren + Replace children in document + + + + &reftitle.description; + + public voidDOMDocument::replaceChildren + DOMNodestringnodes + + + Replaces the children in the document with new nodes. + + + + + + + + + &reftitle.examples; + + <methodname>DOMDocument::replaceChildren</methodname> example + + Replaces the children with new nodes. + + +loadXML(""); + +$doc->replaceWith("beautiful", $doc->createElement("world")); + +echo $doc->saveXML(); +?> +]]> + + &example.outputs; + + +beautiful + +]]> + + + + + + &reftitle.seealso; + + DOMParentNode::replaceChildren + DOMDocument::append + DOMDocument::prepend + + + + + diff --git a/reference/dom/domdocumentfragment/append.xml b/reference/dom/domdocumentfragment/append.xml new file mode 100644 index 000000000000..262ec46fa946 --- /dev/null +++ b/reference/dom/domdocumentfragment/append.xml @@ -0,0 +1,80 @@ + + + + DOMDocumentFragment::append + Appends nodes after the last child node + + + + &reftitle.description; + + public voidDOMDocumentFragment::append + DOMNodestringnodes + + + Appends one or many nodes to the list of children after the last child node. + + + + + + + + + &reftitle.examples; + + <methodname>DOMDocumentFragment::append</methodname> example + + Appends nodes in the fragment. + + +createDocumentFragment(); +$fragment->appendChild($doc->createElement("hello")); + +$fragment->append("beautiful", $doc->createElement("world")); + +echo $doc->saveXML($fragment); +?> +]]> + + &example.outputs; + +beautiful +]]> + + + + + + &reftitle.seealso; + + DOMParentNode::append + DOMDocumentFragment::prepend + + + + + diff --git a/reference/dom/domdocumentfragment/prepend.xml b/reference/dom/domdocumentfragment/prepend.xml new file mode 100644 index 000000000000..626edf014f6a --- /dev/null +++ b/reference/dom/domdocumentfragment/prepend.xml @@ -0,0 +1,80 @@ + + + + DOMDocumentFragment::prepend + Prepends nodes before the first child node + + + + &reftitle.description; + + public voidDOMDocumentFragment::prepend + DOMNodestringnodes + + + Prepends one or many nodes to the list of children before the first child node. + + + + + + + + + &reftitle.examples; + + <methodname>DOMDocumentFragment::prepend</methodname> example + + Prepends nodes before the fragment root. + + +createDocumentFragment(); +$fragment->appendChild($doc->createElement("world")); + +$fragment->prepend($doc->createElement("hello"), "beautiful"); + +echo $doc->saveXML($fragment); +?> +]]> + + &example.outputs; + +beautiful +]]> + + + + + + &reftitle.seealso; + + DOMParentNode::prepend + DOMDocumentFragment::append + + + + + diff --git a/reference/dom/domdocumentfragment/replacechildren.xml b/reference/dom/domdocumentfragment/replacechildren.xml new file mode 100644 index 000000000000..455be627111e --- /dev/null +++ b/reference/dom/domdocumentfragment/replacechildren.xml @@ -0,0 +1,83 @@ + + + + DOMDocumentFragment::replaceChildren + Replace children in fragment + + + + &reftitle.description; + + public voidDOMDocumentFragment::replaceChildren + DOMNodestringnodes + + + Replaces the children in the document fragment with new nodes. + + + + + + + + + &reftitle.examples; + + <methodname>DOMDocumentFragment::replaceChildren</methodname> example + + Replaces the children with new nodes. + + +loadXML(""); +$fragment = $doc->createDocumentFragment(); +$fragment->append("hello"); + +$fragment->replaceWith("beautiful", $doc->createElement("world")); + +echo $doc->saveXML($fragment); +?> +]]> + + &example.outputs; + + +]]> + + + + + + &reftitle.seealso; + + DOMParentNode::replaceChildren + DOMDocumentFragment::append + DOMDocumentFragment::prepend + + + + + diff --git a/reference/dom/domelement/after.xml b/reference/dom/domelement/after.xml new file mode 100644 index 000000000000..de644572204b --- /dev/null +++ b/reference/dom/domelement/after.xml @@ -0,0 +1,83 @@ + + + + DOMElement::after + Adds nodes after the element + + + + &reftitle.description; + + public voidDOMElement::after + DOMNodestringnodes + + + Adds the passed nodes after the element. + + + + + + + + + &reftitle.examples; + + <methodname>DOMElement::after</methodname> example + + Adds nodes after the hello element. + + +loadXML(""); +$container = $doc->documentElement; + +$container->after("beautiful", $doc->createElement("world")); + +echo $doc->saveXML(); +?> +]]> + + &example.outputs; + + + +beautiful + +]]> + + + + + + &reftitle.seealso; + + DOMChildNode::after + DOMElement::before + + + + + diff --git a/reference/dom/domelement/append.xml b/reference/dom/domelement/append.xml new file mode 100644 index 000000000000..e74d8fc2af6b --- /dev/null +++ b/reference/dom/domelement/append.xml @@ -0,0 +1,81 @@ + + + + DOMElement::append + Appends nodes after the last child node + + + + &reftitle.description; + + public voidDOMElement::append + DOMNodestringnodes + + + Appends one or many nodes to the list of children after the last child node. + + + + + + + + + &reftitle.examples; + + <methodname>DOMElement::append</methodname> example + + Appends nodes in the container element. + + +loadXML("hello "); +$world = $doc->documentElement; + +$world->append("beautiful", $doc->createElement("world")); + +echo $doc->saveXML(); +?> +]]> + + &example.outputs; + + +hello beautiful +]]> + + + + + + &reftitle.seealso; + + DOMParentNode::append + DOMElement::prepend + + + + + diff --git a/reference/dom/domelement/before.xml b/reference/dom/domelement/before.xml new file mode 100644 index 000000000000..51509481ea8d --- /dev/null +++ b/reference/dom/domelement/before.xml @@ -0,0 +1,82 @@ + + + + DOMElement::before + Adds nodes before the element + + + + &reftitle.description; + + public voidDOMElement::before + DOMNodestringnodes + + + Adds the passed nodes before the element. + + + + + + + + + &reftitle.examples; + + <methodname>DOMElement::before</methodname> example + + Adds nodes before the hello element. + + +loadXML(""); +$world = $doc->documentElement; + +$world->before("hello", $doc->createElement("beautiful")); + +echo $doc->saveXML(); +?> +]]> + + &example.outputs; + + + +]]> + + + + + + &reftitle.seealso; + + DOMChildNode::before + DOMElement::after + + + + + diff --git a/reference/dom/domelement/prepend.xml b/reference/dom/domelement/prepend.xml new file mode 100644 index 000000000000..790a45e183a7 --- /dev/null +++ b/reference/dom/domelement/prepend.xml @@ -0,0 +1,81 @@ + + + + DOMElement::prepend + Prepends nodes before the first child node + + + + &reftitle.description; + + public voidDOMElement::prepend + DOMNodestringnodes + + + Prepends one or many nodes to the list of children before the first child node. + + + + + + + + + &reftitle.examples; + + <methodname>DOMElement::prepend</methodname> example + + Prepends nodes in the container element. + + +loadXML(" world"); +$world = $doc->documentElement; + +$world->prepend($doc->createElement("hello"), "beautiful"); + +echo $doc->saveXML(); +?> +]]> + + &example.outputs; + + +beautiful world +]]> + + + + + + &reftitle.seealso; + + DOMParentNode::prepend + DOMElement::append + + + + + diff --git a/reference/dom/domelement/remove.xml b/reference/dom/domelement/remove.xml new file mode 100644 index 000000000000..986237b0e0f6 --- /dev/null +++ b/reference/dom/domelement/remove.xml @@ -0,0 +1,82 @@ + + + + DOMElement::remove + Removes the element + + + + &reftitle.description; + + public voidDOMElement::remove + + + + Removes the element. + + + + + + + + &reftitle.examples; + + <methodname>DOMElement::remove</methodname> example + + Removes the element. + + +loadXML(""); +$hello = $doc->documentElement->firstChild; + +$hello->remove(); + +echo $doc->saveXML(); +?> +]]> + + &example.outputs; + + + +]]> + + + + + + &reftitle.seealso; + + DOMElement::after + DOMElement::before + DOMElement::replaceWith + DOMNode::removeChild + + + + + diff --git a/reference/dom/domelement/replacechildren.xml b/reference/dom/domelement/replacechildren.xml new file mode 100644 index 000000000000..facdf5944b08 --- /dev/null +++ b/reference/dom/domelement/replacechildren.xml @@ -0,0 +1,85 @@ + + + + DOMElement::replaceChildren + Replace children in element + + + + &reftitle.description; + + public voidDOMElement::replaceChildren + DOMNodestringnodes + + + Replaces the children in the element with new nodes. + + + + + + + + + &reftitle.examples; + + <methodname>DOMElement::replaceChildren</methodname> example + + Replaces the children with new nodes. + + +loadXML(""); +$container = $doc->documentElement; + +$container->replaceWith("beautiful", $doc->createElement("world")); + +echo $doc->saveXML(); +?> +]]> + + &example.outputs; + + +beautiful + +]]> + + + + + + &reftitle.seealso; + + DOMParentNode::replaceChildren + DOMElement::replaceWith + DOMElement::after + DOMElement::before + DOMElement::remove + + + + + diff --git a/reference/dom/domelement/replacewith.xml b/reference/dom/domelement/replacewith.xml new file mode 100644 index 000000000000..7ce4ee0d6f55 --- /dev/null +++ b/reference/dom/domelement/replacewith.xml @@ -0,0 +1,84 @@ + + + + DOMElement::replaceWith + Replaces the element with new nodes + + + + &reftitle.description; + + public voidDOMElement::replaceWith + DOMNodestringnodes + + + Replaces the element with new nodes. + + + + + + + + + &reftitle.examples; + + <methodname>DOMElement::replaceWith</methodname> example + + Replaces the element with new nodes. + + +loadXML(""); +$cdata = $doc->documentElement->firstChild; + +$cdata->replaceWith("beautiful", $doc->createElement("world")); + +echo $doc->saveXML(); +?> +]]> + + &example.outputs; + + +beautiful +]]> + + + + + + &reftitle.seealso; + + DOMChildNode::replaceWith + DOMElement::replaceChildren + DOMElement::after + DOMElement::before + DOMElement::remove + + + + + diff --git a/reference/dom/domnamednodemap/getiterator.xml b/reference/dom/domnamednodemap/getiterator.xml new file mode 100644 index 000000000000..3ba7508fd8ce --- /dev/null +++ b/reference/dom/domnamednodemap/getiterator.xml @@ -0,0 +1,50 @@ + + + + DOMNamedNodeMap::getIterator + Retrieve an external iterator + + + + &reftitle.description; + + public IteratorDOMNamedNodeMap::getIterator + + + + Returns an external iterator for the named node map. + + + + + + + + + &reftitle.seealso; + + IteratorAggregate::getIterator + + + + + diff --git a/reference/dom/domnodelist/getiterator.xml b/reference/dom/domnodelist/getiterator.xml new file mode 100644 index 000000000000..c96b742d0b95 --- /dev/null +++ b/reference/dom/domnodelist/getiterator.xml @@ -0,0 +1,50 @@ + + + + DOMNodeList::getIterator + Retrieve an external iterator + + + + &reftitle.description; + + public IteratorDOMNodeList::getIterator + + + + Returns an external iterator for the node list. + + + + + + + + + &reftitle.seealso; + + IteratorAggregate::getIterator + + + + + diff --git a/reference/dom/domparentnode/append.xml b/reference/dom/domparentnode/append.xml index 2495efb19045..b0e27831b9f9 100644 --- a/reference/dom/domparentnode/append.xml +++ b/reference/dom/domparentnode/append.xml @@ -25,6 +25,7 @@ The nodes to append. + Strings are automatically converted to text nodes. @@ -39,6 +40,14 @@ + + &reftitle.errors; + + &dom.errors.hierarchy.self; + &dom.errors.wrong_document; + + + &reftitle.seealso; diff --git a/reference/dom/domparentnode/prepend.xml b/reference/dom/domparentnode/prepend.xml index c886b6b89253..8f3a66ad76ca 100644 --- a/reference/dom/domparentnode/prepend.xml +++ b/reference/dom/domparentnode/prepend.xml @@ -25,6 +25,7 @@ The nodes to prepend. + Strings are automatically converted to text nodes. @@ -39,6 +40,14 @@ + + &reftitle.errors; + + &dom.errors.hierarchy.self; + &dom.errors.wrong_document; + + + &reftitle.seealso; diff --git a/reference/dom/domparentnode/replacechildren.xml b/reference/dom/domparentnode/replacechildren.xml index fe4ac9962dd0..bfd21197e07f 100644 --- a/reference/dom/domparentnode/replacechildren.xml +++ b/reference/dom/domparentnode/replacechildren.xml @@ -25,6 +25,7 @@ The nodes replacing the children. + Strings are automatically converted to text nodes. @@ -39,6 +40,14 @@ + + &reftitle.errors; + + &dom.errors.hierarchy.self; + &dom.errors.wrong_document; + + + &reftitle.examples; diff --git a/reference/dom/versions.xml b/reference/dom/versions.xml index e75393343dcd..2c95ca18305e 100644 --- a/reference/dom/versions.xml +++ b/reference/dom/versions.xml @@ -12,10 +12,14 @@ + + + + @@ -30,7 +34,8 @@ - + + @@ -50,9 +55,11 @@ + + @@ -65,11 +72,17 @@ + + + + + + @@ -81,9 +94,13 @@ + + + + @@ -112,6 +129,7 @@ + @@ -148,6 +166,7 @@ +