" is a way of representing a double-quotes character in an
XML document. You're not in an XML document, so it has no meaning -
other than the sequence of six characters &,q,u,o,t,;.
You're inside an XPath string literal delimited by double quotes.
Within such a string literal, the way to represent a double-quotes
character is with two adjacent double-quotes. You're also within a
Java string literal, which means that each of these has to be
escaped as \" for Java's benefit. So you want
String query =
"//document[path=\"/rootNode[itg:fts(.,'\"\"information to
find\"\"')]\"]";
Michael Kay
Saxonica
On 24/11/2010 02:11, Todd Gochenour wrote:
I have logic that maintains the current xpath of a
series of documents:
<documents>
<document>
<path>/rootNode[itg:fts(.,' "information to find"
')]</path>
</document>
...
</documents>
where itg:fts() is a full text search and the double-quotes in the
search string serves to designate a phrase to search instead of
tokens.
I want to find the particular document element by matching on the
value of path with this evaluation:
String query =
"//document[path=\"/rootNode[itg:fts(.,'"information to
find"')]\"]";
NodeList nodes = (NodeList)
xpath.evaluate(query,documents,XPathConstants.NODESET);
but the evaluation returns no nodes. I'm expecting the entity
" to match the literal double-quote in the element path.
It doesn't seem to work. There are literal quotes also in the
predicate of the string. Any ideas how to solve this?
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help