# HG changeset patch # User paulb # Date 1191764048 0 # Node ID 94bc7f6f300a01b9282fbeb2e2cd05e95b2e6caf # Parent ae3c38d8e2beb749e25f8b8cd543669c6e887054 [project @ 2007-10-07 13:34:08 by paulb] Fixed parsing when confronted with empty documents. diff -r ae3c38d8e2be -r 94bc7f6f300a libxml2dom/macrolib/macrolib.py --- a/libxml2dom/macrolib/macrolib.py Sat Oct 06 23:48:45 2007 +0000 +++ b/libxml2dom/macrolib/macrolib.py Sun Oct 07 13:34:08 2007 +0000 @@ -548,6 +548,8 @@ # NOTE: Switching off validation and remote DTD resolution. if not html: context = libxml2mod.xmlCreateFileParserCtxt(s) + if context is None: + raise LSException(LSException.PARSE_ERR) Parser_configure(context) Parser_parse(context) doc = Parser_document(context) @@ -562,6 +564,8 @@ # NOTE: Switching off validation and remote DTD resolution. if not html: context = libxml2mod.xmlCreateMemoryParserCtxt(s, len(s)) + if context is None: + raise LSException(LSException.PARSE_ERR) Parser_configure(context) Parser_parse(context) doc = Parser_document(context) @@ -579,6 +583,8 @@ # NOTE: Switching off validation and remote DTD resolution. if not html: context = libxml2mod.xmlCreateURLParserCtxt(uri, 0) + if context is None: + raise LSException(LSException.PARSE_ERR) Parser_configure(context) Parser_parse(context) doc = Parser_document(context)