Encoding Values in DOMXPath Query Expressions
[email protected] (C Drozdowski) Mon, 14 Mar 2005 19:16:15 -0500
| Newsgroups | php.xml.dev |
|---|---|
| Message-ID | <200503141916153196%cd@earthlinknet> |
What is the best way to "encode" values passed to XPath expressions to ensure that they work correctly? For example, in the code below, what should I do to $value before incorporating it in the expression? htmlentities(), htmlspecialchars(), what? $query = "//book/chapter[name='$value']"; $xPath = new DOMXPath($domDoc); $nodeList = $xPath->query($query); Thanks in Advance for any help given.