Get line number of xml error in python libxml2 -


i using libxml2 python parsing xml , validate against xsd file.

i unable find out line number of error in xml file when schema validation error.

is there way?

for better understanding have pasted code below:

ctxt = libxml2.schemanewparserctxt("xsd1.xsd")  schema = ctxt.schemaparse()  del ctxt  validationctxt = schema.schemanewvalidctxt()  doc = libxml2.parsefile("myxml.xml") ierra1 = validationctxt.schemavalidatedoc(doc)  #get line number if there error 

update:

i tried libxml2.linenumbersdefault(1), enables library collect line numbers. register callback through validationctxt.setvalidityerrorhandler(errorhandler, errorhandler). msg part no line number present. more info: had seen line number member in xmlerror, unclear me how xmlerror type object when there error. there global function lasterror returns xmlerror type object, returns 'none' although there error


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -