Pass srcml unit _tree_ to file open methods
Closed this issue · 2 comments
e-shreve commented
Consider passing the srcml unit tree to file open so rules can use xpath searches if desired.
e-shreve commented
The existing element passed to the various xml visitors do provide an xpath method. However, the elements all have the full namespace which makes searches cumbersome. Either a helper map for the srcml namespaces could be provided or perhaps when parsing the SRCML output, the namespaces can be stripped prior to iterating over the tree. See the most popular answer (not the accepted answer) here: https://stackoverflow.com/questions/18159221/remove-namespace-and-prefix-from-xml-in-python-using-lxml