Check XML Without any DTD or schema.

Diez B. Roggisch deets at nospam.web.de
Tue Sep 5 07:06:14 EDT 2006


gajewski.konrad at gmail.com wrote:
> I'm newbee. I try to check syntax any XML file. I don't have any dtd or
> shema file to this xml.
> Is this possible that I check syntax in any xml file in python.

There are two forms of checking xml-documents:

 - well-formedness, which means that the document adheres to the xml syntax,
that open tags are properly closed and tags in general form a tree
structure. Maybe some other things too, but that is the gist of it.

 - validity according to a schema/dtd, which is only possible to check for
well-formed documents 

The first you check by simply opening a file using a xml parser. The second
is only possible in presence of a schema-document and a validating parser -
which not all are.

Diez




More information about the Python-list mailing list