[XML-SIG] "encoding" argument to xml.dom.minidom.toxml()?

2008-06-10 Thread Bill Janssen
I've been using the minidom to produce little properly-formatted XML documents, by building a DOM tree, then calling "toxml" to generate the actual XML. But I tripped over the optional "encoding" argument to that function. I figured that the only point of having an encoding argument would be to a

Re: [XML-SIG] "encoding" argument to xml.dom.minidom.toxml()?

2008-06-10 Thread Stefan Behnel
Hi, Bill Janssen wrote: > I figured that the only point of having an encoding argument would be > to allow the user to control the output character set encoding, but it > turns out that specifying an encoding of, say, "ASCII", doesn't do > that. It just raises encoding exceptions when you attempt

Re: [XML-SIG] "encoding" argument to xml.dom.minidom.toxml()?

2008-06-10 Thread Bill Janssen
Stefan, > > writer = codecs.lookup(encoding)[3](writer, "xmlcharrefreplace") > > Could be done, yes. ElementTree and lxml do it that way. It's not required, > though. If you say you want to serialise plain ASCII data, nothing keeps an > XML serialiser from shouting at you when it finds non-AS

Re: [XML-SIG] "encoding" argument to xml.dom.minidom.toxml()?

2008-06-10 Thread Bill Janssen
> Well, what did you expect? That it magically transmogrifies your non-ASCII > data into plain ASCII data? Yep. And there's no reason I can see why it can't do exactly that. I think the "encoding" argument should either be removed, or made to work. Bill _

Re: [XML-SIG] "encoding" argument to xml.dom.minidom.toxml()?

2008-06-10 Thread Stefan Behnel
Hi, Bill Janssen wrote: >> Well, what did you expect? That it magically transmogrifies your non-ASCII >> data into plain ASCII data? > > Yep. And there's no reason I can see why it can't do exactly that. I > think the "encoding" argument should either be removed, or made to > work. That's why

Re: [XML-SIG] "encoding" argument to xml.dom.minidom.toxml()?

2008-06-10 Thread Bob Kline
Stefan Behnel wrote: Hi, Bill Janssen wrote: Well, what did you expect? That it magically transmogrifies your non-ASCII data into plain ASCII data? Yep. And there's no reason I can see why it can't do exactly that. I think the "encoding" argument should either be removed, or made t

Re: [XML-SIG] "encoding" argument to xml.dom.minidom.toxml()?

2008-06-10 Thread Stefan Behnel
Hi, Bob Kline wrote: > Stefan is (if he even realizes that Bill might be thinking > this) himself possibly thinking "no way is the method going to do that > much work for the caller." No, I'm actually just saying that this is not a bug and maybe not even a missing feature. It's a design decision.

Re: [XML-SIG] "encoding" argument to xml.dom.minidom.toxml()?

2008-06-10 Thread Bill Janssen
> I suspect there's a certain amount of unarticulated assumptions on both > sides of this exchange. I'm guessing that Bill might be thinking > something like: "it's possible to represent any Unicode character in XML > as &#"; and was hoping that the method > would do just that for the non-ASCI

Re: [XML-SIG] "encoding" argument to xml.dom.minidom.toxml()?

2008-06-10 Thread Bill Janssen
> Hi, > > Bob Kline wrote: > > Stefan is (if he even realizes that Bill might be thinking > > this) himself possibly thinking "no way is the method going to do that > > much work for the caller." > > No, I'm actually just saying that this is not a bug and maybe not even a > missing feature. It's

Re: [XML-SIG] "encoding" argument to xml.dom.minidom.toxml()?

2008-06-10 Thread Bob Kline
I believe there are reasonable grounds for both Bill's and Stefan's interpretation of the somewhat ambiguous documentation for the method, and further, that the documentation would benefit from some clarification one way or another. I don't think Bill is correct in thinking that is no other po

Re: [XML-SIG] "encoding" argument to xml.dom.minidom.toxml()?

2008-06-10 Thread Stefan Behnel
Hi, Bill Janssen wrote: >> I suspect there's a certain amount of unarticulated assumptions on both >> sides of this exchange. I'm guessing that Bill might be thinking >> something like: "it's possible to represent any Unicode character in XML >> as &#"; and was hoping that the method >> would