Simple XML parsing with Google Picasa API and JQuery

Posted by zeedog on Stack Overflow See other posts from Stack Overflow or by zeedog
Published on 2011-02-06T23:17:58Z Indexed on 2011/02/06 23:25 UTC
Read the original article Hit count: 252

Filed under:
|
|
|

I'm starting to look into Google's Picasa API for photo data, which provides you with a big XML file with info about albums and photos.

I'm doing some quick and dirty tests to parse the XML file (which is saved locally to my hard drive for now) with JQuery and pull out the album id's, which are stored as "gphoto:id" tags, and display them in a div:

$(document).ready(function() {
$.get(
    'albums.xml',
    function(data) 
    {
        $(data).find('entry').each(function() 
        {
            var albumId = $(this).children('gphoto:id').text();
            $('#photos').append(albumId + '<br />');
        })
    })
})

I'm getting the following error in the console:

jquery.js:3321 - Uncaught Syntax error, unrecognized expression: Syntax error, unrecognized expression: id

This will work with other tags in the XML file (such as title, author, updated, etc.), but I'm trying to understand what's going on here. Does it have to do with the colon in "gphoto:id", somehow?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about Xml