我正在尝试为我的一个项目添加HTTP请求缓存功能,并考虑使用Etag作为哈希值。但是,如果没有Etag,我想使用有效负载来生成唯一的哈希值。我们都知道,相同的XML有效负载可能具有不同的结构。例如,示例A和示例B是相同的。但是它们的字符串结构不同。我需要的是一种从这两个XML示例中生成相同哈希键的方法。
示例A
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
示例 B
<note>
<to>Tove</to>
<heading>Reminder</heading>
<from>Jani</from>
<body>Don't forget me this weekend!</body>
</note>