【发布时间】:2017-06-27 23:32:09
【问题描述】:
考虑到下面的 XML 结构,我如何获取/打印与给定 xpath 匹配的相应 DOM 结构。
<foo>
<foo1>Foo Test 1</foo1>
<foo2>
<another1>
<test1>Foo Test 2</test1>
</another1>
</foo2>
<foo3>Foo Test 3</foo3>
<foo4>Foo Test 4</foo4>
</foo>
对于 xpath /foo/foo2 来说,输出应该类似于
<another1>
<test1>Foo Test 2</test1>
</another1>
【问题讨论】:
-
您看过一些用于 Java 的 XPath API 吗?教程很多
标签: java html xml python-3.x xpath