Hi Andi,

Thanks!  I found the answer here:
http://sivuraide.blogspot.com/2009/01/url-fetch-api-minidom-google-app-engine.html

It's easiest when using Google's urlfetch and the minidom in tandem
and using the parseString() method of the latter.  Thanks for your
help!

On Jul 12, 9:38 pm, Andi Albrecht <albrecht.a...@googlemail.com>
wrote:
> Hi Jason,
>
> there's something wrong in your code example.
>
> You can't parse result with minidom. I think it should be something like
>
> from StringIO import StringIO
> import logging
> [...]
> try:
>   dom = minidom.parse(StringIO(result.content))
> except:
>   logging.exception('Failed to parse XML:')
>   self.response.out.write('failed!')
>
> logging.exception() logs the actual exception. This log message should
> give you a hint what's going wrong. I have no troubles importing
> minidom...
>
> Andi
>
> On Sun, Jul 12, 2009 at 11:27 AM, Jason
>
>
>
> Salas<digitalpontificat...@gmail.com> wrote:
>
> > I've been trying to use the xml.dom.minidom parser to read-in XML data
> > for an app I'm building and App Engine always throws an error whenever
> > I reference the minidom.parse() method in my code.
>
> > Here's the code:
>
> > from xml.dom import minidom
> > from google.appengine.api import urlfetch
>
> > class AppMain(webapp.RequestHandler):
> >        def get(self):
> >                url = 'http://foo.com/bar/mydata.xml'
> >                result = urlfetch.fetch(url)
> >                if result.status_code == 200:
> >                        self.response.out.write('got this far!')
> >                        try:
> >                                dom = minidom.parse(result)
> >                        except:
> >                                self.response.out.write('failed!')
>
> > I'm getting exceptions.ImportError.  Thanks for your help!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to