Python validating xml parser

It produces a top-down statistical report on the elements in an XML document: the number of occurrences; a breakdown of the number of children, parents, and attributes; and character count.

I think this is a good exercise for a parser since: In any case, it was at hand and I didn't have to invent some other kind of made-up application.

The main work that this program has to do outside of parsing is order the elements in a top-down fashion, yet account for the fact that element containment graphs may have cycles.

I ran these tests on my Gateway Solo 5150 laptop with Red Hat 5.2 Linux installed.

Of course, this would make them invalid even without an element model since we've repeated ID attributes.

(Assuming attributes named "id" are meant to be ID attributes.) But they're still well-formed.

If you are so inclined, run the test yourself on your own system.

I described this program in my September article on this site.The only change from it in was the removal of the system identifier, spec.dtd, from the DOCTYPE declaration.Some of the parsers wanted it to be there if you declared it, even in non-validating mode.Below is a way to validate an XML file using python and an external DTD.Are there any other ways to do XML DTD validation with python?Each implementation uses a different XML parser and four different languages are used: C, Java, Perl, and Python.

558 Comments

  1. Mirman also toured with Patton Oswalt, Brian Posehn and Maria Bamford on the Comedians of Comedy tour.

  2. In order to use this service , you must verify your age ( only for persons older than 18 years).

Comments are closed.