[lxml-dev] [Question #61584]: Is it possible to make lxml use hex instead of decimal for unicode entities?

Stefan Behnel stefan_ml at behnel.de
Thu Feb 19 18:51:53 CET 2009


Stefan Behnel wrote:
> usernamenumber wrote:
>> I am porting a perl/SAX tool to python/lxml. Ideally, given the same
>> input, the new tool should produce the same output as the old tool. In
>> fact, it introduces a number of problems for me if this is not the case.
> 
> It's always bad style to make applications depend on a specific XML
> serialisation done by a specific tool. That's exactly what canonical XML
> (C14N) was designed for.

And, as a matter of fact, C14N uses hex charrrefs:

http://www.w3.org/TR/xml-c14n.html#Example-Chars

So maybe you should take a look at that.

http://codespeak.net/lxml/api.html#write-c14n-on-elementtree

Stefan


More information about the lxml-dev mailing list