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<[email protected]> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---