# HG changeset patch # User paulb # Date 1106586071 0 # Node ID c6ab7dbed5eda5100fd95ebd206e8ee3a592f873 # Parent f61be8ad99ff424443467867e58a38a9d479d3ea [project @ 2005-01-24 17:01:11 by paulb] Added notes about the libxml2macro experiment. Updated release notes. diff -r f61be8ad99ff -r c6ab7dbed5ed docs/index.html --- a/docs/index.html Mon Jan 24 16:38:55 2005 +0000 +++ b/docs/index.html Mon Jan 24 17:01:11 2005 +0000 @@ -10,13 +10,55 @@

libxml2dom

The libxml2dom package provides a traditional DOM wrapper around the -Python bindings for libxml2. In contrast to the libxml2 bindings, libxml2dom -provides an API reminiscent of minidom, pxdom and other Python-based and -Python-related XML toolkits. Performance is disappointing, given the typical -high speed of libxml2 processing, but this is to be expected since large -numbers of Python objects are instantiated at two levels of document tree -representation. However, serialisation of documents is much faster than many -other toolkits because it can make direct use of libxml2.

+Python bindings for libxml2. In contrast +to the libxml2 bindings, libxml2dom provides an API reminiscent of minidom, +pxdom and other Python-based and Python-related XML toolkits. Performance is +disappointing, given the typical high speed of libxml2 processing, but this +is to be expected since large numbers of Python objects are instantiated at +two levels of document tree representation. However, serialisation of +documents is much faster than many other toolkits because it can make direct +use of libxml2.

+ +

Experiments

+ +

The main libxml2dom package is relatively slow, even when compared to +Python-only XML toolkits, but previous experiments into source code analysis +suggested that with a slightly altered coding style, programs could be +transformed into a style which utilises the underlying libxml2mod API +directly; this API employs opaque handles which are exposed to Python but +which can only be investigated through the functions in the API. One +significant advantage of accessing the libxml2mod API directly is that the +libxml2 wrapper objects do not need to be instantiated, let alone the +additional libxml2dom wrapper objects, and the consequences are obvious: +reduced memory consumption and improved performance.

+ +

The libxml2macro approach is as follows:

+ + +

A description of the process is given in the README.txt file +within the source code distribution. However, what libxml2macro does is to +take code like this...

+
for my_node in my_element.childNodes:
+    if my_node.nodeType == TEXT_NODE:
+        print my_node.nodeValue
+ +

...and to transform it into something more or less like this (although in +practice the actual libxml2mod calls are provided in a library, although more +aggressive transformations could result in something actually like this):

+
for my_node in libxml2mod.children(my_element):
+    if libxml2mod.type(my_node) == "text":
+        print libxml2mod.xmlNodeGetContent(my_node)
+ +

The result is that developers can still write DOM-style code but not be +penalised for the object-related overhead that such an approach typically +incurs.

Copyright and Licence

@@ -77,7 +119,7 @@

New in libxml2dom 0.1.3 (Changes since libxml2dom 0.1.2)

New in libxml2dom 0.1.2 (Changes since libxml2dom 0.1.1)