Lars Marius Garshol larsga@ifi.uio.no
Fri, 04 Sep 1998 22:19:21 +0200

* Lars Marius Garshol
> 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.

* Michael Sobolev
> You meant that I likely to get an equivalent form?

(I assume there's a 'not' missing in that sentence.)

Correct. If this is important to you I may consider adding a way to preserve
the original content model structure. I've thought about doing so, but since
nobody seemed to use the DTD interface I haven't bothered so far.

* Michael Sobolev
>Basically, I need more documentation.  It is not obvious how to get all
>defined elements, for example. 

Not so strange, since you can't. :) Another thing I've been thinking about,
but haven't yet added. It's just two or three lines, so I'll put it in in a
couple of days. Expect it in the next release.

>And more examples, if possible.  :)

Maybe I can add an example program that does something interesting with
DTD information.

>What I want to know is how:
>    to obtain the list of public identifiers from catalog;

Currently you can't. I'll add this.

>    to parse a specific DTD (using its public or system id);

Hmmm. You can do this now by using the DTDParser class in the xmlproc
module. Give it a DTDConsumer (see the DTD API doco) to receive events.
I want to move the DTDParser and clean up the interface a little, so I
haven't documented this yet, but the DTDParser understands the same
methods as XMLProcessor, expcept that you set the DTD handler with
'set_dtd_consumer'. Note that this will break in a future version.

>    to get DTD information for a given document.

Hmmm. Since you already know about the get_dtd method, I'm not
sure what more you want.

>Under DTD information I understand the list of elements (with theirs
>and a way for figuring out how the elements may follow one another.  Having
>written my previous message, I understood what the content_model is, and how
>to make use of it.  I am only afraid that since it is not documented (and,
>therefore, is not fixed) it may easily be changed should you find a different
>way for validating XML files against DTD.

It's not likely to change since the current method seems to work pretty well,
but, yes, you do run that risk. This isn't a finished product and I want to
keep my options open here... :)

However, if you there's some specific information about the content models
you want I'll see what I can do. Do you want to be able to reconstruct the
original syntax of the declarations, or is there something else you want?

--Lars M.