Removed the CSS font size, Daniel
diff --git a/doc/python.html b/doc/python.html
index 730c45e..359f060 100644
--- a/doc/python.html
+++ b/doc/python.html
@@ -3,11 +3,12 @@
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
<style type="text/css"><!--
-TD {font-size: 14pt; font-family: Verdana,Arial,Helvetica}
-BODY {font-size: 14pt; font-family: Verdana,Arial,Helvetica; margin-top: 2em; margin-left: 0em; margin-right: 0em}
-H1 {font-size: 20pt; font-family: Verdana,Arial,Helvetica}
-H2 {font-size: 18pt; font-family: Verdana,Arial,Helvetica}
-H3 {font-size: 16pt; font-family: Verdana,Arial,Helvetica}
+TD {font-family: Verdana,Arial,Helvetica}
+BODY {font-family: Verdana,Arial,Helvetica; margin-top: 2em; margin-left: 0em; margin-right: 0em}
+H1 {font-family: Verdana,Arial,Helvetica}
+H2 {font-family: Verdana,Arial,Helvetica}
+H3 {font-family: Verdana,Arial,Helvetica}
+CODE {white-space: pre}
A:link, A:visited, A:active { text-decoration: underline }
--></style>
<title>Python and bindings</title>
@@ -127,7 +128,7 @@
tests:</p>
<h3>tst.py:</h3>
<p>This is a basic test of the file interface and DOM navigation:</p>
-<pre>import libxml2
+<code>import libxml2
doc = libxml2.parseFile("tst.xml")
if doc.name != "tst.xml":
@@ -141,7 +142,7 @@
if child.name != "foo":
print "child.name failed"
sys.exit(1)
-doc.freeDoc()</pre>
+doc.freeDoc()</code>
<p>The Python module is called libxml2, parseFile is the equivalent of
xmlParseFile (most of the bindings are automatically generated, and the xml
prefix is removed and the casing convention are kept). All node seen at the
@@ -174,7 +175,7 @@
<h3>validate.py:</h3>
<p>This test check the validation interfaces and redirection of error
messages:</p>
-<pre>import libxml2
+<code>import libxml2
#desactivate error messages from the validation
def noerr(ctx, str):
@@ -189,7 +190,7 @@
valid = ctxt.isValid()
doc.freeDoc()
if valid != 0:
- print "validity chec failed"</pre>
+ print "validity chec failed"</code>
<p>The first thing to notice is the call to registerErrorHandler(), it
defines a new error handler global to the library. It is used to avoid seeing
the error messages when trying to validate the invalid document.</p>
@@ -203,13 +204,13 @@
libxml2.py module containing all the wrappers.</p>
<h3>push.py:</h3>
<p>This test show how to activate the push parser interface:</p>
-<pre>import libxml2
+<code>import libxml2
ctxt = libxml2.createPushParser(None, "<foo", 4, "test.xml")
ctxt.parseChunk("/>", 2, 1)
doc = ctxt.doc()
-doc.freeDoc()</pre>
+doc.freeDoc()</code>
<p>The context is created with a speciall call based on the
xmlCreatePushParser() from the C library. The first argument is an optional
SAX callback object, then the initial set of data, the lenght and the name of
@@ -220,7 +221,7 @@
<p>this test show the use of the event based parsing interfaces. In this case
the parser does not build a document, but provides callback information as
the parser makes progresses analyzing the data being provided:</p>
-<pre>import libxml2
+<code>import libxml2
log = ""
class callback:
@@ -267,7 +268,7 @@
reference = "startDocument:startElement foo {'url': 'tst'}:characters: bar:endElement foo:endDocument:"
if log != reference:
print "Error got: %s" % log
- print "Exprected: %s" % reference</pre>
+ print "Exprected: %s" % reference</code>
<p>The key object in that test is the handler, it provides a number of entry
points which can be called by the parser as it makes progresses to indicate
the information set obtained. The full set of callback is larger than what
@@ -280,7 +281,7 @@
from 2 different call to parseChunk()</p>
<h3>xpath.py:</h3>
<p>This is a basic test of XPath warppers support</p>
-<pre>import libxml2
+<code>import libxml2
doc = libxml2.parseFile("tst.xml")
ctxt = doc.xpathNewContext()
@@ -292,7 +293,7 @@
print "xpath query: wrong node set value"
sys.exit(1)
doc.freeDoc()
-ctxt.xpathFreeContext()</pre>
+ctxt.xpathFreeContext()</code>
<p>This test parses a file, then create an XPath context to evaluate XPath
expression on it. The xpathEval() method execute an XPath query and returns
the result mapped in a Python way. String and numbers are natively converted,
@@ -303,7 +304,7 @@
<h3>xpathext.py:</h3>
<p>This test shows how to extend the XPath engine with functions written in
python:</p>
-<pre>import libxml2
+<code>import libxml2
def foo(ctx, x):
return x + 1
@@ -315,13 +316,13 @@
if res != 2:
print "xpath extension failure"
doc.freeDoc()
-ctxt.xpathFreeContext()</pre>
+ctxt.xpathFreeContext()</code>
<p>Note how the extension function is registered with the context (but that
part is not yet finalized, ths may change slightly in the future).</p>
<h3>tstxpath.py:</h3>
<p>This test is similar to the previousone but shows how the extension
function can access the XPath evaluation context:</p>
-<pre>def foo(ctx, x):
+<code>def foo(ctx, x):
global called
#
@@ -330,23 +331,23 @@
pctxt = libxml2.xpathParserContext(_obj=ctx)
ctxt = pctxt.context()
called = ctxt.function()
- return x + 1</pre>
+ return x + 1</code>
<p>All the interfaces around the XPath parser(or rather evaluation) context
are not finalized, but it should be sufficient to do contextual work at the
evaluation point.</p>
<h3>Memory debugging:</h3>
<p>last but not least, all tests starts with the following prologue:</p>
-<pre>#memory debug specific
+<code>#memory debug specific
libxml2.debugMemory(1)
-</pre>
+</code>
<p>and ends with the following epilogue:</p>
-<pre>#memory debug specific
+<code>#memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
print "OK"
else:
print "Memory leak %d bytes" % (libxml2.debugMemory(1))
- libxml2.dumpMemory()</pre>
+ libxml2.dumpMemory()</code>
<p>Those activate the memory debugging interface of libxml2 where all
alloacted block in the library are tracked. The prologue then cleans up the
library state and checks that all allocated memory has been freed. If not it