Hello
I'm trying to use iterparse to validate big xml document using XmlSchema. Generally
it works, but when walidate malformed xml, the exception received doesn't contain
any information about file position. Specific Exception attributes like position is (0,0), offset is None and linenumber is just None.
In that case is very hard say what's wrong with xml, especially when is'a big xml file (300 MB).
Is it a bug or this is correct behaviour ?
I found that this question was allready asked on this mailing list, but there wasn't any response.
Btw. this situation happen on lxml 2.2.8 and python2.6 (I must say that I try to used lxml 2.3 beta and get the same case).
Below I attached some piece of code that I use to do validation
schema = XMLSchema(file=schemapath)
context = iterparse(file(filepath,'r'), events=('end',), schema=schema)
try:
for event, elem in context:
elem.clear()
while elem.getprevious() is not None:
if elem.getparent() is not None:
del elem.getparent()[0]
except XMLSyntaxError, e:
.......
Regards
Grzegorz Ślusarek