views:

281

answers:

1

Hi, 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: http://stackoverflow.com/questions/649614/xml-parsing-in-javascript/649928#649928

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.

+1  A: 

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

nemisj
Thanks, I solved this problem by avoiding this method completely.I did get the XML parsing to work, though.
rikkit

related questions