通过动作脚本中的关联xml进行交互时出现问题

时间:2018-09-24 13:52:06

标签: xml flash actionscript

我在html中嵌入了一个swf文件,它显示了从包含xml的URL加载的一些数据:

   a_xml = new AssociativeXML();
   a_xml.load("https://myURL.com");

链接包含具有以下结构的xml:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<parent>
    <infoblock>
       <block>
           <title>title</title> 
           <content>content</content> 
       </block>
      <block>
           <title>title</title> 
           <content>content</content> 
      </block>
    </infoblock>
    <body>
      <type>
         <typename>typename0</typename> 
         <content>
               <description>description</description> 
         </content>
      </type>
      <type>
         <typename>typename1</typename> 
         <content>
              <description>description</description>
         </content>
      </type>
      <others>others</others> 
    </body>
  </parent>

问题是Flash无法正确读取整个xml。我有一个动作脚本方法,该方法从xml中获取数据,如:

text = this.parent.infoblock.block[0].title.nodeValue

但是它卡在了第二个“类型”节点上,该节点以某种方式被读取为null,而flash则打印“未定义”。这是我的访问方式:

this.parent.body.type[0].typename.nodeValue // returns typename0
this.parent.body.type[1].typename.nodeValue //returns undefined

因此,flash可以读取xml的一半,而另一半则认为是空的。

有什么建议吗?谢谢!

0 个答案:

没有答案