[Twisted-Python] regarding xml elements
Jean-Paul Calderone
exarkun at divmod.com
Fri Mar 28 19:33:50 EDT 2008
On Fri, 28 Mar 2008 22:59:21 -0000, glyph at divmod.com wrote:
>On 02:55 pm, exarkun at divmod.com wrote:
>>On Fri, 28 Mar 2008 10:51:10 -0400, Phil Christensen <phil at bubblehouse.org>
>>wrote:
>
>>>If it's so bad that you'd tell someone not to use it, why isn't it
>>>deprecated?
>
>>Because it would take a lot of work to deprecate, and there are a lot of
>>other things people are working on that are deemed more important.
>
>Also because there isn't a complete consensus on how terrible it is. If you
>are doing advanced XML processing, it definitely isn't the best choice,
>because it's missing a bunch of features and it has some idiosyncratic
>behavior. However, it is conveniently available without adding another
>dependency and it supports simple use-cases OK; this is still a problem with
>other XML libraries in Python, especially DOM libraries. (For example,
>incompatibilities between the various lxml implementations.)
Here's an example of a behavior it has which probably isn't going to change
any time soon:
>>> from twisted.web.microdom import parseString
>>> s = '<div><span>hello</span> <span>world</span></div>'
>>> parseString(s).toxml()
'<?xml version="1.0"?><div><span>hello</span><span>world</span></div>'
>>>
So if you need such advanced XML features as correct whitespace handling,
steer clear. ;)
Jean-Paul
More information about the Twisted-Python
mailing list