[XML-SIG] Re: DTD processing

Lars Marius Garshol larsga@ifi.uio.no
Tue, 30 Jun 1998 13:13:10 +0200


* Pavel Velikhov
>
>I have a question about DTDs and Python XML developments : I am working on an
>XML application that needs to browse and create DTDs for documents. As far
>as I understand SAX and DOM interfaces don't offer any DTD manipulation
capabilities,

The DOM working draft has this, but PyDOM does not. (Probably because
xmlproc is the
only parser that offers DTD access, and this is been badly documented and
sort of
difficult to find.)

I'm thinking of making a DOM-compliant DTD interface to xmlproc, and
integrating
it with PyDOM somehow, but haven't gotten round to it yet. Stephane, if you
want
to do this, that would probably be the best.

>so I will have to build some things on my own. So the question is - is
there a
>way to build my own DTD manipulation module and reuse some of the code
developed for
>the Python XML parser?

xmlproc gives you both a low-level interface for parsing events and a
higher-level
one for querying parsed DTDs. The latter is a little incomplete, since I've
never
really used it for anything except the validation and since I've so far
focused
on other things. In other words: feedback on this interface will probably
lead to 
it being changed to fit your needs.

So, what you can do right now is to go to

http://www.stud.ifi.uio.no/~larsga/download/python/xml/xmlproc.html

and download xmlproc 0.40. In xmlapp.py you'll find the DTDConsumer
interface that
receives DTD parse events. The DTDParser itself is in xmlproc.py. The
interfaces 
for parsed DTDs are in xmldtd.py.

I've just documented the DTD interfaces and modified them slightly. The 
documentation will be available when I release 0.50, which should be RSN.

--Lars M.