支持python中XPath 2.0的库
是否可以在Python中使用XPATH 2.0函数,例如starting-with()
, end-with() and contectains()?我试图使用lxml
和defusedxml
,但不幸的是它们不支持这些功能。
我知道我可以使用substring()
或matches()
用于解决方法,但是我确实很复杂,因此处理更可读的功能会更好。
任何支持XPath 2.0规格的LIB吗?
Is it possible to use XPath 2.0 functions like starts-with()
, ends-with()
and contains()
in Python? I was trying to use lxml
and defusedxml
, but unfortunately they do not support any of these functions.
I know I can use substring()
or matches()
for workaround, but I have really complicated case, so it would be nicer to deal with more readable functions.
Any lib that supports XPath 2.0 spec?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用 elementpath 为此,它支持内置的XML.Etree模块,这可能是最容易的。和LXML。
It's probably easiest to use elementpath for this, which supports the built-in xml.etree module and lxml.
saxonpy 基于Saxon He,并支持XPATH 2.0。
您可以检查GitHub存储库以获取一些示例以使您入门:
https://github.com/github.com/github.com/tennom/saxonm/saxonpy < /a>
saxonpy is based on Saxon He and supports Xpath 2.0.
You can check the github repo for some examples to get you started:
https://github.com/tennom/saxonpy
Saxonc 12.x的Python车轮是官方版本,您可以在此处找到: https> https:// pypi。 org/user/saxonica/
The python wheels for SaxonC 12.X is the official release, which you can find here: https://pypi.org/user/saxonica/