I am trying to check an xml file with approximately 1 million lines using lxml. This is my code.
import codecs
import lxml.etree as ET
xsd_file = codecs.open(r'test.xsd', 'rb', 'utf-8')
xml_file = codecs.open(r'test.xml', 'rb', 'utf-8')
xmlschema_doc = ET.parse(xsd_file)
xmlschema = ET.XMLSchema(xmlschema_doc)
doc = ET.parse(xml_file)
print (xmlschema.error_log.filter_from_errors())
But I found that the output always says “65535: 0” if the line with the error exceeds 65535. That is
file:///C:test.xml:65535:0:ERROR:SCHEMASV:SCHEMAV_ELEMENT_CONTENT: Element 'word': Missing child element(s).
file:///C:test.xml:65535:0:ERROR:SCHEMASV:SCHEMAV_ELEMENT_CONTENT: Element 'word': Missing child element(s).
file:///C:test.xml:65535:0:ERROR:SCHEMASV:SCHEMAV_ELEMENT_CONTENT: Element 'word': Missing child element(s).
Therefore, I cannot determine where the lines above are. Are there any solutions?
source
share