[Lxml-checkins] r42727 - lxml/trunk/doc
scoder at codespeak.net
scoder at codespeak.net
Sun May 6 09:24:19 CEST 2007
Author: scoder
Date: Sun May 6 09:24:19 2007
New Revision: 42727
Modified:
lxml/trunk/doc/element_classes.txt
Log:
cleanup
Modified: lxml/trunk/doc/element_classes.txt
==============================================================================
--- lxml/trunk/doc/element_classes.txt (original)
+++ lxml/trunk/doc/element_classes.txt Sun May 6 09:24:19 2007
@@ -4,8 +4,8 @@
lxml has very sophisticated support for custom Element classes. You can
provide your own classes for Elements and have lxml use them by default, for
-all elements generated by a specific parser or only for a specific tag name in
-a specific namespace.
+all elements generated by a specific parser, for a specific tag name in a
+specific namespace or for an exact element at a specific position in the tree.
Custom Elements must inherit from the ``lxml.etree.ElementBase`` class, which
provides the Element interface for subclasses::
@@ -44,10 +44,12 @@
called, the object may not even be initialized yet to represent the XML tag,
so there is not much use in providing an ``__init__`` method in subclasses.
-However, there is one possible way to do things on element initialization, if
-you really need to. ElementBase classes have an ``_init()`` method that can
-be overridden. It can be used to modify the XML tree, e.g. to construct
-special children or verify and update attributes.
+Most use cases will not require any class initialisation, so you can content
+yourself with skipping to the next section for now. However, if you really
+need to set up your element class on instantiation, there is one possible way
+to do so. ElementBase classes have an ``_init()`` method that can be
+overridden. It can be used to modify the XML tree, e.g. to construct special
+children or verify and update attributes.
The semantics of ``_init()`` are as follows:
More information about the lxml-checkins
mailing list