Pring parsed Expressions?
Added by Anonymous about 17 years ago
Legacy ID: #4620529 Legacy Poster: Ole Lensmar (omatzura)
Hi there! I'm parsing my xpath expressions using the ExpressionParser and wonder if it somehow possible to "serialize" the parsed expression back to an xpath/expression string? thanks for any advice! regards, /Ole eviware.com
Replies (4)
Please register to reply
RE: Pring parsed Expressions? - Added by Anonymous about 17 years ago
Legacy ID: #4620536 Legacy Poster: Ole Lensmar (omatzura)
and obviously the title should have been "Print parsed Expressions?".. I haven't got to the pringing yet.. :-) /Ole eviware.com
RE: Pring parsed Expressions? - Added by Anonymous about 17 years ago
Legacy ID: #4620614 Legacy Poster: Michael Kay (mhkay)
The toString() method on Expression attempts to give an approximation to the original expression which will often be good enough for diagnostics, but there is no guarantee that it will always give a result that is valid XPath syntax. One of the problems of course is namespace context.
RE: Pring parsed Expressions? - Added by Anonymous about 17 years ago
Legacy ID: #4620634 Legacy Poster: Ole Lensmar (omatzura)
Thanks Michael, Basically what I want to do is refactor the names of arbitrary elements/attributes that are referenced in an xpath-expression (in NameTests, etc), so I was thinking in the line of: 1) parse the xpath into an Expression using an empty NamePool 2) find the QName(s) i need to change in the populated NamePool and change them (maybe I'll need to create my own namepool for making this possible) 3) serialize the Expression back -> the new expression has the updated names.. it's a bit of a hack.. the serialization in (3) needs to generate an xpath-expression equivalent to the orginial one (except for the changed names of course).. any ideas would be really helpful, thanks for your advice already.. regards! /Ole eviware.com
RE: Pring parsed Expressions? - Added by Anonymous about 17 years ago
Legacy ID: #4620746 Legacy Poster: Ole Lensmar (omatzura)
Hi again, I found another way to solve this that works just fine.. thanks for taking your time! regards, /Ole eviware.com
Please register to reply