e4x 多个类别标签之间的 XML 过滤

发布于 2024-10-04 02:32:13 字数 454 浏览 7 评论 0原文

我使用 FLEX 和 e4x 来解析 XML。 XML 如下所示:

我能够根据标签值进行基本过滤。
但现在我需要过滤可以有多个类别的项目。我尝试了以下操作:

<item>
  <id>12345</id>
  <category>housing</category>
  <category>finances</category>
  <category>recreation</category>
</item>

xml..item(category=='housing');

这只返回那些仅具有“住房”类别的项目的结果。
如果该商品有其他类别,则不会被识别为有效商品。

我该怎么做?

亲切的问候, 巴特

I'm using FLEX and e4x to parse through XML. And the XML looks as follows:

I am able to do basic filtering based on tag value.
But now I need to filter over items that can have multiple categories. I tried the following:

<item>
  <id>12345</id>
  <category>housing</category>
  <category>finances</category>
  <category>recreation</category>
</item>

xml..item(category=='housing');

This only returns a result on those items that have ONLY 'housing' as a category.
If the item has other categories, it will not be recognized as a valid item.

How do I do this?

kind regards,
bart

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小嗲 2024-10-11 02:32:13

好的,我找到了。
使用.contains(),如下所示:

xml.(category.contains('housing'));

OK, I found it.
Use .contains() as follows:

xml.( category.contains('housing') );

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文