Open byteface opened 2 years ago
I found a lib that might be able to handle this. initial test seems to work. could be a fluke. if the Node class imitates etree Element seemed to do a match. https://github.com/sissaschool/elementpath
there's now an xpath branch. if it can pass a few more tests it should probably be included.
Does mean all of xpath needs stubbing out in webapi
elementpath now part of 8.4
the webapi will wrap it and have 2 options..
fix non underscore based accessors on attributes. or add the underscore to any '@' symbols inthe contructor of the XPATH expression. this will resolve the current bug that attributes still require the underscore even in the xpath xpression. it works fine but users won't know or expect that. so means fixing the bigger issue of attr lookups in the __get... dunders.
on the terminal i noticed you have to wrap the 2nd param in quotes as some chars bork... i.e...
domonic -x https://www.reddit.com/r/Python/ '//a[contains(@href, "http")]/@href'
I haven't even started to look into this. But figured i'd see if this 'up for grabs' label is worth trying.
https://up-for-grabs.net/#/
if anyone want to try xpath integration. Is there something in standard lib?. another small lib that works already with domonic? figured i'd start a discussion.