开发者

How can I parse an XML file and put it into a JavaScript array in AIR?

I am currently doing an A level computing project, in which I need to parse XML and put the elements into an array. I am using JavaScript in Dreamweaver and the final application will be run in AIR. I am having a hard time understanding the code in this answer to another question: XML parsing of a variable string in JavaScript

How would I adapt that code to put an XML file chosen by the user into an array, and would it work in AIR?

This is the structure of the XML I want to use:

<node id="0">
 <nodetype>0</nodetype>
 <connectedto>2,3</connectedto>
 <distanceto>10开发者_开发知识库,5</distanceto>
</node>

The structure of the array is:

Node | Type | ConnectedTo | DistanceTo
  1  |  0   |     2       |    10
  1  |  0   |     3       |     5

Thanks in advance for any help.


AIR uses WebKit render engine, so you should stick to the webkit implementation details when parsing XML. Here is the link to the explanation of the parsing and reading XML in Webkit.

http://www.insideria.com/2008/04/adobe-air-webkit-and-xml.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜