# HG changeset patch # User Paul Boddie # Date 1370098865 -7200 # Node ID 8eeed259e92ab8220a39708e9aa98bde5dc18375 # Parent ed3ba80d9cce28767c74120b72fbfa55cc7b2c61 Fixed the document encoding for HTML documents retrieved using parseURI. Updated copyright and release information. diff -r ed3ba80d9cce -r 8eeed259e92a PKG-INFO --- a/PKG-INFO Sun Jan 29 00:36:39 2012 +0100 +++ b/PKG-INFO Sat Jun 01 17:01:05 2013 +0200 @@ -1,12 +1,12 @@ Metadata-Version: 1.1 Name: libxml2dom -Version: 0.5 +Version: 0.5.1 Author: Paul Boddie Author-email: paul at boddie org uk Maintainer: Paul Boddie Maintainer-email: paul at boddie org uk Home-page: http://www.boddie.org.uk/python/libxml2dom.html -Download-url: http://www.boddie.org.uk/python/downloads/libxml2dom-0.5.tar.gz +Download-url: http://www.boddie.org.uk/python/downloads/libxml2dom-0.5.1.tar.gz Summary: PyXML-style API for the libxml2 Python bindings License: LGPL (version 3 or later) Description: The libxml2dom package provides a traditional DOM wrapper around the Python diff -r ed3ba80d9cce -r 8eeed259e92a README.txt --- a/README.txt Sun Jan 29 00:36:39 2012 +0100 +++ b/README.txt Sat Jun 01 17:01:05 2013 +0200 @@ -88,6 +88,11 @@ ...to permit in-band registration. +New in libxml2dom 0.5.1 (Changes since libxml2dom 0.5) +------------------------------------------------------ + + * Fixed the document encoding for HTML documents retrieved using parseURI. + New in libxml2dom 0.5 (Changes since libxml2dom 0.4.7) ------------------------------------------------------ diff -r ed3ba80d9cce -r 8eeed259e92a docs/COPYING.txt --- a/docs/COPYING.txt Sun Jan 29 00:36:39 2012 +0100 +++ b/docs/COPYING.txt Sat Jun 01 17:01:05 2013 +0200 @@ -1,7 +1,7 @@ Licence Agreement for libxml2dom -------------------------------- -Copyright (C) 2003-2011 Paul Boddie +Copyright (C) 2003-2013 Paul Boddie This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free diff -r ed3ba80d9cce -r 8eeed259e92a libxml2dom/__init__.py --- a/libxml2dom/__init__.py Sun Jan 29 00:36:39 2012 +0100 +++ b/libxml2dom/__init__.py Sat Jun 01 17:01:05 2013 +0200 @@ -3,7 +3,7 @@ """ DOM wrapper around libxml2, specifically the libxml2mod Python extension module. -Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Paul Boddie +Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2012, 2013 Paul Boddie This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free @@ -19,7 +19,7 @@ with this program. If not, see . """ -__version__ = "0.5" +__version__ = "0.5.1" from libxml2dom.macrolib import * from libxml2dom.macrolib import \ @@ -28,7 +28,7 @@ parseFile as Node_parseFile, \ toString as Node_toString, toStream as Node_toStream, \ toFile as Node_toFile -import urllib # for parseURI in HTML mode +import urllib2 # for parseURI in HTML mode import libxml2dom.errors # Standard namespaces. @@ -707,7 +707,7 @@ If the optional 'html' parameter is set to a true value, the content to be parsed will be treated as being HTML rather than XML. If the optional 'htmlencoding' is specified, HTML parsing will be performed with the - document encoding assumed to that specified. + document encoding assumed to be that specified. If the optional 'unfinished' parameter is set to a true value, unfinished documents will be parsed, even though such documents may be missing content @@ -742,7 +742,7 @@ If the optional 'html' parameter is set to a true value, the content to be parsed will be treated as being HTML rather than XML. If the optional 'htmlencoding' is specified, HTML parsing will be performed with the - document encoding assumed to that specified. + document encoding assumed to be that specified. If the optional 'unfinished' parameter is set to a true value, unfinished documents will be parsed, even though such documents may be missing content @@ -771,7 +771,7 @@ If the optional 'html' parameter is set to a true value, the content to be parsed will be treated as being HTML rather than XML. If the optional 'htmlencoding' is specified, HTML parsing will be performed with the - document encoding assumed to that specified. + document encoding assumed to be that specified. If the optional 'unfinished' parameter is set to a true value, unfinished documents will be parsed, even though such documents may be missing content @@ -800,7 +800,7 @@ If the optional 'html' parameter is set to a true value, the content to be parsed will be treated as being HTML rather than XML. If the optional 'htmlencoding' is specified, HTML parsing will be performed with the - document encoding assumed to that specified. + document encoding assumed to be that specified. If the optional 'unfinished' parameter is set to a true value, unfinished documents will be parsed, even though such documents may be missing content @@ -814,9 +814,10 @@ documents. XML documents are retrieved using libxml2's own network capabilities; HTML - documents are retrieved using the urllib module provided by Python. To + documents are retrieved using the urllib2 module provided by Python. To retrieve either kind of document using Python's own modules for this purpose - (such as urllib), open a stream and pass it to the parse function: + (such as urllib or urllib2), open a stream and pass it to the parse + function: f = urllib.urlopen(uri) try: @@ -828,16 +829,17 @@ """ if html: - f = urllib.urlopen(uri) + f = urllib2.urlopen(uri) try: + htmlencoding = f.headers.get("content-type", htmlencoding) return parse(f, html=html, htmlencoding=htmlencoding, unfinished=unfinished, validate=validate, remote=remote, impl=impl) finally: f.close() else: impl = impl or default_impl - return impl.adoptDocument(Node_parseURI(uri, html=html, htmlencoding=htmlencoding, - unfinished=unfinished, validate=validate, remote=remote)) + return impl.adoptDocument(Node_parseURI(uri, unfinished=unfinished, + validate=validate, remote=remote)) def toString(node, encoding=None, prettyprint=0): diff -r ed3ba80d9cce -r 8eeed259e92a libxml2dom/macrolib/__init__.py --- a/libxml2dom/macrolib/__init__.py Sun Jan 29 00:36:39 2012 +0100 +++ b/libxml2dom/macrolib/__init__.py Sat Jun 01 17:01:05 2013 +0200 @@ -3,7 +3,7 @@ """ DOM macro library for libxml2. -Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Paul Boddie +Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2013 Paul Boddie This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free @@ -19,7 +19,7 @@ with this program. If not, see . """ -__version__ = "0.5" +__version__ = "0.5.1" # Expose all functions here. diff -r ed3ba80d9cce -r 8eeed259e92a setup.py --- a/setup.py Sun Jan 29 00:36:39 2012 +0100 +++ b/setup.py Sat Jun 01 17:01:05 2013 +0200 @@ -8,7 +8,7 @@ author = "Paul Boddie", author_email = "paul@boddie.org.uk", url = "http://www.boddie.org.uk/python/libxml2dom.html", - version = "0.5", + version = "0.5.1", packages = ["libxml2dom", "libxml2dom.macrolib"], scripts = ["tools/libxml2macro.py"] )