DTD Parsing

Asun Friere afriere at yahoo.co.uk
Wed Nov 10 09:22:26 CET 2010

On Nov 10, 5:00 pm, Stefan Behnel <stefan... at behnel.de> wrote:

> Give lxml.objectify a try. It doesn't use DTDs, but does what you want.

Yes I should take the time to familiarise myself with the lxml API in
general. I mostly use libxml2 and libxslt nowadays.  For simple stuff
(like this) I use a StateParser which is your common-or-garden variety
State Pattern built on HTMLParser.  (For the record it took 3 trivial
state definitions and one hackish one :)

However, my issue was not with any particular in any particular python
technology for XML processing, but with eating a DTD.  Once it's in
xsd, it's all downhill from there! So the answer to my question turned
out to be dtd2xsd.pl :)

> It's generally a good idea to state what you want to achieve, rather than
> just describing the failure of an intermediate step of one possible path
> towards your hidden goal. This list has a huge history of finding shortcuts
> that the OPs didn't think of.

It's very simple really.  I would like to know whether there is some
generally used DTD parser around which could function as a replacement
for xmlproc's DTDParser/DTDConsumer, the existence of which might have
evaded my attention.  I would still like to know.

Without wanting to appear ungrateful, I'm not after any shortcut to
any goal, hidden or otherwise, nor is the reason I want a DTD Parser
(I only told you because you asked so nicely) strictly pertinent to my
question.  I simply meant to ask, precisely what I did ask.

More information about the Python-list mailing list