Phil Weighill-Smith wrote:
In this case, why not use:

...(root, "child::[EMAIL PROTECTED]'\"value'/@name");

Because the xpath is created dynamically. And even though a " quote can be detected first, it still does not help if both a " and a ' is contained in the value.


How do I escape special characters in xpath to match attribute values?

For example

Document doc = new DocumentImpl();
Element root = doc.createElement("root");
doc.appendChild(root);
Element child = doc.createElement("element");
child.setAttribute("name","\"value");
root.appendChild(child);
Node node = XPathAPI.selectSingleNode(root,"child::[EMAIL PROTECTED]""value\"]/@name");


The node will be null, so this is not the right way. What is?


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to