summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2019-05-01 20:34:13 (GMT)
committerGitHub <noreply@github.com>2019-05-01 20:34:13 (GMT)
commite1d5dd645d5f59867cb0ad63179110f310cbca89 (patch)
tree08f42f6dbd41508652886b10c78dfb190d395933 /Lib/test
parentee88af3f4f7493df4ecf52faf429e63351bbcd5c (diff)
downloadcpython-e1d5dd645d5f59867cb0ad63179110f310cbca89.zip
cpython-e1d5dd645d5f59867cb0ad63179110f310cbca89.tar.gz
cpython-e1d5dd645d5f59867cb0ad63179110f310cbca89.tar.bz2
bpo-13611: C14N 2.0 implementation for ElementTree (GH-12966)
* Implement C14N 2.0 as a new canonicalize() function in ElementTree. Missing features: - prefix renaming in XPath expressions (tag and attribute text is supported) - preservation of original prefixes given redundant namespace declarations
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_xml_etree.py229
-rw-r--r--Lib/test/xmltestdata/c14n-20/c14nComment.xml4
-rw-r--r--Lib/test/xmltestdata/c14n-20/c14nDefault.xml3
-rw-r--r--Lib/test/xmltestdata/c14n-20/c14nPrefix.xml4
-rw-r--r--Lib/test/xmltestdata/c14n-20/c14nPrefixQname.xml7
-rw-r--r--Lib/test/xmltestdata/c14n-20/c14nPrefixQnameXpathElem.xml8
-rw-r--r--Lib/test/xmltestdata/c14n-20/c14nQname.xml6
-rw-r--r--Lib/test/xmltestdata/c14n-20/c14nQnameElem.xml6
-rw-r--r--Lib/test/xmltestdata/c14n-20/c14nQnameXpathElem.xml7
-rw-r--r--Lib/test/xmltestdata/c14n-20/c14nTrim.xml4
-rw-r--r--Lib/test/xmltestdata/c14n-20/doc.dtd6
-rw-r--r--Lib/test/xmltestdata/c14n-20/doc.xsl5
-rw-r--r--Lib/test/xmltestdata/c14n-20/inC14N1.xml14
-rw-r--r--Lib/test/xmltestdata/c14n-20/inC14N2.xml11
-rw-r--r--Lib/test/xmltestdata/c14n-20/inC14N3.xml18
-rw-r--r--Lib/test/xmltestdata/c14n-20/inC14N4.xml13
-rw-r--r--Lib/test/xmltestdata/c14n-20/inC14N5.xml12
-rw-r--r--Lib/test/xmltestdata/c14n-20/inC14N6.xml2
-rw-r--r--Lib/test/xmltestdata/c14n-20/inNsContent.xml4
-rw-r--r--Lib/test/xmltestdata/c14n-20/inNsDefault.xml3
-rw-r--r--Lib/test/xmltestdata/c14n-20/inNsPushdown.xml6
-rw-r--r--Lib/test/xmltestdata/c14n-20/inNsRedecl.xml3
-rw-r--r--Lib/test/xmltestdata/c14n-20/inNsSort.xml4
-rw-r--r--Lib/test/xmltestdata/c14n-20/inNsSuperfluous.xml4
-rw-r--r--Lib/test/xmltestdata/c14n-20/inNsXml.xml3
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inC14N1_c14nComment.xml6
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inC14N1_c14nDefault.xml4
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inC14N2_c14nDefault.xml11
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inC14N2_c14nTrim.xml1
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inC14N3_c14nDefault.xml14
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inC14N3_c14nPrefix.xml14
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inC14N3_c14nTrim.xml1
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inC14N4_c14nDefault.xml10
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inC14N4_c14nTrim.xml2
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inC14N5_c14nDefault.xml3
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inC14N5_c14nTrim.xml1
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inC14N6_c14nDefault.xml1
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inNsContent_c14nDefault.xml4
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inNsContent_c14nPrefixQnameXpathElem.xml4
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inNsContent_c14nQnameElem.xml4
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inNsContent_c14nQnameXpathElem.xml4
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inNsDefault_c14nDefault.xml3
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inNsDefault_c14nPrefix.xml3
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inNsPushdown_c14nDefault.xml6
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inNsPushdown_c14nPrefix.xml6
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inNsRedecl_c14nDefault.xml3
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inNsRedecl_c14nPrefix.xml3
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inNsSort_c14nDefault.xml4
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inNsSort_c14nPrefix.xml4
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inNsSuperfluous_c14nDefault.xml4
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inNsSuperfluous_c14nPrefix.xml4
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inNsXml_c14nDefault.xml3
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inNsXml_c14nPrefix.xml3
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inNsXml_c14nPrefixQname.xml3
-rw-r--r--Lib/test/xmltestdata/c14n-20/out_inNsXml_c14nQname.xml3
-rw-r--r--Lib/test/xmltestdata/c14n-20/world.txt1
56 files changed, 523 insertions, 0 deletions
diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py
index 0abc42a..a59a11f 100644
--- a/Lib/test/test_xml_etree.py
+++ b/Lib/test/test_xml_etree.py
@@ -12,6 +12,7 @@ import io
import itertools
import locale
import operator
+import os
import pickle
import sys
import textwrap
@@ -20,6 +21,7 @@ import unittest
import warnings
import weakref
+from functools import partial
from itertools import product, islice
from test import support
from test.support import TESTFN, findfile, import_fresh_module, gc_collect, swap_attr
@@ -3527,6 +3529,231 @@ class NoAcceleratorTest(unittest.TestCase):
self.assertIsInstance(pyET.Element.__init__, types.FunctionType)
self.assertIsInstance(pyET.XMLParser.__init__, types.FunctionType)
+
+# --------------------------------------------------------------------
+
+def c14n_roundtrip(xml, **options):
+ return pyET.canonicalize(xml, **options)
+
+
+class C14NTest(unittest.TestCase):
+ maxDiff = None
+
+ #
+ # simple roundtrip tests (from c14n.py)
+
+ def test_simple_roundtrip(self):
+ # Basics
+ self.assertEqual(c14n_roundtrip("<doc/>"), '<doc></doc>')
+ self.assertEqual(c14n_roundtrip("<doc xmlns='uri'/>"), # FIXME
+ '<doc xmlns="uri"></doc>')
+ self.assertEqual(c14n_roundtrip("<prefix:doc xmlns:prefix='uri'/>"),
+ '<prefix:doc xmlns:prefix="uri"></prefix:doc>')
+ self.assertEqual(c14n_roundtrip("<doc xmlns:prefix='uri'><prefix:bar/></doc>"),
+ '<doc><prefix:bar xmlns:prefix="uri"></prefix:bar></doc>')
+ self.assertEqual(c14n_roundtrip("<elem xmlns:wsu='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd' xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' />"),
+ '<elem></elem>')
+
+ # C14N spec
+ self.assertEqual(c14n_roundtrip("<doc>Hello, world!<!-- Comment 1 --></doc>"),
+ '<doc>Hello, world!</doc>')
+ self.assertEqual(c14n_roundtrip("<value>&#x32;</value>"),
+ '<value>2</value>')
+ self.assertEqual(c14n_roundtrip('<compute><![CDATA[value>"0" && value<"10" ?"valid":"error"]]></compute>'),
+ '<compute>value&gt;"0" &amp;&amp; value&lt;"10" ?"valid":"error"</compute>')
+ self.assertEqual(c14n_roundtrip('''<compute expr='value>"0" &amp;&amp; value&lt;"10" ?"valid":"error"'>valid</compute>'''),
+ '<compute expr="value>&quot;0&quot; &amp;&amp; value&lt;&quot;10&quot; ?&quot;valid&quot;:&quot;error&quot;">valid</compute>')
+ self.assertEqual(c14n_roundtrip("<norm attr=' &apos; &#x20;&#13;&#xa;&#9; &apos; '/>"),
+ '<norm attr=" \' &#xD;&#xA;&#x9; \' "></norm>')
+ self.assertEqual(c14n_roundtrip("<normNames attr=' A &#x20;&#13;&#xa;&#9; B '/>"),
+ '<normNames attr=" A &#xD;&#xA;&#x9; B "></normNames>')
+ self.assertEqual(c14n_roundtrip("<normId id=' &apos; &#x20;&#13;&#xa;&#9; &apos; '/>"),
+ '<normId id=" \' &#xD;&#xA;&#x9; \' "></normId>')
+
+ # fragments from PJ's tests
+ #self.assertEqual(c14n_roundtrip("<doc xmlns:x='http://example.com/x' xmlns='http://example.com/default'><b y:a1='1' xmlns='http://example.com/default' a3='3' xmlns:y='http://example.com/y' y:a2='2'/></doc>"),
+ #'<doc xmlns:x="http://example.com/x"><b xmlns:y="http://example.com/y" a3="3" y:a1="1" y:a2="2"></b></doc>')
+
+ def test_c14n_exclusion(self):
+ xml = textwrap.dedent("""\
+ <root xmlns:x="http://example.com/x">
+ <a x:attr="attrx">
+ <b>abtext</b>
+ </a>
+ <b>btext</b>
+ <c>
+ <x:d>dtext</x:d>
+ </c>
+ </root>
+ """)
+ self.assertEqual(
+ c14n_roundtrip(xml, strip_text=True),
+ '<root>'
+ '<a xmlns:x="http://example.com/x" x:attr="attrx"><b>abtext</b></a>'
+ '<b>btext</b>'
+ '<c><x:d xmlns:x="http://example.com/x">dtext</x:d></c>'
+ '</root>')
+ self.assertEqual(
+ c14n_roundtrip(xml, strip_text=True, exclude_attrs=['{http://example.com/x}attr']),
+ '<root>'
+ '<a><b>abtext</b></a>'
+ '<b>btext</b>'
+ '<c><x:d xmlns:x="http://example.com/x">dtext</x:d></c>'
+ '</root>')
+ self.assertEqual(
+ c14n_roundtrip(xml, strip_text=True, exclude_tags=['{http://example.com/x}d']),
+ '<root>'
+ '<a xmlns:x="http://example.com/x" x:attr="attrx"><b>abtext</b></a>'
+ '<b>btext</b>'
+ '<c></c>'
+ '</root>')
+ self.assertEqual(
+ c14n_roundtrip(xml, strip_text=True, exclude_attrs=['{http://example.com/x}attr'],
+ exclude_tags=['{http://example.com/x}d']),
+ '<root>'
+ '<a><b>abtext</b></a>'
+ '<b>btext</b>'
+ '<c></c>'
+ '</root>')
+ self.assertEqual(
+ c14n_roundtrip(xml, strip_text=True, exclude_tags=['a', 'b']),
+ '<root>'
+ '<c><x:d xmlns:x="http://example.com/x">dtext</x:d></c>'
+ '</root>')
+ self.assertEqual(
+ c14n_roundtrip(xml, exclude_tags=['a', 'b']),
+ '<root>\n'
+ ' \n'
+ ' \n'
+ ' <c>\n'
+ ' <x:d xmlns:x="http://example.com/x">dtext</x:d>\n'
+ ' </c>\n'
+ '</root>')
+ self.assertEqual(
+ c14n_roundtrip(xml, strip_text=True, exclude_tags=['{http://example.com/x}d', 'b']),
+ '<root>'
+ '<a xmlns:x="http://example.com/x" x:attr="attrx"></a>'
+ '<c></c>'
+ '</root>')
+ self.assertEqual(
+ c14n_roundtrip(xml, exclude_tags=['{http://example.com/x}d', 'b']),
+ '<root>\n'
+ ' <a xmlns:x="http://example.com/x" x:attr="attrx">\n'
+ ' \n'
+ ' </a>\n'
+ ' \n'
+ ' <c>\n'
+ ' \n'
+ ' </c>\n'
+ '</root>')
+
+ #
+ # basic method=c14n tests from the c14n 2.0 specification. uses
+ # test files under xmltestdata/c14n-20.
+
+ # note that this uses generated C14N versions of the standard ET.write
+ # output, not roundtripped C14N (see above).
+
+ def test_xml_c14n2(self):
+ datadir = findfile("c14n-20", subdir="xmltestdata")
+ full_path = partial(os.path.join, datadir)
+
+ files = [filename[:-4] for filename in sorted(os.listdir(datadir))
+ if filename.endswith('.xml')]
+ input_files = [
+ filename for filename in files
+ if filename.startswith('in')
+ ]
+ configs = {
+ filename: {
+ # <c14n2:PrefixRewrite>sequential</c14n2:PrefixRewrite>
+ option.tag.split('}')[-1]: ((option.text or '').strip(), option)
+ for option in ET.parse(full_path(filename) + ".xml").getroot()
+ }
+ for filename in files
+ if filename.startswith('c14n')
+ }
+
+ tests = {
+ input_file: [
+ (filename, configs[filename.rsplit('_', 1)[-1]])
+ for filename in files
+ if filename.startswith(f'out_{input_file}_')
+ and filename.rsplit('_', 1)[-1] in configs
+ ]
+ for input_file in input_files
+ }
+
+ # Make sure we found all test cases.
+ self.assertEqual(30, len([
+ output_file for output_files in tests.values()
+ for output_file in output_files]))
+
+ def get_option(config, option_name, default=None):
+ return config.get(option_name, (default, ()))[0]
+
+ for input_file, output_files in tests.items():
+ for output_file, config in output_files:
+ keep_comments = get_option(
+ config, 'IgnoreComments') == 'true' # no, it's right :)
+ strip_text = get_option(
+ config, 'TrimTextNodes') == 'true'
+ rewrite_prefixes = get_option(
+ config, 'PrefixRewrite') == 'sequential'
+ if 'QNameAware' in config:
+ qattrs = [
+ f"{{{el.get('NS')}}}{el.get('Name')}"
+ for el in config['QNameAware'][1].findall(
+ '{http://www.w3.org/2010/xml-c14n2}QualifiedAttr')
+ ]
+ qtags = [
+ f"{{{el.get('NS')}}}{el.get('Name')}"
+ for el in config['QNameAware'][1].findall(
+ '{http://www.w3.org/2010/xml-c14n2}Element')
+ ]
+ else:
+ qtags = qattrs = None
+
+ # Build subtest description from config.
+ config_descr = ','.join(
+ f"{name}={value or ','.join(c.tag.split('}')[-1] for c in children)}"
+ for name, (value, children) in sorted(config.items())
+ )
+
+ with self.subTest(f"{output_file}({config_descr})"):
+ if input_file == 'inNsRedecl' and not rewrite_prefixes:
+ self.skipTest(
+ f"Redeclared namespace handling is not supported in {output_file}")
+ if input_file == 'inNsSuperfluous' and not rewrite_prefixes:
+ self.skipTest(
+ f"Redeclared namespace handling is not supported in {output_file}")
+ if 'QNameAware' in config and config['QNameAware'][1].find(
+ '{http://www.w3.org/2010/xml-c14n2}XPathElement') is not None:
+ self.skipTest(
+ f"QName rewriting in XPath text is not supported in {output_file}")
+
+ f = full_path(input_file + ".xml")
+ if input_file == 'inC14N5':
+ # Hack: avoid setting up external entity resolution in the parser.
+ with open(full_path('world.txt'), 'rb') as entity_file:
+ with open(f, 'rb') as f:
+ f = io.BytesIO(f.read().replace(b'&ent2;', entity_file.read()))
+
+ text = ET.canonicalize(
+ from_file=f,
+ with_comments=keep_comments,
+ strip_text=strip_text,
+ rewrite_prefixes=rewrite_prefixes,
+ qname_aware_tags=qtags, qname_aware_attrs=qattrs)
+
+ with open(full_path(output_file + ".xml"), 'r', encoding='utf8') as f:
+ expected = f.read()
+ if input_file == 'inC14N3':
+ # FIXME: cET resolves default attributes but ET does not!
+ expected = expected.replace(' attr="default"', '')
+ text = text.replace(' attr="default"', '')
+ self.assertEqual(expected, text)
+
# --------------------------------------------------------------------
@@ -3559,6 +3786,8 @@ def test_main(module=None):
XMLParserTest,
XMLPullParserTest,
BugsTest,
+ KeywordArgsTest,
+ C14NTest,
]
# These tests will only run for the pure-Python version that doesn't import
diff --git a/Lib/test/xmltestdata/c14n-20/c14nComment.xml b/Lib/test/xmltestdata/c14n-20/c14nComment.xml
new file mode 100644
index 0000000..e95aa30
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/c14nComment.xml
@@ -0,0 +1,4 @@
+<dsig:CanonicalizationMethod xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:c14n2="http://www.w3.org/2010/xml-c14n2" Algorithm="http://www.w3.org/2010/xml-c14n2">
+ <c14n2:IgnoreComments>true</c14n2:IgnoreComments>
+</dsig:CanonicalizationMethod>
+
diff --git a/Lib/test/xmltestdata/c14n-20/c14nDefault.xml b/Lib/test/xmltestdata/c14n-20/c14nDefault.xml
new file mode 100644
index 0000000..c136414
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/c14nDefault.xml
@@ -0,0 +1,3 @@
+<dsig:CanonicalizationMethod xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" Algorithm="http://www.w3.org/2010/xml-c14n2">
+</dsig:CanonicalizationMethod>
+
diff --git a/Lib/test/xmltestdata/c14n-20/c14nPrefix.xml b/Lib/test/xmltestdata/c14n-20/c14nPrefix.xml
new file mode 100644
index 0000000..fb233b4
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/c14nPrefix.xml
@@ -0,0 +1,4 @@
+<dsig:CanonicalizationMethod xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:c14n2="http://www.w3.org/2010/xml-c14n2" Algorithm="http://www.w3.org/2010/xml-c14n2">
+ <c14n2:PrefixRewrite>sequential</c14n2:PrefixRewrite>
+</dsig:CanonicalizationMethod>
+
diff --git a/Lib/test/xmltestdata/c14n-20/c14nPrefixQname.xml b/Lib/test/xmltestdata/c14n-20/c14nPrefixQname.xml
new file mode 100644
index 0000000..23188ee
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/c14nPrefixQname.xml
@@ -0,0 +1,7 @@
+<dsig:CanonicalizationMethod xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:c14n2="http://www.w3.org/2010/xml-c14n2" Algorithm="http://www.w3.org/2010/xml-c14n2">
+ <c14n2:PrefixRewrite>sequential</c14n2:PrefixRewrite>
+ <c14n2:QNameAware>
+ <c14n2:QualifiedAttr Name="type" NS="http://www.w3.org/2001/XMLSchema-instance"/>
+ </c14n2:QNameAware>
+</dsig:CanonicalizationMethod>
+
diff --git a/Lib/test/xmltestdata/c14n-20/c14nPrefixQnameXpathElem.xml b/Lib/test/xmltestdata/c14n-20/c14nPrefixQnameXpathElem.xml
new file mode 100644
index 0000000..626fc48
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/c14nPrefixQnameXpathElem.xml
@@ -0,0 +1,8 @@
+<dsig:CanonicalizationMethod xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:c14n2="http://www.w3.org/2010/xml-c14n2" Algorithm="http://www.w3.org/2010/xml-c14n2">
+ <c14n2:PrefixRewrite>sequential</c14n2:PrefixRewrite>
+ <c14n2:QNameAware>
+ <c14n2:Element Name="bar" NS="http://a"/>
+ <c14n2:XPathElement Name="IncludedXPath" NS="http://www.w3.org/2010/xmldsig2#"/>
+ </c14n2:QNameAware>
+</dsig:CanonicalizationMethod>
+
diff --git a/Lib/test/xmltestdata/c14n-20/c14nQname.xml b/Lib/test/xmltestdata/c14n-20/c14nQname.xml
new file mode 100644
index 0000000..919e590
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/c14nQname.xml
@@ -0,0 +1,6 @@
+<dsig:CanonicalizationMethod xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:c14n2="http://www.w3.org/2010/xml-c14n2" Algorithm="http://www.w3.org/2010/xml-c14n2">
+ <c14n2:QNameAware>
+ <c14n2:QualifiedAttr Name="type" NS="http://www.w3.org/2001/XMLSchema-instance"/>
+ </c14n2:QNameAware>
+</dsig:CanonicalizationMethod>
+
diff --git a/Lib/test/xmltestdata/c14n-20/c14nQnameElem.xml b/Lib/test/xmltestdata/c14n-20/c14nQnameElem.xml
new file mode 100644
index 0000000..0321f80
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/c14nQnameElem.xml
@@ -0,0 +1,6 @@
+<dsig:CanonicalizationMethod xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:c14n2="http://www.w3.org/2010/xml-c14n2" Algorithm="http://www.w3.org/2010/xml-c14n2">
+ <c14n2:QNameAware>
+ <c14n2:Element Name="bar" NS="http://a"/>
+ </c14n2:QNameAware>
+</dsig:CanonicalizationMethod>
+
diff --git a/Lib/test/xmltestdata/c14n-20/c14nQnameXpathElem.xml b/Lib/test/xmltestdata/c14n-20/c14nQnameXpathElem.xml
new file mode 100644
index 0000000..c4890bc
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/c14nQnameXpathElem.xml
@@ -0,0 +1,7 @@
+<dsig:CanonicalizationMethod xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:c14n2="http://www.w3.org/2010/xml-c14n2" Algorithm="http://www.w3.org/2010/xml-c14n2">
+ <c14n2:QNameAware>
+ <c14n2:Element Name="bar" NS="http://a"/>
+ <c14n2:XPathElement Name="IncludedXPath" NS="http://www.w3.org/2010/xmldsig2#"/>
+ </c14n2:QNameAware>
+</dsig:CanonicalizationMethod>
+
diff --git a/Lib/test/xmltestdata/c14n-20/c14nTrim.xml b/Lib/test/xmltestdata/c14n-20/c14nTrim.xml
new file mode 100644
index 0000000..ccb9cf6
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/c14nTrim.xml
@@ -0,0 +1,4 @@
+<dsig:CanonicalizationMethod xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:c14n2="http://www.w3.org/2010/xml-c14n2" Algorithm="http://www.w3.org/2010/xml-c14n2">
+ <c14n2:TrimTextNodes>true</c14n2:TrimTextNodes>
+</dsig:CanonicalizationMethod>
+
diff --git a/Lib/test/xmltestdata/c14n-20/doc.dtd b/Lib/test/xmltestdata/c14n-20/doc.dtd
new file mode 100644
index 0000000..5c5d544
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/doc.dtd
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!ELEMENT doc (#PCDATA)>
+
+
+
diff --git a/Lib/test/xmltestdata/c14n-20/doc.xsl b/Lib/test/xmltestdata/c14n-20/doc.xsl
new file mode 100644
index 0000000..a3f2348
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/doc.xsl
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ >
+</xsl:stylesheet>
diff --git a/Lib/test/xmltestdata/c14n-20/inC14N1.xml b/Lib/test/xmltestdata/c14n-20/inC14N1.xml
new file mode 100644
index 0000000..ed450c7
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/inC14N1.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+
+<?xml-stylesheet href="doc.xsl"
+ type="text/xsl" ?>
+
+<!DOCTYPE doc SYSTEM "doc.dtd">
+
+<doc>Hello, world!<!-- Comment 1 --></doc>
+
+<?pi-without-data ?>
+
+<!-- Comment 2 -->
+
+<!-- Comment 3 -->
diff --git a/Lib/test/xmltestdata/c14n-20/inC14N2.xml b/Lib/test/xmltestdata/c14n-20/inC14N2.xml
new file mode 100644
index 0000000..74eeea1
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/inC14N2.xml
@@ -0,0 +1,11 @@
+<doc>
+ <clean> </clean>
+ <dirty> A B </dirty>
+ <mixed>
+ A
+ <clean> </clean>
+ B
+ <dirty> A B </dirty>
+ C
+ </mixed>
+</doc>
diff --git a/Lib/test/xmltestdata/c14n-20/inC14N3.xml b/Lib/test/xmltestdata/c14n-20/inC14N3.xml
new file mode 100644
index 0000000..fea7821
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/inC14N3.xml
@@ -0,0 +1,18 @@
+<!DOCTYPE doc [<!ATTLIST e9 attr CDATA "default">]>
+<doc>
+ <e1 />
+ <e2 ></e2>
+ <e3 name = "elem3" id="elem3" />
+ <e4 name="elem4" id="elem4" ></e4>
+ <e5 a:attr="out" b:attr="sorted" attr2="all" attr="I'm"
+ xmlns:b="http://www.ietf.org"
+ xmlns:a="http://www.w3.org"
+ xmlns="http://example.org"/>
+ <e6 xmlns="" xmlns:a="http://www.w3.org">
+ <e7 xmlns="http://www.ietf.org">
+ <e8 xmlns="" xmlns:a="http://www.w3.org">
+ <e9 xmlns="" xmlns:a="http://www.ietf.org"/>
+ </e8>
+ </e7>
+ </e6>
+</doc>
diff --git a/Lib/test/xmltestdata/c14n-20/inC14N4.xml b/Lib/test/xmltestdata/c14n-20/inC14N4.xml
new file mode 100644
index 0000000..909a847
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/inC14N4.xml
@@ -0,0 +1,13 @@
+<!DOCTYPE doc [
+<!ATTLIST normId id ID #IMPLIED>
+<!ATTLIST normNames attr NMTOKENS #IMPLIED>
+]>
+<doc>
+ <text>First line&#x0d;&#10;Second line</text>
+ <value>&#x32;</value>
+ <compute><![CDATA[value>"0" && value<"10" ?"valid":"error"]]></compute>
+ <compute expr='value>"0" &amp;&amp; value&lt;"10" ?"valid":"error"'>valid</compute>
+ <norm attr=' &apos; &#x20;&#13;&#xa;&#9; &apos; '/>
+ <normNames attr=' A &#x20;&#13;&#xa;&#9; B '/>
+ <normId id=' &apos;&#x20;&#13;&#xa;&#9; &apos; '/>
+</doc>
diff --git a/Lib/test/xmltestdata/c14n-20/inC14N5.xml b/Lib/test/xmltestdata/c14n-20/inC14N5.xml
new file mode 100644
index 0000000..501161b
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/inC14N5.xml
@@ -0,0 +1,12 @@
+<!DOCTYPE doc [
+<!ATTLIST doc attrExtEnt CDATA #IMPLIED>
+<!ENTITY ent1 "Hello">
+<!ENTITY ent2 SYSTEM "world.txt">
+<!ENTITY entExt SYSTEM "earth.gif" NDATA gif>
+<!NOTATION gif SYSTEM "viewgif.exe">
+]>
+<doc attrExtEnt="entExt">
+ &ent1;, &ent2;!
+</doc>
+
+<!-- Let world.txt contain "world" (excluding the quotes) -->
diff --git a/Lib/test/xmltestdata/c14n-20/inC14N6.xml b/Lib/test/xmltestdata/c14n-20/inC14N6.xml
new file mode 100644
index 0000000..31e2071
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/inC14N6.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<doc>&#169;</doc>
diff --git a/Lib/test/xmltestdata/c14n-20/inNsContent.xml b/Lib/test/xmltestdata/c14n-20/inNsContent.xml
new file mode 100644
index 0000000..b992466
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/inNsContent.xml
@@ -0,0 +1,4 @@
+<a:foo xmlns:a="http://a" xmlns:b="http://b" xmlns:child="http://c" xmlns:soap-env="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <a:bar>xsd:string</a:bar>
+ <dsig2:IncludedXPath xmlns:dsig2="http://www.w3.org/2010/xmldsig2#">/soap-env:body/child::b:foo[@att1 != "c:val" and @att2 != 'xsd:string']</dsig2:IncludedXPath>
+</a:foo>
diff --git a/Lib/test/xmltestdata/c14n-20/inNsDefault.xml b/Lib/test/xmltestdata/c14n-20/inNsDefault.xml
new file mode 100644
index 0000000..3e0d323
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/inNsDefault.xml
@@ -0,0 +1,3 @@
+<foo xmlns:a="http://a" xmlns:b="http://b">
+ <b:bar b:att1="val" att2="val"/>
+</foo>
diff --git a/Lib/test/xmltestdata/c14n-20/inNsPushdown.xml b/Lib/test/xmltestdata/c14n-20/inNsPushdown.xml
new file mode 100644
index 0000000..daa67d8
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/inNsPushdown.xml
@@ -0,0 +1,6 @@
+<a:foo xmlns:a="http://a" xmlns:b="http://b" xmlns:c="http://c">
+ <b:bar/>
+ <b:bar/>
+ <b:bar/>
+ <a:bar b:att1="val"/>
+</a:foo>
diff --git a/Lib/test/xmltestdata/c14n-20/inNsRedecl.xml b/Lib/test/xmltestdata/c14n-20/inNsRedecl.xml
new file mode 100644
index 0000000..10bd97b
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/inNsRedecl.xml
@@ -0,0 +1,3 @@
+<foo xmlns:a="http://z3" xmlns:b="http://z2" a:att1="val1" b:att2="val2">
+ <bar xmlns="http://z0" xmlns:a="http://z2" a:att1="val1" b:att2="val2" xmlns:b="http://z3" />
+</foo>
diff --git a/Lib/test/xmltestdata/c14n-20/inNsSort.xml b/Lib/test/xmltestdata/c14n-20/inNsSort.xml
new file mode 100644
index 0000000..8e9fc01
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/inNsSort.xml
@@ -0,0 +1,4 @@
+<a:foo xmlns:a="http://z3" xmlns:b="http://z2" b:att1="val1" c:att3="val3" b:att2="val2" xmlns:c="http://z1" xmlns:d="http://z0">
+ <c:bar/>
+ <c:bar d:att3="val3"/>
+</a:foo>
diff --git a/Lib/test/xmltestdata/c14n-20/inNsSuperfluous.xml b/Lib/test/xmltestdata/c14n-20/inNsSuperfluous.xml
new file mode 100644
index 0000000..f77720f
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/inNsSuperfluous.xml
@@ -0,0 +1,4 @@
+<foo xmlns:a="http://z0" xmlns:b="http://z0" a:att1="val1" b:att2="val2" xmlns="http://z0">
+ <c:bar xmlns:a="http://z0" xmlns:c="http://z0" c:att3="val3"/>
+ <d:bar xmlns:d="http://z0"/>
+</foo>
diff --git a/Lib/test/xmltestdata/c14n-20/inNsXml.xml b/Lib/test/xmltestdata/c14n-20/inNsXml.xml
new file mode 100644
index 0000000..7520cf3
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/inNsXml.xml
@@ -0,0 +1,3 @@
+<foo xmlns="http://z0" xml:id="23">
+ <bar xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">data</bar>
+</foo>
diff --git a/Lib/test/xmltestdata/c14n-20/out_inC14N1_c14nComment.xml b/Lib/test/xmltestdata/c14n-20/out_inC14N1_c14nComment.xml
new file mode 100644
index 0000000..d98d168
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inC14N1_c14nComment.xml
@@ -0,0 +1,6 @@
+<?xml-stylesheet href="doc.xsl"
+ type="text/xsl" ?>
+<doc>Hello, world!<!-- Comment 1 --></doc>
+<?pi-without-data?>
+<!-- Comment 2 -->
+<!-- Comment 3 --> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inC14N1_c14nDefault.xml b/Lib/test/xmltestdata/c14n-20/out_inC14N1_c14nDefault.xml
new file mode 100644
index 0000000..af9a977
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inC14N1_c14nDefault.xml
@@ -0,0 +1,4 @@
+<?xml-stylesheet href="doc.xsl"
+ type="text/xsl" ?>
+<doc>Hello, world!</doc>
+<?pi-without-data?> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inC14N2_c14nDefault.xml b/Lib/test/xmltestdata/c14n-20/out_inC14N2_c14nDefault.xml
new file mode 100644
index 0000000..2afa15c
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inC14N2_c14nDefault.xml
@@ -0,0 +1,11 @@
+<doc>
+ <clean> </clean>
+ <dirty> A B </dirty>
+ <mixed>
+ A
+ <clean> </clean>
+ B
+ <dirty> A B </dirty>
+ C
+ </mixed>
+</doc> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inC14N2_c14nTrim.xml b/Lib/test/xmltestdata/c14n-20/out_inC14N2_c14nTrim.xml
new file mode 100644
index 0000000..7a1dc32
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inC14N2_c14nTrim.xml
@@ -0,0 +1 @@
+<doc><clean></clean><dirty>A B</dirty><mixed>A<clean></clean>B<dirty>A B</dirty>C</mixed></doc> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inC14N3_c14nDefault.xml b/Lib/test/xmltestdata/c14n-20/out_inC14N3_c14nDefault.xml
new file mode 100644
index 0000000..662e108
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inC14N3_c14nDefault.xml
@@ -0,0 +1,14 @@
+<doc>
+ <e1></e1>
+ <e2></e2>
+ <e3 id="elem3" name="elem3"></e3>
+ <e4 id="elem4" name="elem4"></e4>
+ <e5 xmlns="http://example.org" xmlns:a="http://www.w3.org" xmlns:b="http://www.ietf.org" attr="I'm" attr2="all" b:attr="sorted" a:attr="out"></e5>
+ <e6>
+ <e7 xmlns="http://www.ietf.org">
+ <e8 xmlns="">
+ <e9 attr="default"></e9>
+ </e8>
+ </e7>
+ </e6>
+</doc> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inC14N3_c14nPrefix.xml b/Lib/test/xmltestdata/c14n-20/out_inC14N3_c14nPrefix.xml
new file mode 100644
index 0000000..041e1ec
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inC14N3_c14nPrefix.xml
@@ -0,0 +1,14 @@
+<n0:doc xmlns:n0="">
+ <n0:e1></n0:e1>
+ <n0:e2></n0:e2>
+ <n0:e3 id="elem3" name="elem3"></n0:e3>
+ <n0:e4 id="elem4" name="elem4"></n0:e4>
+ <n1:e5 xmlns:n1="http://example.org" xmlns:n2="http://www.ietf.org" xmlns:n3="http://www.w3.org" attr="I'm" attr2="all" n2:attr="sorted" n3:attr="out"></n1:e5>
+ <n0:e6>
+ <n2:e7 xmlns:n2="http://www.ietf.org">
+ <n0:e8>
+ <n0:e9 attr="default"></n0:e9>
+ </n0:e8>
+ </n2:e7>
+ </n0:e6>
+</n0:doc> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inC14N3_c14nTrim.xml b/Lib/test/xmltestdata/c14n-20/out_inC14N3_c14nTrim.xml
new file mode 100644
index 0000000..4f35ad9
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inC14N3_c14nTrim.xml
@@ -0,0 +1 @@
+<doc><e1></e1><e2></e2><e3 id="elem3" name="elem3"></e3><e4 id="elem4" name="elem4"></e4><e5 xmlns="http://example.org" xmlns:a="http://www.w3.org" xmlns:b="http://www.ietf.org" attr="I'm" attr2="all" b:attr="sorted" a:attr="out"></e5><e6><e7 xmlns="http://www.ietf.org"><e8 xmlns=""><e9 attr="default"></e9></e8></e7></e6></doc> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inC14N4_c14nDefault.xml b/Lib/test/xmltestdata/c14n-20/out_inC14N4_c14nDefault.xml
new file mode 100644
index 0000000..243d0e6
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inC14N4_c14nDefault.xml
@@ -0,0 +1,10 @@
+<doc>
+ <text>First line&#xD;
+Second line</text>
+ <value>2</value>
+ <compute>value&gt;"0" &amp;&amp; value&lt;"10" ?"valid":"error"</compute>
+ <compute expr="value>&quot;0&quot; &amp;&amp; value&lt;&quot;10&quot; ?&quot;valid&quot;:&quot;error&quot;">valid</compute>
+ <norm attr=" ' &#xD;&#xA;&#x9; ' "></norm>
+ <normNames attr="A &#xD;&#xA;&#x9; B"></normNames>
+ <normId id="' &#xD;&#xA;&#x9; '"></normId>
+</doc> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inC14N4_c14nTrim.xml b/Lib/test/xmltestdata/c14n-20/out_inC14N4_c14nTrim.xml
new file mode 100644
index 0000000..24d83ba
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inC14N4_c14nTrim.xml
@@ -0,0 +1,2 @@
+<doc><text>First line&#xD;
+Second line</text><value>2</value><compute>value&gt;"0" &amp;&amp; value&lt;"10" ?"valid":"error"</compute><compute expr="value>&quot;0&quot; &amp;&amp; value&lt;&quot;10&quot; ?&quot;valid&quot;:&quot;error&quot;">valid</compute><norm attr=" ' &#xD;&#xA;&#x9; ' "></norm><normNames attr="A &#xD;&#xA;&#x9; B"></normNames><normId id="' &#xD;&#xA;&#x9; '"></normId></doc> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inC14N5_c14nDefault.xml b/Lib/test/xmltestdata/c14n-20/out_inC14N5_c14nDefault.xml
new file mode 100644
index 0000000..c232e74
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inC14N5_c14nDefault.xml
@@ -0,0 +1,3 @@
+<doc attrExtEnt="entExt">
+ Hello, world!
+</doc> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inC14N5_c14nTrim.xml b/Lib/test/xmltestdata/c14n-20/out_inC14N5_c14nTrim.xml
new file mode 100644
index 0000000..3fa84b1
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inC14N5_c14nTrim.xml
@@ -0,0 +1 @@
+<doc attrExtEnt="entExt">Hello, world!</doc> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inC14N6_c14nDefault.xml b/Lib/test/xmltestdata/c14n-20/out_inC14N6_c14nDefault.xml
new file mode 100644
index 0000000..0be38f9
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inC14N6_c14nDefault.xml
@@ -0,0 +1 @@
+<doc>©</doc> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inNsContent_c14nDefault.xml b/Lib/test/xmltestdata/c14n-20/out_inNsContent_c14nDefault.xml
new file mode 100644
index 0000000..62d7e00
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inNsContent_c14nDefault.xml
@@ -0,0 +1,4 @@
+<a:foo xmlns:a="http://a">
+ <a:bar>xsd:string</a:bar>
+ <dsig2:IncludedXPath xmlns:dsig2="http://www.w3.org/2010/xmldsig2#">/soap-env:body/child::b:foo[@att1 != "c:val" and @att2 != 'xsd:string']</dsig2:IncludedXPath>
+</a:foo> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inNsContent_c14nPrefixQnameXpathElem.xml b/Lib/test/xmltestdata/c14n-20/out_inNsContent_c14nPrefixQnameXpathElem.xml
new file mode 100644
index 0000000..20e1c2e
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inNsContent_c14nPrefixQnameXpathElem.xml
@@ -0,0 +1,4 @@
+<n0:foo xmlns:n0="http://a">
+ <n0:bar xmlns:n1="http://www.w3.org/2001/XMLSchema">n1:string</n0:bar>
+ <n4:IncludedXPath xmlns:n2="http://b" xmlns:n3="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:n4="http://www.w3.org/2010/xmldsig2#">/n3:body/child::n2:foo[@att1 != "c:val" and @att2 != 'xsd:string']</n4:IncludedXPath>
+</n0:foo> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inNsContent_c14nQnameElem.xml b/Lib/test/xmltestdata/c14n-20/out_inNsContent_c14nQnameElem.xml
new file mode 100644
index 0000000..db8680d
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inNsContent_c14nQnameElem.xml
@@ -0,0 +1,4 @@
+<a:foo xmlns:a="http://a">
+ <a:bar xmlns:xsd="http://www.w3.org/2001/XMLSchema">xsd:string</a:bar>
+ <dsig2:IncludedXPath xmlns:dsig2="http://www.w3.org/2010/xmldsig2#">/soap-env:body/child::b:foo[@att1 != "c:val" and @att2 != 'xsd:string']</dsig2:IncludedXPath>
+</a:foo> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inNsContent_c14nQnameXpathElem.xml b/Lib/test/xmltestdata/c14n-20/out_inNsContent_c14nQnameXpathElem.xml
new file mode 100644
index 0000000..df3b215
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inNsContent_c14nQnameXpathElem.xml
@@ -0,0 +1,4 @@
+<a:foo xmlns:a="http://a">
+ <a:bar xmlns:xsd="http://www.w3.org/2001/XMLSchema">xsd:string</a:bar>
+ <dsig2:IncludedXPath xmlns:b="http://b" xmlns:dsig2="http://www.w3.org/2010/xmldsig2#" xmlns:soap-env="http://schemas.xmlsoap.org/wsdl/soap/">/soap-env:body/child::b:foo[@att1 != "c:val" and @att2 != 'xsd:string']</dsig2:IncludedXPath>
+</a:foo> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inNsDefault_c14nDefault.xml b/Lib/test/xmltestdata/c14n-20/out_inNsDefault_c14nDefault.xml
new file mode 100644
index 0000000..674b076
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inNsDefault_c14nDefault.xml
@@ -0,0 +1,3 @@
+<foo>
+ <b:bar xmlns:b="http://b" att2="val" b:att1="val"></b:bar>
+</foo> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inNsDefault_c14nPrefix.xml b/Lib/test/xmltestdata/c14n-20/out_inNsDefault_c14nPrefix.xml
new file mode 100644
index 0000000..83edaae
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inNsDefault_c14nPrefix.xml
@@ -0,0 +1,3 @@
+<n0:foo xmlns:n0="">
+ <n1:bar xmlns:n1="http://b" att2="val" n1:att1="val"></n1:bar>
+</n0:foo> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inNsPushdown_c14nDefault.xml b/Lib/test/xmltestdata/c14n-20/out_inNsPushdown_c14nDefault.xml
new file mode 100644
index 0000000..fa4f21b
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inNsPushdown_c14nDefault.xml
@@ -0,0 +1,6 @@
+<a:foo xmlns:a="http://a">
+ <b:bar xmlns:b="http://b"></b:bar>
+ <b:bar xmlns:b="http://b"></b:bar>
+ <b:bar xmlns:b="http://b"></b:bar>
+ <a:bar xmlns:b="http://b" b:att1="val"></a:bar>
+</a:foo> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inNsPushdown_c14nPrefix.xml b/Lib/test/xmltestdata/c14n-20/out_inNsPushdown_c14nPrefix.xml
new file mode 100644
index 0000000..6d57920
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inNsPushdown_c14nPrefix.xml
@@ -0,0 +1,6 @@
+<n0:foo xmlns:n0="http://a">
+ <n1:bar xmlns:n1="http://b"></n1:bar>
+ <n1:bar xmlns:n1="http://b"></n1:bar>
+ <n1:bar xmlns:n1="http://b"></n1:bar>
+ <n0:bar xmlns:n1="http://b" n1:att1="val"></n0:bar>
+</n0:foo> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inNsRedecl_c14nDefault.xml b/Lib/test/xmltestdata/c14n-20/out_inNsRedecl_c14nDefault.xml
new file mode 100644
index 0000000..ba37f92
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inNsRedecl_c14nDefault.xml
@@ -0,0 +1,3 @@
+<foo xmlns:a="http://z3" xmlns:b="http://z2" b:att2="val2" a:att1="val1">
+ <bar xmlns="http://z0" xmlns:a="http://z2" xmlns:b="http://z3" a:att1="val1" b:att2="val2"></bar>
+</foo> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inNsRedecl_c14nPrefix.xml b/Lib/test/xmltestdata/c14n-20/out_inNsRedecl_c14nPrefix.xml
new file mode 100644
index 0000000..af3bb2d
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inNsRedecl_c14nPrefix.xml
@@ -0,0 +1,3 @@
+<n0:foo xmlns:n0="" xmlns:n1="http://z2" xmlns:n2="http://z3" n1:att2="val2" n2:att1="val1">
+ <n3:bar xmlns:n3="http://z0" n1:att1="val1" n2:att2="val2"></n3:bar>
+</n0:foo> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inNsSort_c14nDefault.xml b/Lib/test/xmltestdata/c14n-20/out_inNsSort_c14nDefault.xml
new file mode 100644
index 0000000..8a92c5c
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inNsSort_c14nDefault.xml
@@ -0,0 +1,4 @@
+<a:foo xmlns:a="http://z3" xmlns:b="http://z2" xmlns:c="http://z1" c:att3="val3" b:att1="val1" b:att2="val2">
+ <c:bar></c:bar>
+ <c:bar xmlns:d="http://z0" d:att3="val3"></c:bar>
+</a:foo> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inNsSort_c14nPrefix.xml b/Lib/test/xmltestdata/c14n-20/out_inNsSort_c14nPrefix.xml
new file mode 100644
index 0000000..8d44c84
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inNsSort_c14nPrefix.xml
@@ -0,0 +1,4 @@
+<n2:foo xmlns:n0="http://z1" xmlns:n1="http://z2" xmlns:n2="http://z3" n0:att3="val3" n1:att1="val1" n1:att2="val2">
+ <n0:bar></n0:bar>
+ <n0:bar xmlns:n3="http://z0" n3:att3="val3"></n0:bar>
+</n2:foo> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inNsSuperfluous_c14nDefault.xml b/Lib/test/xmltestdata/c14n-20/out_inNsSuperfluous_c14nDefault.xml
new file mode 100644
index 0000000..6bb862d
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inNsSuperfluous_c14nDefault.xml
@@ -0,0 +1,4 @@
+<foo xmlns="http://z0" xmlns:a="http://z0" xmlns:b="http://z0" a:att1="val1" b:att2="val2">
+ <c:bar xmlns:c="http://z0" c:att3="val3"></c:bar>
+ <d:bar xmlns:d="http://z0"></d:bar>
+</foo> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inNsSuperfluous_c14nPrefix.xml b/Lib/test/xmltestdata/c14n-20/out_inNsSuperfluous_c14nPrefix.xml
new file mode 100644
index 0000000..700a16d
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inNsSuperfluous_c14nPrefix.xml
@@ -0,0 +1,4 @@
+<n0:foo xmlns:n0="http://z0" n0:att1="val1" n0:att2="val2">
+ <n0:bar n0:att3="val3"></n0:bar>
+ <n0:bar></n0:bar>
+</n0:foo> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inNsXml_c14nDefault.xml b/Lib/test/xmltestdata/c14n-20/out_inNsXml_c14nDefault.xml
new file mode 100644
index 0000000..1689f3b
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inNsXml_c14nDefault.xml
@@ -0,0 +1,3 @@
+<foo xmlns="http://z0" xml:id="23">
+ <bar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">data</bar>
+</foo> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inNsXml_c14nPrefix.xml b/Lib/test/xmltestdata/c14n-20/out_inNsXml_c14nPrefix.xml
new file mode 100644
index 0000000..38508a4
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inNsXml_c14nPrefix.xml
@@ -0,0 +1,3 @@
+<n0:foo xmlns:n0="http://z0" xml:id="23">
+ <n0:bar xmlns:n1="http://www.w3.org/2001/XMLSchema-instance" n1:type="xsd:string">data</n0:bar>
+</n0:foo> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inNsXml_c14nPrefixQname.xml b/Lib/test/xmltestdata/c14n-20/out_inNsXml_c14nPrefixQname.xml
new file mode 100644
index 0000000..867980f
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inNsXml_c14nPrefixQname.xml
@@ -0,0 +1,3 @@
+<n0:foo xmlns:n0="http://z0" xml:id="23">
+ <n0:bar xmlns:n1="http://www.w3.org/2001/XMLSchema" xmlns:n2="http://www.w3.org/2001/XMLSchema-instance" n2:type="n1:string">data</n0:bar>
+</n0:foo> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/out_inNsXml_c14nQname.xml b/Lib/test/xmltestdata/c14n-20/out_inNsXml_c14nQname.xml
new file mode 100644
index 0000000..0300f9d
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/out_inNsXml_c14nQname.xml
@@ -0,0 +1,3 @@
+<foo xmlns="http://z0" xml:id="23">
+ <bar xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">data</bar>
+</foo> \ No newline at end of file
diff --git a/Lib/test/xmltestdata/c14n-20/world.txt b/Lib/test/xmltestdata/c14n-20/world.txt
new file mode 100644
index 0000000..04fea06
--- /dev/null
+++ b/Lib/test/xmltestdata/c14n-20/world.txt
@@ -0,0 +1 @@
+world \ No newline at end of file