# HG changeset patch # User paulb # Date 1203192658 0 # Node ID 2253563f5e5a8db3926e3f9e4b5dd31e3ea22a7b # Parent a97efe934bc5a5b467218aba848c77ce9fe4e8bd [project @ 2008-02-16 20:10:58 by paulb] Added an XInclude exception and support function. Updated release information. diff -r a97efe934bc5 -r 2253563f5e5a libxml2dom/macrolib/__init__.py --- a/libxml2dom/macrolib/__init__.py Sat Feb 16 20:10:01 2008 +0000 +++ b/libxml2dom/macrolib/__init__.py Sat Feb 16 20:10:58 2008 +0000 @@ -3,7 +3,7 @@ """ DOM macro library for libxml2. -Copyright (C) 2003, 2004, 2005, 2006, 2007 Paul Boddie +Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 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.4.5" +__version__ = "0.4.6" # Expose all functions here. diff -r a97efe934bc5 -r 2253563f5e5a libxml2dom/macrolib/macrolib.py --- a/libxml2dom/macrolib/macrolib.py Sat Feb 16 20:10:01 2008 +0000 +++ b/libxml2dom/macrolib/macrolib.py Sat Feb 16 20:10:58 2008 +0000 @@ -3,7 +3,7 @@ """ DOM macros for virtual libxml2mod node methods and properties. -Copyright (C) 2003, 2004, 2005, 2006, 2007 Paul Boddie +Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 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 @@ -483,7 +483,10 @@ elif other.nodeType == xml.dom.Node.CDATA_SECTION_NODE: return Node_createCDATASection(node, other.data) - raise xml.dom.DOMException(xml.dom.NOT_SUPPORTED_ERR, "Node type '%s' (%d) not supported." % (_reverseNodeTypes[other.nodeType], other.nodeType)) + raise xml.dom.DOMException( + xml.dom.NOT_SUPPORTED_ERR, + "Node type '%s' (%d) not supported." % (_reverseNodeTypes[other.nodeType], other.nodeType) + ) def Node_xpath(node, expr, variables=None, namespaces=None): expr = from_unicode(expr) @@ -503,6 +506,13 @@ libxml2mod.xmlXPathFreeContext(context) return result +def Node_xinclude(node): + result = libxml2mod.xmlXIncludeProcessFlags(node, XML_PARSE_NOERROR | XML_PARSE_NOWARNING | XML_PARSE_NONET) + if result == -1: + raise XIncludeException() + else: + return result + # Exceptions. class LSException(Exception): @@ -524,6 +534,12 @@ else: return Exception.__repr__(self) +class XIncludeException(Exception): + + "Unstandardised XInclude exception." + + pass + # Utility functions. def createDocument(namespaceURI, localName, doctype):