Validating xml files

Sergio Boix Moriano smoriano at sicon.net
Mon Dec 11 07:48:38 EST 2000


    Hi all,

        I´m using the PyXML-0.5.5.1 library to work with xml files. We
generate the xnl files from a database and we need to validate this
files cause later we have to do an insert in another dataabse with the
xml contents, and the file must only have fields and tables that exits
in the database.

       I´ve tried to use the DTDParser() class, but lokking at the code
i´ve seen that the functions in the class doesn´t do nothing. The code
of this classes in the saxlib module is:
class DTDHandler:
    def notationDecl(self, name, publicId, systemId):
        "Handle a notation declaration event."
        pass

    def unparsedEntityDecl(self, name, publicId, systemId, ndata):
        "Handle an unparsed entity declaration event."
        pass


    Does anyone know anyway to read an xml file validating it with a
DTD, in a way that if the xml is bad formed it gives me an error.

    Thanks in advance,







More information about the Python-list mailing list