Python & XML & DTD (warning: noob attack!)

Igor Fedorow igor.NOSPAM at obda.net
Thu Jan 29 11:15:17 EST 2004


On Thu, 29 Jan 2004 15:44:25 +0100, Peter Hansen wrote:

> Igor Fedorow wrote:
>> 
>> I have an XML file with an internal DTD which looks roughly like this:
>> [snip]
>> I want to parse this file into my application, modify the data (this
>> includes maybe creating and/or deleting nodes), and write it back into the
>> file -- including the DTD. (It doesn't necessarily need validation,
>> though.)
>> 
>> I tried xml.dom.ext.PrettyPrint, but it produces only [snip] actually
>> lacking the document type definition.
>> 
>> Any help is appreciated!
> 
> Unfortunately I don't know of any way you could generate the DTD again, and
> I've never seen a package which supports what you ask for (not that it isn't
> possible, mind you).
> 
> On the other hand, are you sure you need the DTD?  We use XML in dozens of
> ways and absolutely have never benefited from attempts to use DTDs, and
> don't appear to suffer from the lack thereof.
> 
> Also, aren't DTDs sort of considered either obsolete or at least vastly
> inferior to the newer approaches such as XML Schema, or both?
> 
> So my recommendation is to ditch the DTD and see if any problems arise as a
> result.
> 
> -Peter

Actually, I don't really *need* it, but I would simply like to have it -- which
obviously isn't possible...

Anyway, thank you for your help!

Cheers =)
*igor*



More information about the Python-list mailing list