XML DTD analysis, diffing ...

kyosohma at gmail.com kyosohma at gmail.com
Tue Apr 3 09:27:28 EDT 2007


On Apr 3, 7:38 am, "olive" <ocolli... at gmail.com> wrote:
> Hi,
>
> I have a bunch of similar DTDs written by different coders.
>
> I would like to normalize, sort elements and attributes by name and
> compare those files.
>
> Do you know any XML DTD parser/normalizer written in Python ?
>
> If not, how would you perform that task in Python language ?
>
> Please,
>
> Olive.

Olive,

Beautiful Soup is usually recommended for parsing XML/HTML.
www.crummy.com/software/BeautifulSoup/

You could also use pyXML. See the recipe below for one way to use it:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/220472

xmlproc has a way of parsing DTDs, or so I hear. I think it's a part
of pyXML.

I hope this stuff gives you some ideas.

Mike
See also the SAX module: http://docs.python.org/lib/module-xml.sax.handler.html




More information about the Python-list mailing list