urllib2 and Xml

G

Glauco

Hi all

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 ?

any ideas ?

Glauco
Italy
 
J

John J. Lee

Glauco said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,125
Latest member
VinayKumar Nevatia_
Top