[lxml-dev] Schema validation - no file position

Hi, I'm trying to validate a document using XmlSchema. It works but the exception received (etree.XMLSyntaxError) has no information about file position- exc.position is (0,0). Is this correct behaviour?

On 2010-11-25 10:48, Stefan Behnel wrote:
my code is the following: def validate(schemaContent, dataStream): schema = etree.XMLSchema(etree.fromstring(schemaContent)) for event, elem in etree.iterparse(dataStream, schema=schema): elem.clear() while elem.getprevious() is not None: if not elem.getparent() is None: del elem.getparent()[0] regards, kj

Krzysztof Jakubczyk, 25.11.2010 11:00:
Now, this reveals two important hints that you didn't provide in your original post: you are validating at parse time, and you are using iterparse(). For me, that totally changes the place in the code to look at. I'll see if I can come up with something. Stefan

On 2010-11-25 10:48, Stefan Behnel wrote:
my code is the following: def validate(schemaContent, dataStream): schema = etree.XMLSchema(etree.fromstring(schemaContent)) for event, elem in etree.iterparse(dataStream, schema=schema): elem.clear() while elem.getprevious() is not None: if not elem.getparent() is None: del elem.getparent()[0] regards, kj

Krzysztof Jakubczyk, 25.11.2010 11:00:
Now, this reveals two important hints that you didn't provide in your original post: you are validating at parse time, and you are using iterparse(). For me, that totally changes the place in the code to look at. I'll see if I can come up with something. Stefan
participants (2)
-
Krzysztof Jakubczyk
-
Stefan Behnel