Open GoogleCodeExporter opened 8 years ago
Just found this from the lxml mailing list where the person had trouble getting
the line number if it was over 65k... so trouble for big KML's, but it is a
start.
http://permalink.gmane.org/gmane.comp.python.lxml.devel/6085
def validate_xml(xml_filename, xsd_filename):
# real dom config xsd
xsd_fd = open(xsd_filename, 'r')
xmlschema_doc = etree.parse(xsd_fd)
xsd = etree.XMLSchema(xmlschema_doc)
doc = open(xml_filename, 'r').read()
doc_xml = etree.XML(doc)
if xsd.validate(doc_xml):
print "valid"
else:
print "invalid"
print xsd.error_log
Original comment by schw...@gmail.com
on 4 Aug 2011 at 3:56
Original issue reported on code.google.com by
schw...@gmail.com
on 3 Aug 2011 at 9:09