Simplier and more generic parsing using XPath #1626
manticore-projects
started this conversation in
Ideas
Replies: 4 comments 1 reply
|
Querying specifically using a full XPath: // return only the C column based on the complete XPath
columns = JSQLFormatter.extract(sqlString, Column.class, "/Statements/selectBody/where/rightExpression/Column[2]");
for (Column column: columns) {
System.out.println("Found specific column by complete XPath: " + column);
} |
0 replies
|
As I said, cool. Any reason why you do not use https://commons.apache.org/proper/commons-jxpath/? Or do you use it? When I needed something like that it worked for me. Could we integrate this in JSqlParser itself? |
1 reply
|
Actually, you are right that we should keep JSqlParser jar independent from third party libs. And you are right, JXPath is quite an old lad. ;) Still it works. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
Example SQL
Can be simply queried via XPath:
Output
Based on the Parsed Object Tree:
I believe this was a much easier way to quickly query or access Objects of a SQL statement instead of writing the Listeners.
The code above works nicely in JSQLFormatter already -- do we want to port it into JSQLParser directly?
All reactions