Namespace difficulties

0 views
Skip to first unread message

Michael Harrison

unread,
May 7, 2007, 12:37:10 AM5/7/07
to GData Python Client Library Contributors
Hello,

When I execute a query against my items feed using the Python client,
the resulting XML looks like the following:

<ns0:feed>
<ns1:totalResults>4</ns1:totalResults>
<ns1:itemsPerPage>25</ns1:itemsPerPage>
<ns1:startIndex>1</ns1:startIndex>
<ns0:entry>
....
....

When I try to parse the results using libxml2, I get an error that the
prefix 'ns0' is not bound to a namespace. I've looked through the
various GData documentation sites and have been unable to find how to
deal with this issue. Is there any reason why the root node doesn't
declare the namespaces? Perhaps I am executing the query incorrectly?

Thank you,
-Michael

Jeff S

unread,
May 8, 2007, 4:51:51 PM5/8/07
to GData Python Client Library Contributors
Hello Michael,

I think you're query is probably fine, and the namespace declarations
should be part of the XML in your query. I looked at my items and the
feed in XML form begins with the following:

<ns0:feed xmlns:ns0="http://www.w3.org/2005/Atom"><ns1:totalResults
xmlns:ns1="http://a9.com/-/spec/opensearchrss/1.0/">3</
ns1:totalResults>...</ns0:feed>

I'm relying on ElementTree to handle the XML generation and parsing,
so it could be something to do with the way output from ElementTree
interacts with libxml2. I'd be happy to look into it.

Cheers,

Jeff


P.S.
You might also be interested in an enhancement I've been thinking
about adding which would allow you to get the raw server response
instead of having the service object's methods convert the raw XML
into Python objects. Does this sound like something you'd be
interested in?

DaveV

unread,
May 22, 2007, 10:28:12 PM5/22/07
to GData Python Client Library Contributors
Certainly something I'd be interested in - it would be nice, for
example, to request a feed in JSON and pipe that directly to a web
client.

Dave V.

On May 9, 8:51 am, Jeff S <j...@google.com> wrote:
...

Reply all
Reply to author
Forward
0 new messages