[Lxml-checkins] r51089 - in lxml/trunk: . src/lxml
scoder at codespeak.net
scoder at codespeak.net
Mon Jan 28 09:00:07 CET 2008
Author: scoder
Date: Mon Jan 28 09:00:05 2008
New Revision: 51089
Modified:
lxml/trunk/ (props changed)
lxml/trunk/CHANGES.txt
lxml/trunk/src/lxml/lxml.objectify.pyx
Log:
r3344 at delle: sbehnel | 2008-01-28 08:47:14 +0100
makeparser() function in lxml.objectify
Modified: lxml/trunk/CHANGES.txt
==============================================================================
--- lxml/trunk/CHANGES.txt (original)
+++ lxml/trunk/CHANGES.txt Mon Jan 28 09:00:05 2008
@@ -2,6 +2,22 @@
lxml changelog
==============
+Under development
+=================
+
+Features added
+--------------
+
+* ``makeparser()`` function in ``lxml.objectify`` to create a new
+ parser with the usual objectify setup.
+
+Bugs fixed
+----------
+
+Other changes
+-------------
+
+
2.0beta2 (2008-01-26)
=====================
Modified: lxml/trunk/src/lxml/lxml.objectify.pyx
==============================================================================
--- lxml/trunk/src/lxml/lxml.objectify.pyx (original)
+++ lxml/trunk/src/lxml/lxml.objectify.pyx Mon Jan 28 09:00:05 2008
@@ -1598,12 +1598,13 @@
cdef object __DEFAULT_PARSER
__DEFAULT_PARSER = etree.XMLParser(remove_blank_text=True)
-__DEFAULT_PARSER.setElementClassLookup( ObjectifyElementClassLookup() )
+__DEFAULT_PARSER.set_element_class_lookup( ObjectifyElementClassLookup() )
cdef object objectify_parser
objectify_parser = __DEFAULT_PARSER
def setDefaultParser(new_parser = None):
+ "This function is deprecated, use ``set_default_parser()`` instead."
set_default_parser(new_parser)
def set_default_parser(new_parser = None):
@@ -1622,6 +1623,16 @@
else:
raise TypeError("parser must inherit from lxml.etree.XMLParser")
+def makeparser(**kw):
+ """Create a new XML parser for objectify trees.
+
+ You can pass all keyword arguments that are supported by
+ ``etree.XMLParser()``.
+ """
+ parser = etree.XMLParser(**kw)
+ parser.set_element_class_lookup( ObjectifyElementClassLookup() )
+ return parser
+
cdef _Element _makeElement(tag, text, attrib, nsmap):
return cetree.makeElement(tag, None, objectify_parser, text, None, attrib, nsmap)
More information about the lxml-checkins
mailing list