Open GoogleCodeExporter opened 8 years ago
Hi,
There is no such rule that the line/column information will provide a 100%
accurate information - it is not even possible because that will show only one
location in the document while an error would be accurately located with a
range or a set of ranges. The error location just indicates the place of the
error and in general it points to a location after the content that caused the
error.
In your case
<event type="xmlCreated" gent="Aptara" date="2012-05-01"/>
you have an attribute "gent" instead of "agent" and Jing will point you to the
end of the element while the error message clearly states the issue:
"attribute "gent" not allowed here; expected attribute "agent", "date",
"ns1:chunk", "ns1:link", "ns2:link_version_label", "ns2:obj_id",
"ns2:obj_status", "ns2:version_label", "onlyChannels" or "role" (with
xmlns:ns1="http://cms.wiley.com" xmlns:ns2="http://www.documentum.com")
This comes from the fact that Jing acts as a content handler on the XML parser
and the parser will notify Jing with different XML events like: start element,
end element, empty element, text, etc. but there is no separate notification
for each attribute, the attributes are notified as part of a start element or
empty element notification. Such a notification comes also with a locator that
provides location information and this locator points at the end location of
the event notified, so in your case it points to the end of the element.
It is possible of course to identify that this error is related with an
attribute and then try to look back and locate that attribute but this requires
additional processing. The error reporting also needs enhancements to be able
to report more than one line/column location as you may want to have both the
start and the end location of the error in order to consider that accurate.
In oXygen XML Editor we use Jing for Relax NG validation and we added a post
processing step on the errors reported by Jing and we try to compute better
location information. For example, in this case we report the start location
and the end location as below, identifying exactly the unexpected attribute:
Start location: 55:26
End location: 55:39
so one possibility for you will be to do the same thing and compute better
location info for the Jing reported errors by looking back into the document.
Issue 45 addresses enhancements on error reporting, maybe you should add a note
there and vote for that issue (star the issue).
Original comment by georgebina76
on 27 Jan 2012 at 1:05
Original issue reported on code.google.com by
k.prasa...@gmail.com
on 18 Jan 2012 at 12:47Attachments: