[lxml-dev] Dump output correct, tostring output incorrect?
Hello list. I've found something really weird with lxml, I hope you can help me. I want dump() output but I can't get it and tostring returns the full xml document, not the part I need.
import lxml.etree mydoc = lxml.etree.fromstring('<?xml version="1.0"?><req><oml><section><list><items><item>quick</item></items></list></section></oml></req>') lxml.etree.tostring(oml) '<req><oml><section><list><items><item>quick</item></items></list></section></oml></req>' lxml.etree.dump(oml) <oml><section><list><items><item>quick</item></items></list></section></oml> oml <Element oml at -481b6608>
lxml version 0.6 -- dharana
dharana wrote:
Hello list. I've found something really weird with lxml, I hope you can help me. I want dump() output but I can't get it and tostring returns the full xml document, not the part I need.
import lxml.etree mydoc = lxml.etree.fromstring('<?xml version="1.0"?><req><oml><section><list><items><item>quick</item></items></list></section></oml></req>')
lxml.etree.tostring(oml) '<req><oml><section><list><items><item>quick</item></items></list></section></oml></req>'
lxml.etree.dump(oml) <oml><section><list><items><item>quick</item></items></list></section></oml>
oml <Element oml at -481b6608>
lxml version 0.6
There are some issues with 'tostring()' in lxml 0.6. I've solved some of them in the svn version that will turn into 0.7, but I still need to resolve one more issue. Anyway, am aware of these issues, will resolve them. Thanks for the report and sorry you had to run into this! Regards, Martijn
dharana wrote:
Martijn Faassen wrote:
dharana wrote:
There are some issues with 'tostring()' in lxml 0.6. I've solved some of them in the svn version that will turn into 0.7, but I still need to resolve one more issue.
Is the svn repos publicly accesible?
Yes, it's here: http://codespeak.net/svn/lxml/trunk Reminds me to fix the lxml homepage so that there's a link. Regards, Martijn
Martijn Faassen wrote:
dharana wrote:
Martijn Faassen wrote:
dharana wrote:
There are some issues with 'tostring()' in lxml 0.6. I've solved some of them in the svn version that will turn into 0.7, but I still need to resolve one more issue.
Is the svn repos publicly accesible?
Yes, it's here:
http://codespeak.net/svn/lxml/trunk
Reminds me to fix the lxml homepage so that there's a link.
Oh, and note that the remaining issue means that tostring() *still* doesn't work with an element that's not the root of a tree; that's the thing that still needs to be worked out in the svn version. Regards, Martijn
Oh, ok. I will wait then. Thank you for the warning. Martijn Faassen wrote:
Martijn Faassen wrote:
Oh, and note that the remaining issue means that tostring() *still* doesn't work with an element that's not the root of a tree; that's the thing that still needs to be worked out in the svn version.
Regards,
Martijn
-- dharana
dharana wrote:
Oh, ok. I will wait then. Thank you for the warning.
Feel free to test now; tostring() should now be fixed in svn. If you know anything about encodings, try the second encoding argument to tostring() and see whether it works properly for you. Regards, Martijn
participants (2)
-
dharana
-
Martijn Faassen