[XML-SIG] c14n and subset

Keith Beattie KSBeattie at lbl.gov
Thu Oct 16 22:05:27 EDT 2003


So, after staring at c14n.py for far too long and filing a bug against 
it (825115) (see thread titles "c14n attribute ordering problem?"), I 
gave the subset arg of Canonicalize() a try.

This doesn't exibit #825115 but does have another problem, it doesn't 
include the non-xmlns attributes.  For example:

$ cat c14n_simple.py
from xml.dom import minidom
from xml.dom.ext import c14n

str = """<a:A xmlns:a="urn:a" xmlns="urn:b">
   <B a:cat="gin" dog="stoli"/>
</a:A>"""
dom = minidom.parseString(str)
B_el = dom.getElementsByTagNameNS("urn:b", "B")
print c14n.Canonicalize(dom, subset=B_el)

$ python c14n_simple.py
<B xmlns="urn:b" xmlns:a="urn:a"></B>

I was expecting:
<B xmlns="urn:b" xmlns:a="urn:a" dog="stoli" a:cat="gin"></B>

Any ideas on what might be wrong?

ksb




More information about the XML-SIG mailing list