Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Data Integration / February 2006



Tip: Looking for answers? Try searching our database.

XML Parsing NOT Working - Path Issues

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Airedalez - 24 Feb 2006 19:51 GMT
I am trying to parse some XML of photos from Flickr. This is the xml that gets
returned when I load it:
<?xml version="1.0" encoding="utf-8" ?>
<rsp stat="ok">
    <photos page="1" pages="94" perpage="10" total="937">
        <photo id="95398437" owner="31524827@N00" secret="bde8208452" server="22"
title="Ocean Geyser" ispublic="1" isfriend="0" isfamily="0" />
        <photo id="95176129" owner="31524827@N00" secret="cd3e392e3c" server="21"
title="Flower-Waterfall" ispublic="1" isfriend="0" isfamily="0" />
        <photo id="95176128" owner="31524827@N00" secret="9a061efb1f" server="21"
title="Canyon-Sunrise" ispublic="1" isfriend="0" isfamily="0" />
        <photo id="90008250" owner="31524827@N00" secret="afdb32e098" server="26"
title="Adam On the Mountain!" ispublic="1" isfriend="0" isfamily="0" />
        <photo id="90008249" owner="31524827@N00" secret="98d13b240e" server="25"
title="Adam On the Chair Lift" ispublic="1" isfriend="0" isfamily="0" />
        <photo id="90006085" owner="31524827@N00" secret="cb32ce55f0" server="38"
title="Mountains" ispublic="1" isfriend="0" isfamily="0" />
        <photo id="90006084" owner="31524827@N00" secret="9b41a3c118" server="39"
title="Adam!" ispublic="1" isfriend="0" isfamily="0" />
        <photo id="90006083" owner="31524827@N00" secret="6797eeeaeb" server="39"
title="Mountain Peaks" ispublic="1" isfriend="0" isfamily="0" />
        <photo id="90006082" owner="31524827@N00" secret="c4975d34b3" server="41"
title="Mountain View" ispublic="1" isfriend="0" isfamily="0" />
        <photo id="90006081" owner="31524827@N00" secret="cf291435bb" server="35"
title="Four of Us - More Mountain View" ispublic="1" isfriend="0" isfamily="0"
/>
    </photos>
</rsp>

I have attached my code below. I would think that using:
this.firstChild.firstChild.childNodes would return an array of the photo
element. For some reason it doesn't and I have no clue as to why. When I browse
through the debugger and look at myXML, the structure does not seem to match
the actual XML structure. Anyone know why? Could someone please help me out
with this?

var testarray:Array = Array();
   function init () {
    testarray = this.firstChild.firstChild.childNodes;
    trace(this);
   }
   var myXML:XML = new XML();
   myXML.onLoad = init;
   
myXML.load("http://www.flickr.com/services/rest/?method=flickr.people.getpublicp
hotos&api_key=852926b3827e18d90e6c29f205a0c8b3&user_id=31524827@N00&per_page=10&
page=1");
   myXML.ignoreWhite;
perry - 27 Feb 2006 07:26 GMT
myXML.ignoreWhite = true;

must be BEFORE the
myXML.load(...)

> I am trying to parse some XML of photos from Flickr. This is the xml that gets
> returned when I load it:
>  <?xml version="1.0" encoding="utf-8" ?>
>  <rsp stat="ok">
>   <photos page="1" pages="94" perpage="10" total="937">
>   <photo id="95398437" owner="31524827@N00" secret="bde8208452"
server="22"
> title="Ocean Geyser" ispublic="1" isfriend="0" isfamily="0" />
>   <photo id="95176129" owner="31524827@N00" secret="cd3e392e3c"
server="21"
> title="Flower-Waterfall" ispublic="1" isfriend="0" isfamily="0" />
>   <photo id="95176128" owner="31524827@N00" secret="9a061efb1f"
server="21"
> title="Canyon-Sunrise" ispublic="1" isfriend="0" isfamily="0" />
>   <photo id="90008250" owner="31524827@N00" secret="afdb32e098"
server="26"
> title="Adam On the Mountain!" ispublic="1" isfriend="0" isfamily="0" />
>   <photo id="90008249" owner="31524827@N00" secret="98d13b240e"
server="25"
> title="Adam On the Chair Lift" ispublic="1" isfriend="0" isfamily="0" />
>   <photo id="90006085" owner="31524827@N00" secret="cb32ce55f0"
server="38"
> title="Mountains" ispublic="1" isfriend="0" isfamily="0" />
>   <photo id="90006084" owner="31524827@N00" secret="9b41a3c118"
server="39"
> title="Adam!" ispublic="1" isfriend="0" isfamily="0" />
>   <photo id="90006083" owner="31524827@N00" secret="6797eeeaeb"
server="39"
> title="Mountain Peaks" ispublic="1" isfriend="0" isfamily="0" />
>   <photo id="90006082" owner="31524827@N00" secret="c4975d34b3"
server="41"
> title="Mountain View" ispublic="1" isfriend="0" isfamily="0" />
>   <photo id="90006081" owner="31524827@N00" secret="cf291435bb"
server="35"
> title="Four of Us - More Mountain View" ispublic="1" isfriend="0" isfamily="0"
> />
[quoted text clipped - 15 lines]
>     var myXML:XML = new XML();
>     myXML.onLoad = init;

myXML.load("http://www.flickr.com/services/rest/?method=flickr.people.getpub
licp

hotos&api_key=852926b3827e18d90e6c29f205a0c8b3&user_id=31524827@N00&per_page
=10&
> page=1");
>     myXML.ignoreWhite;
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.