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

Thomas B. Passin tpassin@home.com
Mon, 3 Dec 2001 00:26:33 -0500


Here's the problem.  The build.xsd file uses xml:lang, but the namespace is
not declared.   minidom looks for the correct namepspace for the "xml"
prefix (it is a reserved prefix).  If you add the declaration, minidom
parses it OK:

>>> xml.dom.minidom.parse("c:\\temp\\build.xsd")
<xml.dom.minidom.Document instance at 1ebc728>

Here's the start tag with the right namespace:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  targetNamespace="http://www.ss7-integration.org"
  xmlns="http://www.ss7-integration.org"
  xmlns:xml="http://www.w3.org/XML/1998/namespace"
  elementFormDefault="qualified">

Now, I'm not clear what a parser is supposed to do with the prefix in
xml:lang, but rxp, XML Cooktop, and XML Spy all accept the xsd file without
the xml namespace having to be declared.  If it weren't reserved, it should
be declared.  But do namespaces have to be declared at all for a document to
be well-formed?  Not so far as I can see.

The Namespaces Rec says:

"The prefix xml is by definition bound to the namespace name
http://www.w3.org/XML/1998/namespace. "

It is not clear to me whether this means that it does not have to be
declared (the declaration could be hardwired into the processor).

In any event, add the xml namespace declaration and minidom will work.

I tested it on Python 1.5.2, Win 2000, PyXML 0.6.6.

Cheers,

Tom P

[Mariappan, MaharajanX]

> I'm using pyXml-0.6.6 with Python 2.0
>
> I've attached the full xml and xsd file.
>
> Can you provide feedback on my second approach using pyExpat module
>