diff options
author | scoder <none@none> | 2007-09-12 21:53:24 +0200 |
---|---|---|
committer | scoder <none@none> | 2007-09-12 21:53:24 +0200 |
commit | e5812edb7fb7fe15ccb43f25878cee564b96ff95 (patch) | |
tree | 853320da87b6290bc103030b36beca5dfda18efd /src/lxml/objectify.pyx | |
parent | 5aa05d51fa15866965d8ef6e6e6a529dd1b43d89 (diff) | |
download | python-lxml-e5812edb7fb7fe15ccb43f25878cee564b96ff95.tar.gz |
[svn r2840] support external parser in objectify.fromstring()
--HG--
branch : trunk
Diffstat (limited to 'src/lxml/objectify.pyx')
-rw-r--r-- | src/lxml/objectify.pyx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lxml/objectify.pyx b/src/lxml/objectify.pyx index b737b95a..8fb32a43 100644 --- a/src/lxml/objectify.pyx +++ b/src/lxml/objectify.pyx @@ -1568,12 +1568,15 @@ cdef _Element _makeElement(tag, text, attrib, nsmap): cdef object _fromstring _fromstring = etree.fromstring -def fromstring(xml): - """Objectify specific version of the lxml.etree fromstring() function. +def fromstring(xml, parser=None): + """Objectify specific version of the lxml.etree fromstring() function + that uses the objectify parser. - NOTE: requires parser based element class lookup activated in lxml.etree! + You can pass a different parser as second argument. """ - return _fromstring(xml, objectify_parser) + if parser is None: + parser = objectify_parser + return _fromstring(xml, parser) XML = fromstring |