In Python 3, I need to Canonicalize (c14n) an XML string.
Which module/package can I use for this? And how should I do this?
For reference: http://www.w3.org/TR/xml-exc-c14n/
In Python 3, I need to Canonicalize (c14n) an XML string.
Which module/package can I use for this? And how should I do this?
For reference: http://www.w3.org/TR/xml-exc-c14n/
Simplest would probably be:
https://lxml.de/api/lxml.etree-module.html#tostring
This function takes method='c14n'
, exclusive
and with-comments
which all are c14n
canonicalization related.
It is not perfect but would get your 90% there... you would still want to manually check things.
Next a little less pythonic would be libxml2... though in my very limited experience with it is even more tricky.