urllib2 and Xml

John J. Lee jjl at pobox.com
Fri Oct 10 03:22:36 CEST 2003


Glauco <glauco at sferacarta.com> writes:

> I'm building a library than can call a remote sistem in SOAP or in
> HTML for retrieve XML information.
> when i use HTML (httppost) with urllib2 i've this problem:
> 
> if the response is  something like this
> <?xml version="1.0" encoding="utf-8"?><string
> xmlns="http://bdr.izs.it/webservices">&lt;root
> xmlns="http://bdr.izs.it/XMLSchema/ResponseQuery.xsd"
> type="doc"&gt;&lt;error_info&gt;&lt;error&gt;&lt;id /&gt;&lt;des
> /&gt;&lt;/error&gt;&lt;info&gt;162&lt;/info&gt;&lt;warning
> /&gt;&lt;/error_info&gt;&
>    &lt;FIELD1&gt;
>      &lt;FIELD2&gt;14438756&lt;/FIELD2&gt;
>      &lt;FIELD3&gt;36587707&lt;/FIELD3&gt;
> 
> obviously  is htmlquoted but this is uncomprensible from expat or minidom.
> i can manually htmlunquote but this don't like me.
> i've tyed whith urllib.unquote but this don't do nothing
> Is possible that urllib2 dont do this  ?

This has nothing to do with urllib2.  It's just faithfully telling you
what the server sent.  Dealing with whatever crap that may include is
your problem <wink>.


John




More information about the Python-list mailing list