goto100 / xpath

DOM 3 Xpath implemention and helper for node.js
MIT License
223 stars 71 forks source link

An example of using it with regular HTML? #115

Closed OnkelTem closed 1 year ago

OnkelTem commented 2 years ago

Please could you provide an example of using it with HTML? Specifically, is there a way to go with default namespacing? The documentation section on this is missied.

JLRishe commented 2 years ago

We don't have documentation on this, but you can evaluate XPaths in HTML mode by using a parsed expression and passing isHtml: true when evaluating it.

See example here:
https://github.com/goto100/xpath/issues/27#issuecomment-1041378729

This would allow you to use XPath on an HTML document without namespace prefixes.