Lars Marius Garshol
Fri, 04 Sep 1998 17:16:49 +0200
* Michael Sobolev
>I am trying to figure out how the processed DTD is stored. I took xvcmd.py
>program that comes with python-xml (debian) distribution and parsed the
>document. Then I executed parser's get_dtd method (this, I guess,
It returns an object that contains the DTD information, yes.
>How can I reverse engineer the DTD for my document? Or, to be more precise,
>how am I supposed to walk through content_model information of an element?
The content model of elements is parsed into a parse tree, converted to a
non-deterministic finite automaton and then converted from there to a
deterministic finite automaton. The original parse tree is then discarded,
which means that you basically don't have any means of getting back to the
original content model.
However, if you can tell me what it is you need I may add it to the next
version. The current DTD interface is just what I needed to implement
validation, and may not be optimal for other kinds of uses.