I'm using python to work with xml document, with the help of lxml package. An xsd scheme is used to validate that document. When an error occures, validator raises ParseError with a position of incorrect element. But what I need is an xpath to that element. Is there any way to get it?
Assuming the validator give you the position of incorrect element (for example: 8), you could try to access it with the following XPath expression:
(//*)[position()=8]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.