gpt4 book ai didi

java - 衡量 HTML 等效性?

转载 作者:行者123 更新时间:2023-11-28 00:30:26 25 4
gpt4 key购买 nike

我想知道是否有人知道一个好的 Java 库可以用来衡量 HTML 等效性?

例如<td class="one two three" name="goat">相当于 <td name="goat" class="three two one"> .我想使用 Java 以这种方式比较整个多行 html 字符串。

有什么建议吗?

更新:

所以我尝试使用 XmlUnit 的 Diff.similar() 并发现我发现这两个是相似的:

<html three="3" two="2" one="1"></html><html one="one" two="two"></html>

这是不受欢迎的行为...还有其他选择吗?

最佳答案

您可以使用像 NekoHTML 这样的 html 解析器或 JTidy , 然后使用 DiffXMLUnit比较两个 XML 文档。

关于java - 衡量 HTML 等效性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2149049/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com