libxml2dom

Changeset

325:2253563f5e5a
2008-02-16 paulb raw files shortlog changelog graph [project @ 2008-02-16 20:10:58 by paulb] Added an XInclude exception and support function. Updated release information.
libxml2dom/macrolib/__init__.py (file) libxml2dom/macrolib/macrolib.py (file)
     1.1 --- a/libxml2dom/macrolib/__init__.py	Sat Feb 16 20:10:01 2008 +0000
     1.2 +++ b/libxml2dom/macrolib/__init__.py	Sat Feb 16 20:10:58 2008 +0000
     1.3 @@ -3,7 +3,7 @@
     1.4  """
     1.5  DOM macro library for libxml2.
     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 @@ -19,7 +19,7 @@
    1.13  with this program.  If not, see <http://www.gnu.org/licenses/>.
    1.14  """
    1.15  
    1.16 -__version__ = "0.4.5"
    1.17 +__version__ = "0.4.6"
    1.18  
    1.19  # Expose all functions here.
    1.20  
     2.1 --- a/libxml2dom/macrolib/macrolib.py	Sat Feb 16 20:10:01 2008 +0000
     2.2 +++ b/libxml2dom/macrolib/macrolib.py	Sat Feb 16 20:10:58 2008 +0000
     2.3 @@ -3,7 +3,7 @@
     2.4  """
     2.5  DOM macros for virtual libxml2mod node methods and properties.
     2.6  
     2.7 -Copyright (C) 2003, 2004, 2005, 2006, 2007 Paul Boddie <paul@boddie.org.uk>
     2.8 +Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Paul Boddie <paul@boddie.org.uk>
     2.9  
    2.10  This program is free software; you can redistribute it and/or modify it under
    2.11  the terms of the GNU Lesser General Public License as published by the Free
    2.12 @@ -483,7 +483,10 @@
    2.13      elif other.nodeType == xml.dom.Node.CDATA_SECTION_NODE:
    2.14          return Node_createCDATASection(node, other.data)
    2.15  
    2.16 -    raise xml.dom.DOMException(xml.dom.NOT_SUPPORTED_ERR, "Node type '%s' (%d) not supported." % (_reverseNodeTypes[other.nodeType], other.nodeType))
    2.17 +    raise xml.dom.DOMException(
    2.18 +        xml.dom.NOT_SUPPORTED_ERR,
    2.19 +        "Node type '%s' (%d) not supported." % (_reverseNodeTypes[other.nodeType], other.nodeType)
    2.20 +        )
    2.21  
    2.22  def Node_xpath(node, expr, variables=None, namespaces=None):
    2.23      expr = from_unicode(expr)
    2.24 @@ -503,6 +506,13 @@
    2.25      libxml2mod.xmlXPathFreeContext(context)
    2.26      return result
    2.27  
    2.28 +def Node_xinclude(node):
    2.29 +    result = libxml2mod.xmlXIncludeProcessFlags(node, XML_PARSE_NOERROR | XML_PARSE_NOWARNING | XML_PARSE_NONET)
    2.30 +    if result == -1:
    2.31 +        raise XIncludeException()
    2.32 +    else:
    2.33 +        return result
    2.34 +
    2.35  # Exceptions.
    2.36  
    2.37  class LSException(Exception):
    2.38 @@ -524,6 +534,12 @@
    2.39          else:
    2.40              return Exception.__repr__(self)
    2.41  
    2.42 +class XIncludeException(Exception):
    2.43 +
    2.44 +    "Unstandardised XInclude exception."
    2.45 +
    2.46 +    pass
    2.47 +
    2.48  # Utility functions.
    2.49  
    2.50  def createDocument(namespaceURI, localName, doctype):