0

I am fetching some XML from Flickr and want to parse it based on DOM. can't get my code to work with the following:

...
if (this.responseXML != null)
    {
        content = this.responseText.getElementsByTagName('content')
        for (i = 0 ; i < content.length ; i++)
        {
            out += content[i].childNodes[0].nodeValue + '<br />'
        }
        document.getElementById('info').innerHTML = out
        }
...

this however returns the full content of the call:

...
if (this.responseXML != null)
    {
        document.getElementById('info').innerHTML =
            this.responseText
            }
...

which leads me to think that my AJAX code is correct but that i'm doing something wrong in the parsing code

Note: this is related another post althought he problem is a different one

Community
  • 1
  • 1

1 Answers1

0

The problem seems to be that you're given a string rather than an XML DOM object. In order to create a XML DOM Object, you'll need to parse the XML string. This stackoverflow thread has some good code and discussion as to what the best way to parse the XML might be.

Community
  • 1
  • 1
NT3RP
  • 15,262
  • 9
  • 61
  • 97
  • Hi Nicholas, please have a look at my related post for a better idea of where i'm coming from: http://stackoverflow.com/questions/5359056/ajax-phpget-parameters-causing-flickr-api-key-error –  Mar 19 '11 at 01:28