[XML-SIG] xml-schema parsing using minidom.

Thomas B. Passin tpassin@home.com
Mon, 3 Dec 2001 19:25:05 -0500


[Martin v. Loewis]

> > > That shouldn't be necessary, right? xmlns:xml does not need to be
> > > declared, it is available implicitly.
> > >
> > That's what I think too, but the minidom code actually checks for the
> > declaration and only accepts the correct namespace for it.  Should this
code
> > be removed?
>
> Can you please elaborate? I'm not sure what you are referring to: What
> code in minidom checks for what condition?
>

In minidom.py, class DomImplementation, the following code appears in my
copy:

        prefix, localname = _nssplit(qualifiedName)
        if prefix == "xml" \
           and namespaceURI != "http://www.w3.org/XML/1998/namespace":
            raise xml.dom.NamespaceErr("illegal use of 'xml' prefix")
        if prefix and not namespaceURI:
            raise xml.dom.NamespaceErr(
                "illegal use of prefix without namespaces")

This explicitly checks for the right xml: namespace uri and raises an
exception if it isn't found.  The minidom parser() method doesn't handle the
exception, which is what prevented Maharajan's .xsd file from getting parsed
by minidom (at least, when I added the namespace declaration,
minidom.parse() completed successfully).

Should this code be removed?

Cheers,

Tom P