I am using the org.apache.xpath Java package to take in XPath expressions in text form from a file, transform them with a XPathVisitor, and emitting them again as text. (This replaces an older solution that used regexes and was not flexible enough.)

I have had no difficulty with parsing the input into an XPath object and transforming it, but I cannot figure out how to print out the transformed XPath (or the Expression inside it).

* Using XPath().getPatternString() returned the original string I read in, not a string that represented the transformed xpath.
 *  toString() returns the usual Java "ClassName @ location" string.
* Writing my own Expression-to-String functions looks daunting, due to the large number of classes that it would have to understand.

Is there an existing stringifying method or a stringifying XPathVisitor available anywhere? Or is this a totally unsuitable library for my task? If so, can anyone suggest a suitable replacement?

--
src/

Reply via email to