I can’t correctly parse this XML in AS3
I’m using a Facebook API with AS3, so its fetching data from a MySQL and sending it back as a XML. I’m using the Photos_get method with Facebook API. It returns to Flash the XML documented below.
<photos_get_response xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd" list="true" xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<photo>
<pid>350901787346009679</pid>
<aid>350901787317680884</aid>
<owner>81700689</owner>
<src>http://photos-d.ak.facebook.com/photos-ak-sctm/v170/20/52/81700689/s81700689_30342735_3712.jpg</src>
<src_big>http://photos-d.ak.facebook.com/photos-ak-sctm/v170/20/52/81700689/n81700689_30342735_3712.jpg</src_big>
<src_small>http://photos-d.ak.facebook.com/photos-ak-sctm/v170/20/52/81700689/t81700689_30342735_3712.jpg</src_small>
<link>http://www.facebook.com/photo.php?pid=30342735&id=81700689</link>
<caption>kitty</caption>
<created>1200793123</created>
</photo>
<photo>
<pid>350901787346009680</pid>
<aid>350901787317680884</aid>
<owner>81700689</owner>
<src>http://photos-a.ak.facebook.com/photos-ak-sctm/v170/20/52/81700689/s81700689_30342736_3866.jpg</src>
<src_big>http://photos-a.ak.facebook.com/photos-ak-sctm/v170/20/52/81700689/n81700689_30342736_3866.jpg</src_big>
<src_small>http://photos-a.ak.facebook.com/photos-ak-sctm/v170/20/52/81700689/t81700689_30342736_3866.jpg</src_small>
<link>http://www.facebook.com/photo.php?pid=30342736&id=81700689</link>
<caption>doggy</caption>
<created>1200793123</created>
</photo>
</photos_get_response>
When you try to use the XML properties in AS3, its not correctly identifying nodes.
Usually just taking the result and assigning it as a XMLList does the trick, but I have realized that doesn’t work with complex XML structures.
Has anybody else had this issue? And knows how to fix it?
I have put a attachment of the file so you can see the issue for youself.
For example if you load the file in AS3, then for example only want to get the ‘src_big’ child values with a
trace(photos.src_big);
It will return nothing or just return the whole photo child if you try to retrieve it from a XMLList