[XML-SIG] SAX with DTD

Fred L. Drake, Jr. fdrake@acm.org
Thu, 12 Jul 2001 19:29:02 -0400 (EDT)


Hung Jung Lu writes:
 > (1) I have read that Expat is non-validating. Does it
 > mean that it ignores DTD completely?

  Yes, pretty much.  If you use Expat 1.95+ (see
expat.sourceforge.net), then you can coerce Expat into reading the
DTD and report what's in the DTD, but it won't perform validation.
You certainly could use that to pick up the default values of
attributes, however.

 > (2) I have a DTD that specifies default attributes
 > (via #FIXED) of an XML document. Is there some parser
 > (DOM preferred, SAX ok) in Python that can take into
 > account the attributes specified in DTD? I tried

  I suspect xmlproc can be used to build a DOM like this.  I've used
the latest versions of Expat to do this as well, but that DOM requires
the acquisition machinery in Zope to work.  It shouldn't be too hard
to adapt that code to build a minidom DOM, but I've not had time to do
so.  You are free to work on that if you like.


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Digital Creations