Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在我的 Java 程序中使用 DOM Parser 解析 XML,它有一个元素节点,比如
<elemname attr1="value1" attr2="value2">
我想检查它是否与元素的字符串(xpath 排序)表示匹配,例如
elemname[@attr1="value1"]
字符串表示可能不具有实际节点中存在的所有属性,但是,它仍然应该是匹配的。
知道如何以更简单的方式实现这一目标吗?