1.1 --- a/libxml2dom/__init__.py Thu Jul 18 17:54:37 2013 +0200
1.2 +++ b/libxml2dom/__init__.py Thu Jul 18 18:03:47 2013 +0200
1.3 @@ -28,7 +28,6 @@
1.4 parseFile as Node_parseFile, \
1.5 toString as Node_toString, toStream as Node_toStream, \
1.6 toFile as Node_toFile
1.7 -import urllib2 # for parseURI in HTML mode
1.8 import libxml2dom.errors
1.9
1.10 # Standard namespaces.
1.11 @@ -813,11 +812,9 @@
1.12 remote documents (such as DTDs) will be followed in order to obtain such
1.13 documents.
1.14
1.15 - XML documents are retrieved using libxml2's own network capabilities; HTML
1.16 - documents are retrieved using the urllib2 module provided by Python. To
1.17 - retrieve either kind of document using Python's own modules for this purpose
1.18 - (such as urllib or urllib2), open a stream and pass it to the parse
1.19 - function:
1.20 + Documents are retrieved using libxml2's own network capabilities. To
1.21 + retrieve documents using Python's own modules for this purpose (such as
1.22 + urllib or urllib2), open a stream and pass it to the parse function:
1.23
1.24 f = urllib.urlopen(uri)
1.25 try:
1.26 @@ -829,13 +826,8 @@
1.27 """
1.28
1.29 if html:
1.30 - f = urllib2.urlopen(uri)
1.31 - try:
1.32 - htmlencoding = f.headers.get("content-type", htmlencoding)
1.33 - return parse(f, html=html, htmlencoding=htmlencoding, unfinished=unfinished,
1.34 - validate=validate, remote=remote, impl=impl)
1.35 - finally:
1.36 - f.close()
1.37 + return parseFile(uri, html=html, htmlencoding=htmlencoding, unfinished=unfinished,
1.38 + validate=validate, remote=remote, impl=impl)
1.39 else:
1.40 impl = impl or default_impl
1.41 return impl.adoptDocument(Node_parseURI(uri, unfinished=unfinished,