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

Bob Kline bkline at rksystems.com
Wed Jun 11 03:47:13 CEST 2008

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 possible reason for having the encoding 
parameter than to induce the method to use numeric character references 
for those characters which don't directly fit in the selected encoding.  
I have used similar methods which are known to raise an exception for 
mismatched encodings/values to determine the most widely supported 
encoding which adequately handles all the characters in a Unicode 
string, and I've seen others do the same.  Of course, it's more 
justifiable to rely on such behavior when the documentation makes it 
clear exactly when the exceptions will be raised.  In this case, given 
the current wording, it would technically be up to the whim of the 
implementor.  In general, this page of the standard library 
documentation could use a little cleanup (for example, the docs for the 
next method refers to "the encoding argument" which - according to the 
signature for the method - doesn't accept that argument at all).  Once 
it's clear that there is consensus as to which behavior is the most 
appropriate for toxml(), I'll be happy to contribute to a documentation 
patch which will nail things down more clearly.

Bob Kline
mailto:bkline at rksystems.com

More information about the XML-SIG mailing list