From 9c2a57c34c7cd842436b12bdae187e62b35b1caf Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Wed, 23 Oct 2024 20:05:47 +0200 Subject: [PATCH] Document DOMXPath::quote() --- reference/dom/domxpath/quote.xml | 127 +++++++++++++++++++++++++++++++ reference/dom/versions.xml | 1 + 2 files changed, 128 insertions(+) create mode 100644 reference/dom/domxpath/quote.xml diff --git a/reference/dom/domxpath/quote.xml b/reference/dom/domxpath/quote.xml new file mode 100644 index 000000000000..44f02ee14ed1 --- /dev/null +++ b/reference/dom/domxpath/quote.xml @@ -0,0 +1,127 @@ + + + + + DOMXPath::quote + + Quotes a string for use in an XPath expression + + + + + &reftitle.description; + + public static stringDOMXPath::quote + stringstr + + + Quotes str for use in an XPath expression. + + + + + &reftitle.parameters; + + + + str + + + The string to quote. + + + + + + + + + &reftitle.returnvalues; + + Returns a quoted string to be used in an XPath expression. + + + + + &reftitle.examples; + + Matching attribute value with quotes + +loadXML(<< + Book title + +XML); + +$xpath = new DOMXPath($doc); + +$query = "//book[@name=" . DOMXPath::quote("'quoted' name") . "]"; +echo $query, "\n"; + +$entries = $xpath->query($query); + +foreach ($entries as $entry) { + echo "Found ", $entry->textContent, "\n"; +} +?> +]]> + + &example.outputs; + + + + + Mixed quote types are also supported: + + + +]]> + + &example.outputs; + + + + + + + + &reftitle.seealso; + + + DOMXPath::evaluate + DOMXPath::query + + + + + diff --git a/reference/dom/versions.xml b/reference/dom/versions.xml index f9783f50e744..dca0ded27422 100644 --- a/reference/dom/versions.xml +++ b/reference/dom/versions.xml @@ -193,6 +193,7 @@ +