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

Martin v. Loewis martin@v.loewis.de
Mon, 3 Dec 2001 07:49:43 +0100


> I've attached the full xml and xsd file.

Thanks, it turns out this is a bug in pulldom. Please apply the patch
below.

> Can you provide feedback on my second approach using pyExpat module

You said "but no valid response." Can you please qualify?

One problem here is that FromUri expects an URI. You are passing
"c:\\Project\\build.xsd", which, if it was an URI, would use the "c"
scheme, which is not defined. However, as a work-around, FromUri will
open that resource if it is a local file.

If I change the file name so that it works on my Unix system, the
PyExpat.Reader will parse the document just fine; I can see no
problems.

Regards,
Martin

Index: pulldom.py
===================================================================
RCS file: /cvsroot/pyxml/xml/xml/dom/pulldom.py,v
retrieving revision 1.17
diff -u -r1.17 pulldom.py
--- pulldom.py	2001/11/21 09:57:35	1.17
+++ pulldom.py	2001/12/03 06:39:18
@@ -21,6 +21,7 @@
     document = None
 
     def __init__(self, documentFactory=None):
+        from xml.dom import XML_NAMESPACE
         self.documentFactory = documentFactory
         self.firstEvent = [None, None]
         self.lastEvent = self.firstEvent
@@ -31,7 +32,7 @@
         except AttributeError:
             # use class' pop instead
             pass
-        self._ns_contexts = [{}] # contains uri -> prefix dicts
+        self._ns_contexts = [{XML_NAMESPACE:'xml'}] # contains uri -> prefix dicts
         self._current_context = self._ns_contexts[-1]
         self.pending_events = []