[Python-Dev] XML codec? (original) (raw)

M.-A. Lemburg mal at egenix.com
Sun Nov 11 19:31:36 CET 2007


On 2007-11-11 18:56, Martin v. Löwis wrote:

First, XML-RPC is not the only mechanism using XML over a network connection. Second, you don't want to do this if you're dealing with several 100 MB of data just because you want to figure out the encoding. That's my original claim/question: what SPECIFIC application do you have in mind that transfers XML over a network and where you would want to have such a stream codec?

XML-based web services used for business integration, e.g. based on ebXML.

A common use case from our everyday consulting business is e.g. passing market and trading data to portfolio pricing web services.

If I have 100MB of XML in a file, using the detection API, I do

f = open(filename) s = f.read(100) while True: coding = xml.utils.detectencoding(s) if coding is not undetermined: break s += f.read(100) f.close() Having the loop here is paranoia: in my application, I might be able to know that 100 bytes are sufficient to determine the encoding always.

Doing the detection with files is easy, but that was never questioned.

Again, I don't see the use case. For XML-RPC, it's very feasible and standard procedure to have the entire document in memory (in a processed form). You may not see the use case, but that doesn't really mean anything if the use cases exist in real life applications, right ?! Right. However, I' will remain opposed to adding this to the standard library until I see why one would absolutely need to have that. Not every piece of code that is useful in some application should be added to the standard library.

Agreed, but the application space of web services is large enough to warrant this.

-- Marc-Andre Lemburg eGenix.com

Professional Python Services directly from the Source (#1, Nov 11 2007)

Python/Zope Consulting and Support ... http://www.egenix.com/ mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/


:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::

eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611



More information about the Python-Dev mailing list