[Python-3000] str/unicode tests: pyexpat.c and read(n)

James Y Knight foom at fuhm.net
Sat Jul 21 19:17:55 CEST 2007


On Jul 21, 2007, at 12:25 AM, Fred L. Drake, Jr. wrote:

> On Saturday 21 July 2007, Joe Gregorio wrote:
>> Should xml.parsers.expat.XMLParser.ParseFile(file) operate on
>> both text and binary streams?
>
> No.  XML is a serialization of a markup language containing Unicode  
> character
> into an encoded stream.

Well...there's many reasons why it is useful to be able to parse an  
already-decoded unicode stream into XML, and to serialize XML into a  
unicode string. For example, if combining into a larger unicode  
document, or parsing from a literal string in the source code.

Sure, normally XML is serialized to bytes, but it is also  
serializable to unicode, and that's a useful feature to have (if  
implementable).

James


More information about the Python-3000 mailing list