StefH / XPath2.Net

Lightweight XPath2 for .NET
Microsoft Public License
36 stars 14 forks source link

render AST into string - possible enhancement? #62

Open vwegert opened 1 year ago

vwegert commented 1 year ago

For an upcoming project, I need to parse a set of existing XPath expressions, make some changes to individual parts (like renaming variable or function references), render the expression as a string again and replace the original. From my experiments, I believe that XPath2.Net will handle the parsing step just fine. I'd probably need some additional methods to make the changes and render the expression.

  1. Does this functionality already exist - did I miss something?
  2. If not - would you be interested in a PR with the additions once I'm done?
StefH commented 1 year ago

Hello @vwegert ,

  1. I don't know, I'll have to search the code.
  2. If this is just an addition, and will not break any functionality or decrease the test coverage, I will surely accept a PR.
vwegert commented 1 year ago

A quick update: I have examined the code further and have not found any provisions to render the AST back to string form. I've made some progress in that regard and am already able to render most of the AST elements. I'm currently struggling with the path elements - and I believe I have encountered an issue already covered in issue #7: parsing "/foo/bar" and "foo/bar" yields the exact same AST...