我有一个像这样返回 XML 的 REST 端点(XML 当然更大,比如大约 10,000 个数据块,而我在本示例中显示的 3 个块):
<?xml version="1.0"?>
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications with XML.</description>
</book>
<book id="bk102">
<author>Ralls, Kim</author>
<title>Midnight Rain</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-12-16</publish_date>
<description>A former architect battles corporate zombies, an evil sorceress, and her own childhood to become queen of the world.</description>
</book>
<book id="bk103">
<author>Corets, Eva</author>
<title>Maeve Ascendant</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-11-17</publish_date>
<description>After the collapse of a nanotechnology society in England, the young survivors lay the foundation for a new society.</description>
</book>
</catalog>
现在我想根据某些标签值动态过滤它,并只保留 tag=value 的块(然后将其转换为对象)。对于这个例子,我想只保留genre=Fantasy 的书籍,并将字段价格、标题和作者转换为我的BookInfo 对象。我想避免创建 xml 解析器。我可以用 JOOX 做吗?