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 @@ +