使用 RestFixture 解析 Xhtml 严格文档

发布于 2024-09-10 05:28:36 字数 533 浏览 3 评论 0原文

我有一个像这样的xpath //xhtml:title[text()='Page Title']

并且从 RestFixture 收到错误,读取

java.lang.IllegalArgumentException: Cannot extract xpath '//xhtml:title[text='Page Title']' from文档

当我删除 从文档和 xhtml 命名空间从 xpath 字符串它工作正常。

当我在命令行上使用 4xpath 执行 xpath 查询时,除非指定 --namespace=xhtml=http://www.w3.org/1999/xhtml 切换并在 xpath 字符串中包含命名空间说明符。

我想问题是,是否有办法使用 RestFixture 指定名称空间,或者是否需要执行任何黑魔法才能让 xpath 在 xhtml 严格文档上与 RestFixture 一起使用?

I have an xpath like
//xhtml:title[text()='Page Title']

and am getting an error from RestFixture that reads

java.lang.IllegalArgumentException: Cannot extract xpath '//xhtml:title[text='Page Title']' from the document

When I remove the

from the document and the xhtml namespace from the xpath string it works fine.

When I do an xpath query with 4xpath on the command line it does not work unless I specify the --namespace=xhtml=http://www.w3.org/1999/xhtml switch and include the namespace specifier in the xpath string.

I guess the question is, is there anyway to specify the namespace with RestFixture or is there any black magic that needs to be done to get xpath to work with RestFixture on a xhtml strict document?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寒尘 2024-09-17 05:28:36

我在最新版本的 RestFixture 中添加了对命名空间的支持。在这里查看:http://smartrics.blogspot.com/ 2011/01/restfixture-with-namespaces-support.html

I have added support for namespaces in the latest version of the RestFixture. Check it out here: http://smartrics.blogspot.com/2011/01/restfixture-with-namespaces-support.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文