-
-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong line for XML event location in elements following DTD #67
Comments
Thank you for the report! I suspect there may be an issue with linefeed handling within comments inside DTD; location counters need explicit handling (due to multiple LFs XML allows), and it could be possible there is an update missing. Tracking specific location down may be trickier, but it would be somewhere where comments are skipped (within internal DTD subset, neither comments nor PIs can be reported). |
(added "test-needed" label just because automated test would be great -- I realize instructions for writing test are included above) |
Wrong line for XML event location in elements following DTD - Added additional comment coverage in TestComments.java - Added test per Issue FasterXML#67 writeup to TestLocation.java - Carriage was not being checked so skipped, added check and call to skipCRLF(c) to advance line number.
Hello,
While updating our static code analyzer, we realized that in some scenario, the locations corresponding to events are wrong. It seems to be a bug from the woodstox engine.
In order to reproduce the issue, use the following XML file:
Important note: On line 3, there is NO spaces between the comment start and the new line (
<!--\n
).If you add a space between the last
-
and the new line (<!-- \n
), locations are then correct.Code I used to reproduce the issue:
When executing the
main
method, the following lines are printed:At this point, the 3 last event are wrong, while offset is correct. Line should be 8.
I would have expected:
Related issue: SONARXML-73
I did not manage to identify the issue in the code, being not that much familiar with the XML API. However, if you give me a hint, I may give a try to fix it.
Edit: If I set property
XMLInputFactory.SUPPORT_DTD
totrue
instead offalse
, then locations are correct. Now, I'm not sure if what it means. Does support of DTD means that they are validated?Cheers,
Michael
The text was updated successfully, but these errors were encountered: