Encoding Values in DOMXPath Query Expressions

From: Date: Tue, 15 Mar 2005 00:16:15 +0000
Subject: Encoding Values in DOMXPath Query Expressions
Groups: php.xml.dev 
Request: Send a blank email to php-xml-dev+get-546@lists.php.net to get a copy of this message
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.

« previous php.xml.dev (#546) next »