1.1 --- a/README.txt Mon Jan 24 10:37:17 2005 +0000
1.2 +++ b/README.txt Mon Jan 24 10:59:18 2005 +0000
1.3 @@ -16,7 +16,46 @@
1.4
1.5 The libxml2macro.py program, along with the libxml2dom.macrolib package
1.6 provide support for writing DOM-style code which is then translated to
1.7 -libxml2-style code before being compiled to normal Python modules. This
1.8 +libxml2mod-style code before being compiled to normal Python modules. This
1.9 special translation should eliminate the need for high-level wrapper objects
1.10 -in many cases, since the actual compiled code will be manipulating the libxml2
1.11 -objects directly - the principal exception being that of attribute nodes.
1.12 +in most cases as well as low-level libxml2 objects, since the actual compiled
1.13 +code will be using the libxml2mod functions directly.
1.14 +
1.15 +To use libxml2macro.py, first write your code using the typical PyXML DOM
1.16 +style, but make sure that you use a common prefix for all node variables and
1.17 +which is not used by any other kind of variable, and make sure that you do not
1.18 +re-use node variables to refer to other kinds of object. Here is an example of
1.19 +the coding style:
1.20 +
1.21 + # My module.
1.22 +
1.23 + import libxml2macro as my_
1.24 +
1.25 + def processing_function(my_document, some_args):
1.26 +
1.27 + # Perform actions on nodes:
1.28 +
1.29 + my_node = my_document.createElementNS("namespace", "some-name")
1.30 +
1.31 + # Perform actions on other data as normal:
1.32 +
1.33 + some_function(some_args)
1.34 +
1.35 +Then, run libxml2macro.py on the module like this (using tests/macrotest.py as
1.36 +an example):
1.37 +
1.38 + libxml2macro.py tests/macrotest.py
1.39 +
1.40 +This produces a compiled module that can be imported into Python; for example:
1.41 +
1.42 + cd tests
1.43 + python
1.44 + import macrotest
1.45 +
1.46 +It should be possible to run the module directly; for example:
1.47 +
1.48 + python tests/macrotest.pyc
1.49 +
1.50 +Note that running the module using the source filename will probably result in
1.51 +the compiled module being overwritten and various errors being produced. So
1.52 +don't do that!