
On Mar 28, 2008, at 7:33 PM, Jean-Paul Calderone wrote:
On Fri, 28 Mar 2008 22:59:21 -0000, glyph@divmod.com wrote:
On 02:55 pm, exarkun@divmod.com wrote:
On Fri, 28 Mar 2008 10:51:10 -0400, Phil Christensen <phil@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. ;)
I have to say, I don't find this to be that big an issue. I think if you're using XML as a data interchange format (as I know the original poster was), whitespace is generally syntactically meaningless. In fact, in my particular usage, I'm dealing with SAML responses which need to have a signature verified using xmlsec, and any whitespace like that would break the signature. I know there's a tendency among developers to immediately disregard something that is less than perfect, but I like microdom too much to give up on it yet ;-)... -phil