【问题标题】:Flex/Actionscript - "class" XML attribute name error when parsing to ArrayCollectionFlex/Actionscript - 解析为 ArrayCollection 时出现“类”XML 属性名称错误
【发布时间】:2016-01-30 18:34:27
【问题描述】:

我正在尝试使用 Flex 4 和 Actionscript 将 XML 响应事件转换为 ArrayCollection。

问题是我无法控制输出 XML HTTP 响应,并且其中一个属性是名称“类”,所以我在尝试访问对象时遇到错误

动作脚本代码:

protected var products:ArrayCollection;

protected function service_resultHandler(event:ResultEvent):void
{
    products = event.result.oxip.response.class.type.market; 
}

【问题讨论】:

  • 完全不清楚你在问什么。

标签: xml actionscript-3 apache-flex flex4


【解决方案1】:

当属性名称为reserved word 时,您只能使用array bracket access 访问它们。例如:

products = event.result.oxip.response["class"].type.market;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-07-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多