1.1 --- a/libxml2dom/macrolib/macrolib.py Sat Feb 16 20:10:01 2008 +0000
1.2 +++ b/libxml2dom/macrolib/macrolib.py Sat Feb 16 20:10:58 2008 +0000
1.3 @@ -3,7 +3,7 @@
1.4 """
1.5 DOM macros for virtual libxml2mod node methods and properties.
1.6
1.7 -Copyright (C) 2003, 2004, 2005, 2006, 2007 Paul Boddie <paul@boddie.org.uk>
1.8 +Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Paul Boddie <paul@boddie.org.uk>
1.9
1.10 This program is free software; you can redistribute it and/or modify it under
1.11 the terms of the GNU Lesser General Public License as published by the Free
1.12 @@ -483,7 +483,10 @@
1.13 elif other.nodeType == xml.dom.Node.CDATA_SECTION_NODE:
1.14 return Node_createCDATASection(node, other.data)
1.15
1.16 - raise xml.dom.DOMException(xml.dom.NOT_SUPPORTED_ERR, "Node type '%s' (%d) not supported." % (_reverseNodeTypes[other.nodeType], other.nodeType))
1.17 + raise xml.dom.DOMException(
1.18 + xml.dom.NOT_SUPPORTED_ERR,
1.19 + "Node type '%s' (%d) not supported." % (_reverseNodeTypes[other.nodeType], other.nodeType)
1.20 + )
1.21
1.22 def Node_xpath(node, expr, variables=None, namespaces=None):
1.23 expr = from_unicode(expr)
1.24 @@ -503,6 +506,13 @@
1.25 libxml2mod.xmlXPathFreeContext(context)
1.26 return result
1.27
1.28 +def Node_xinclude(node):
1.29 + result = libxml2mod.xmlXIncludeProcessFlags(node, XML_PARSE_NOERROR | XML_PARSE_NOWARNING | XML_PARSE_NONET)
1.30 + if result == -1:
1.31 + raise XIncludeException()
1.32 + else:
1.33 + return result
1.34 +
1.35 # Exceptions.
1.36
1.37 class LSException(Exception):
1.38 @@ -524,6 +534,12 @@
1.39 else:
1.40 return Exception.__repr__(self)
1.41
1.42 +class XIncludeException(Exception):
1.43 +
1.44 + "Unstandardised XInclude exception."
1.45 +
1.46 + pass
1.47 +
1.48 # Utility functions.
1.49
1.50 def createDocument(namespaceURI, localName, doctype):