ElementTree.XML(string XML) and ElementTree.fromstring(string XML) not working
pavlovevidence at gmail.com
Fri Jun 26 01:46:33 EDT 2009
On Jun 25, 10:11 pm, Stefan Behnel <stefan... at behnel.de> wrote:
> Carl Banks wrote:
> >> Why isn't et.parse the only way to do this? Why have XML or fromstring
> >> at all?
> > Because Fredrick Lundh wanted it that way. Unlike most Python
> > libraries ElementTree is under the control of one person, which means
> > it was not designed or vetted by the community, which means it would
> > tend to have some interface quirks.
> Just for the record: Fredrik doesn't actually consider it a design "quirk".
Well of course he wouldn't--it's his library.
> He argues that it's designed for different use cases. While parse() parses
> a file, which normally contains a complete document (represented in ET as
> an ElementTree object), fromstring() and especially the 'literal wrapper'
> XML() are made for parsing strings, which (most?) often only contain XML
> fragments. With a fragment, you normally want to continue doing things like
> inserting it into another tree, so you need the top-level element in almost
> all cases.
Whatever, like I said I am not going to nit-pick over small things,
when all the big things are done right.
More information about the Python-list