Support #4935

xml validation against dtd not showing corrent line number of attribute error

Added by Arun Pradeepan Balasubramanian 6 months ago. Updated 6 months ago.

Start date:
Due date:
% Done:


Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:


XML Parsing against dtd on saxon, output shows in a incorrent line.

429_2020_2069.xml (398 KB) 429_2020_2069.xml Arun Pradeepan Balasubramanian, 2021-03-12 14:19


#1 Updated by Michael Kay 6 months ago

Could you be more specific about the actual error and what is being reported?

However, Saxon can only report what the XML parser tells it. The results may well vary depending on which XML parser you are using. Parsers vary in the quality of their diagnostics.

#2 Updated by Arun Pradeepan Balasubramanian 6 months ago

Hi Kay, Attached XML contains error while parser against dtd

Saxon also showing error, but position at last line of the document. this is incorrect

actual error position is line no 995, column no 485, Reference to undeclared ID is 'other'.

#3 Updated by Michael Kay 6 months ago

An XML parser handling IDREF/ID validation cannot detect that there is an unresolved IDREF until it reaches the end of the document. At that point it can report the error, and the quality of the diagnostics will depend on design trade-offs made by the people who wrote the XML parser. They may choose to retain location information associated with the IDREF value, in which case they will be able to report where the unresolved IDREF appears, or they may choose to drop this information (to save on memory usage) in which case they can only report the content of the unresolved reference. This is a simple trade-off between performance and usability.

Saxon lets you choose your own XML parser, so choose one that makes these trade-offs the way you like them.

Apart from that, this is entirely outside Saxon's control. DTD validation is done by the XML parser, not by Saxon; Saxon just passes on the diagnostics that come back.

There's no bug here because the XML parser is almost certainly behaving as designed, and it is conformant with the specifications. And if it were a bug, it would be a bug in the XML parser, not in Saxon.

#4 Updated by Michael Kay 6 months ago

  • Tracker changed from Bug to Support
  • Status changed from New to Closed

Closing this with no further action. We have no control over the diagnostics from XML parsers.

Please register to edit this issue

Also available in: Atom PDF