[Lxml-checkins] r42774 - lxml/trunk/src/lxml
scoder at codespeak.net
scoder at codespeak.net
Mon May 7 11:01:41 CEST 2007
Author: scoder
Date: Mon May 7 11:01:41 2007
New Revision: 42774
Modified:
lxml/trunk/src/lxml/extensions.pxi
Log:
cleanup: use libxml2 API function
Modified: lxml/trunk/src/lxml/extensions.pxi
==============================================================================
--- lxml/trunk/src/lxml/extensions.pxi (original)
+++ lxml/trunk/src/lxml/extensions.pxi Mon May 7 11:01:41 2007
@@ -306,18 +306,6 @@
################################################################################
# EXSLT regexp implementation
-cdef int _collect_tree_text(element, l) except -1:
- # recursively collect all text (XPath 'string-value' of a node)
- text = element.text
- if text is not None:
- python.PyList_Append(l, text)
- for child in element:
- _collect_tree_text(child, l)
- tail = element.tail
- if tail is not None:
- python.PyList_Append(l, tail)
- return 0
-
cdef class _ExsltRegExp:
cdef object _compile_map
def __init__(self):
@@ -334,9 +322,8 @@
if _isString(firstnode):
return firstnode
elif isinstance(firstnode, _Element):
- l = []
- _collect_tree_text(firstnode, l)
- return ''.join(l)
+ return funicode(
+ tree.xmlNodeGetContent((<_Element>firstnode)._c_node))
else:
return str(firstnode)
else:
More information about the lxml-checkins
mailing list