[Python-Dev] Bogus SAX test case

Lars Marius Garshol larsga@garshol.priv.no
27 Sep 2000 10:12:45 +0200

* Martin v. Loewis
| <?xml version="1.0" encoding="iso-8859-1"?>
| <ns:doc xmlns:ns1="http://www.python.org/xml-ns/saxtest/"><ns:doc/>
| (or, alternatively, the element could just be empty). Is that the
| XML that would produce above sequence of SAX events?

Nope, it's not.  No XML document could produce that particular
sequence of events.
| It seems to me that this XML is ill-formed, the namespace prefix ns
| is not defined here. Is that analysis correct? 

Not entirely.  The XML is perfectly well-formed, but it's not

| Furthermore, the test checks whether the generator produces
| <?xml version="1.0" encoding="iso-8859-1"?>
| <ns1:doc xmlns:ns1="http://www.python.org/xml-ns/saxtest/"></ns1:doc>
| It appears that the expected output is bogus; I'd rather expect to get
| the original document back.

What original document? :-)
| My proposal would be to correct the test case to pass "ns1:doc" as
| the qname, 

I see that as being the best fix, and have now committed it.

| and to correct the generator to output the qname if that was
| provided by the reader.

We could do that, but the namespace name and the qname are supposed to
be equivalent in any case, so I don't see any reason to change it.
One problem with making that change is that it no longer becomes
possible to roundtrip XML -> pyexpat -> SAX -> xmlgen -> XML because
pyexpat does not provide qnames.

--Lars M.