XML DTD analysis, diffing ...

O

olive

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.
 
K

kyosohma

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
 
O

olive

Mike,

I know all of these tools and I already suspected xmlproc as a good
candidate.

The problem is I can't download it for the moment since Lars website
is blocked here at my work and PyXML is dead.

Maybe there is an alternative download link ?

Thank you for the Cookbook recipe anyway.

Olivier.
 
P

Paul Boddie

I know all of these tools and I already suspected xmlproc as a good
candidate.

The problem is I can't download it for the moment since Lars website
is blocked here at my work and PyXML is dead.

Maybe there is an alternative download link ?

Isn't xmlproc part of PyXML anyway? Detailed public information about
various PyXML packages suggests that it is. For example:

http://packages.debian.org/unstable/python/python-xml

Paul
 
K

kyosohma

Mike,

I know all of these tools and I already suspected xmlproc as a good
candidate.

The problem is I can't download it for the moment since Lars website
is blocked here at my work and PyXML is dead.

Maybe there is an alternative download link ?

Thank you for the Cookbook recipe anyway.

Olivier.

When I go to the xmlproc website, it states that it is now a part of
the PyXML package, which can be found on Soureforge here:

http://pyxml.sourceforge.net/

Mike
 
?

=?ISO-8859-1?Q?St=E9phane_Muller?=

olive a écrit :
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 ?

Yes, you can try http://c.python.free.fr/dtdnormalize.zip

Parse a sample XML file with the document type declaration. There are
XHTML, SVG and MML samples in the zip file.

The DTDParser is based on the standard xml.parsers.expat module.


Stephane.
 
O

olive

Thank you Stephane,

it is almost what I want.

I'm going to improve it a little and then provide the code back.
Where is the best place ?

Olive.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top