Flex 4 E4X 按属性过滤具有未定义的变量
我有一些 xml,我正在尝试使用 e4x 过滤它。我的 e4x 语句如下所示:
model.config.source.fees..fee.(@min<amount).@amount
我的 xml 如下所示:
<flex>
<fees>
<fee type="credit" min="0.00" max="200.00" amount="6.00"/>
<fee type="credit" min="200.01" max="370.00" amount="10.00"/>
</fees>
</flex>
运行 e4x 语句时,我收到一条错误消息: 错误#1065:未定义变量@min。
但是,如果我将语句更改为 model.config.source.fees..fee.@min ,它将返回所有 min 属性值的 xmllist,所以至少在该声明中定义了 min 。为什么原来的声明不起作用?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您使用
@min 时,它要求所有费用节点都定义了 min 属性。它适用于您的示例 xml,但也许您在其他测试数据中缺少
@min
。但是,如果使用这种格式:
它将处理所有节点,无论该属性是否存在。
When you use
@min<amount
it requires that all fee nodes have the min attribute defined. It works for your example xml but maybe you were missing@min
in your other test data.However, if you use this format:
It will handle all nodes whether the attribute is there or not.