Xpath in Cpp runtime - Has anyone managed to use it ?

36 views
Skip to first unread message

Malo 35

unread,
Nov 23, 2017, 10:25:24 AM11/23/17
to antlr-di...@googlegroups.com
Hi,

I'm trying to use the Xpath feature of ANTLR4 to visit children of a node in c++.

With the C# Runtime, it works like a charm. The code I use is similar to this one to look for a specific path :

            string xpath_enum = @"*//enumerator/Identifier";
           
var result = XPath.FindAll(context, xpath_enum , _parser);

Now, I'm trying to achieve the same with the cpp runtime but it doesn't work.

I'm using the following code:

             const std::string xpath_enum = "*//enumerator/Identifier";
             antlr4
::tree::xpath::XPath finder(_parser, xpath_enum);
             std
::vector<antlr4::tree::ParseTree *>subtrees = finder.evaluate(context);



First, I noticed that there was a bug in Xpath constructor and  I have sent a pull request  to fix it.

However, despite this fix, the code always returns an empty tree. It seems that the evaluate function does not work.

Has anyone managed to use Xpath in Cpp ?

Many thanks,

Malick


Reply all
Reply to author
Forward
Message has been deleted
0 new messages