473,394 Members | 1,751 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

urllib2 and Xml

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;i d /&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

Jul 18 '05 #1
1 3158
Glauco <gl****@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;i d /&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
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: bmiras | last post by:
I've got a problem using urllib2 to get a web page. I'm going through a proxy using user/password authentification and i'm trying to get a page asking for a HTTP authentification. And I'm using...
1
by: Matthew Wilson | last post by:
I am writing a script to check on my router's external IP address. My ISP refreshes my IP very often and I use dyndns for the hostname for my computer. My Netgear mr814 router has a webserver that...
2
by: John F Dutcher | last post by:
Can anyone comment on why the code shown in the Python error is in some way incorrect...or is there a problem with Python on my hoster's site ?? The highlites don't seem to show here...but line...
5
by: Pascal | last post by:
Hello, I want to acces my OWA (Outlook Web Acces - http Exchange interface) server with urllib2 but, when I try, I've always a 401 http error. Can someone help me (and us)? Thanks. ...
0
by: jacob c. | last post by:
When I request a URL using urllib2, it appears that urllib2 always makes the request using HTTP 1.0, and not HTTP 1.1. I'm trying to use the "If-None-Match"/"ETag" HTTP headers to conserve...
0
by: Gil Tal | last post by:
Hi, I use urllib2 to download a redirected url and I get an exception from the bowels of urllib2. It seems that urllib2 implements some super sophisticated self check and tries to control the...
1
by: Ray Slakinski | last post by:
Hello, I have defined a function to set an opener for urllib2, this opener defines any proxy and http authentication that is required. If the proxy has authencation itself and requests an...
0
by: Ali.Sabil | last post by:
hello all, I just maybe hit a bug in both urllib and urllib2, actually urllib doesn't support proxy authentication, and if you setup the http_proxy env var to...
3
by: m.banaouas | last post by:
Hi all, I started to use urllib2 library and HTTPBasicAuthHandler class in order to authenticate with a http server (Zope in this case). I don't know why but it doesn't work, while authenticating...
1
by: Alessandro Fachin | last post by:
I write this simply code that should give me the access to private page with htaccess using a proxy, i don't known because it's wrong... import urllib,urllib2 #input url...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.