Note that there are some explanatory texts on larger screens.

plurals
  1. POActionScript 3 Parsing XML From Website
    text
    copied!<p>I have tried may example I found here and on the new (Google). Nothing seems to work.</p> <p>I have a XML file which I get after a call to a website:</p> <pre><code>&lt;?xml version="1.0" encoding="iso8859-1" ?&gt; &lt;Database version="1.24" xmlns="http://1234.com"&gt; &lt;Session&gt; &lt;Key&gt;1234&lt;/Key&gt; &lt;Count&gt;2424&lt;/Count&gt; &lt;SubExp&gt;Sun Dec 1 00:00:00 2013&lt;/SubExp&gt; &lt;GMTime&gt;Thu Feb 7 19:38:03 2013&lt;/GMTime&gt; &lt;Remark&gt;cpu: 0.058s&lt;/Remark&gt; &lt;/Session&gt; &lt;/Database&gt; </code></pre> <p>OK I loaded into a XML object like so:</p> <pre><code>var xml:XML = new XML(event.target.data); </code></pre> <p>Good so far the object contains the XML data:</p> <pre><code>&lt;Database version="1.24" xmlns="http://1234.com"&gt; &lt;Session&gt; &lt;Key&gt;1234&lt;/Key&gt; &lt;Count&gt;2424&lt;/Count&gt; &lt;SubExp&gt;Sun Dec 1 00:00:00 2013&lt;/SubExp&gt; &lt;GMTime&gt;Thu Feb 7 19:38:03 2013&lt;/GMTime&gt; &lt;Remark&gt;cpu: 0.058s&lt;/Remark&gt; &lt;/Session&gt; &lt;/Database&gt; </code></pre> <p>now I need to read the key value under session so I have tried :</p> <pre><code>xml.Session.Key xml.Session[0].Key xml[0].Session.Key </code></pre> <p>some of them returns a empty string some just errors either way no data?</p> <p>so in the Expression window I typed xml[0][0] just to see what happens.</p> <p>and it returns the key value, however when I place it in my code </p> <pre><code>var key:String = xml[0][0]; trace(key): </code></pre> <p>the trace returns the whole XML file? so I'm not sure what I might be missing?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload