# Xml parsing problems... big big problems :(

**URL:** https://forum.kirupa.com/t/xml-parsing-problems-big-big-problems/291896
**Category:** Uncategorized
**Created:** [July 7, 2009, 9:33am UTC](https://forum.kirupa.com/t/xml-parsing-problems-big-big-problems/291896 "2009-07-07T09:33:25Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![chaudiovisual](https://avatars.discourse-cdn.com/v4/letter/c/7ea924/32.png) [@chaudiovisual](https://forum.kirupa.com/u/chaudiovisual)
#### Post date: [July 7, 2009, 9:33am UTC](https://forum.kirupa.com/t/xml-parsing-problems-big-big-problems/291896/1 "2009-07-07T09:33:25Z")

</div>

I am having a problem parsing xml data, I know how to get it into as3, and that is working pretty well after following a brilliant tutorial on kirupa: [http://www.kirupa.com/developer/flashcs3/using\_xml\_as3\_pg1.htm](http://www.kirupa.com/developer/flashcs3/using_xml_as3_pg1.htm)

But I am having a problem tracing the data that I want. Seemingly it is connecting to the database and is working in that sense but when I try to trace data I am getting a couple problems.

The first is that I need to somehow specify a value of a single item to get the rest of the data. Here is the xml:

**XML Code**  
\<user\>  
\<name\>{$line[“name”]}\</name\>  
\<id\>{$line[“id”]}\</id\>";

$query2 = “select \* from circle where owner={$line[“id”]};”;  
$result2 = mysql\_query($query2) or die("Query failed2 : " . mysql\_error());  
while ($line2 = mysql\_fetch\_array($result2, MYSQL\_ASSOC))

print "

\<circle\>  
\<id\>{$line2[“id”]}\</id\>  
\<name\>{$line2[“name”]}\</name\>  
\<ordinal\>{$line2[“ordinal”]}\</ordinal\>  
\<pref\>{$line2[“pref”]}\</pref\>  
\<colour\>{$line2[“colour”]}\</colour\>  
\<comment\>{$line2[“comment”]}\</comment\>

\<question\>{$line2[“question”]}\</question\>  
\<comment\_viewed\>{$line2[“comment\_viewed”]}\</comment\_viewed\>  
\<question\_viewed\>{$line2[“question\_view”]}\</question\_viewed\>  
\</circle\>";

print “\</user\>”;

Now it seems that I need to input an ID for the user to be able to trace their circles/information so I tried using this as3 code to do this:

**AS3 Code**  
var xmlLoader:URLLoader = new URLLoader();  
var xmlData:XML = new XML();

xmlLoader.addEventListener(Event.COMPLETE, LoadXML);  
xmlLoader.load(new URLRequest(“[http://www.chaudiovisual.com/testing/show-user.php](http://www.chaudiovisual.com/testing/show-user.php)”));

function LoadXML(e:Event):void  
{  
xmlData = new XML(e.target.data);  
Parse(xmlData);  
//trace(xmlData);  
}

function Parse(parse:XML):void  
{  
trace(“XML Output”);  
trace("------------------------");  
var userList:XMLList = parse.user;  
for each (var userElement:XML in userList)  
{  
trace(userElement);  
if (userElement.text() == 1)  
{  
trace(userElement.circle);  
}  
}  
}

Can anyone help me out here?

Thanks in advance,  
Conor
