1.1 --- a/docs/index.html Mon Jan 24 16:38:55 2005 +0000
1.2 +++ b/docs/index.html Mon Jan 24 17:01:11 2005 +0000
1.3 @@ -10,13 +10,55 @@
1.4 <h1>libxml2dom</h1>
1.5
1.6 <p>The libxml2dom package provides a traditional DOM wrapper around the
1.7 -Python bindings for libxml2. In contrast to the libxml2 bindings, libxml2dom
1.8 -provides an API reminiscent of minidom, pxdom and other Python-based and
1.9 -Python-related XML toolkits. Performance is disappointing, given the typical
1.10 -high speed of libxml2 processing, but this is to be expected since large
1.11 -numbers of Python objects are instantiated at two levels of document tree
1.12 -representation. However, serialisation of documents is much faster than many
1.13 -other toolkits because it can make direct use of libxml2.</p>
1.14 +Python bindings for <a href="http://www.xmlsoft.org">libxml2</a>. In contrast
1.15 +to the libxml2 bindings, libxml2dom provides an API reminiscent of minidom,
1.16 +pxdom and other Python-based and Python-related XML toolkits. Performance is
1.17 +disappointing, given the typical high speed of libxml2 processing, but this
1.18 +is to be expected since large numbers of Python objects are instantiated at
1.19 +two levels of document tree representation. However, serialisation of
1.20 +documents is much faster than many other toolkits because it can make direct
1.21 +use of libxml2.</p>
1.22 +
1.23 +<h2>Experiments</h2>
1.24 +
1.25 +<p>The main libxml2dom package is relatively slow, even when compared to
1.26 +Python-only XML toolkits, but previous experiments into source code analysis
1.27 +suggested that with a slightly altered coding style, programs could be
1.28 +transformed into a style which utilises the underlying libxml2mod API
1.29 +directly; this API employs opaque handles which are exposed to Python but
1.30 +which can only be investigated through the functions in the API. One
1.31 +significant advantage of accessing the libxml2mod API directly is that the
1.32 +libxml2 wrapper objects do not need to be instantiated, let alone the
1.33 +additional libxml2dom wrapper objects, and the consequences are obvious:
1.34 +reduced memory consumption and improved performance.</p>
1.35 +
1.36 +<p>The libxml2macro approach is as follows:</p>
1.37 +<ul>
1.38 + <li>Write code using the PyXML-inspired DOM-style API, but giving node
1.39 + variables and attributes a distinct prefix.</li>
1.40 + <li>Run the supplied tool <code>libxml2macro.py</code> on the source
1.41 + file.</li>
1.42 + <li>Invoke the compiled module directly or import it into programs as
1.43 + usual.</li>
1.44 +</ul>
1.45 +
1.46 +<p>A description of the process is given in the <code>README.txt</code> file
1.47 +within the source code distribution. However, what libxml2macro does is to
1.48 +take code like this...</p>
1.49 +<pre>for my_node in my_element.childNodes:
1.50 + if my_node.nodeType == TEXT_NODE:
1.51 + print my_node.nodeValue</pre>
1.52 +
1.53 +<p>...and to transform it into something more or less like this (although in
1.54 +practice the actual libxml2mod calls are provided in a library, although more
1.55 +aggressive transformations could result in something actually like this):</p>
1.56 +<pre>for my_node in libxml2mod.children(my_element):
1.57 + if libxml2mod.type(my_node) == "text":
1.58 + print libxml2mod.xmlNodeGetContent(my_node)</pre>
1.59 +
1.60 +<p>The result is that developers can still write DOM-style code but not be
1.61 +penalised for the object-related overhead that such an approach typically
1.62 +incurs.</p>
1.63
1.64 <h2>Copyright and Licence</h2>
1.65
1.66 @@ -77,7 +119,7 @@
1.67 <h3>New in libxml2dom 0.1.3 (Changes since libxml2dom 0.1.2)</h3>
1.68 <ul>
1.69 <li>Fixed createElement.</li>
1.70 - <li>Introduced experimental libxml2macro tool and library.</li>
1.71 + <li>Introduced experimental libxml2macro tools, tests and libraries.</li>
1.72 </ul>
1.73
1.74 <h3>New in libxml2dom 0.1.2 (Changes since libxml2dom 0.1.1)</h3>