Skip to content
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

reader/validation: throw informative exception #12

Open
bertsky opened this issue Nov 23, 2020 · 2 comments · May be fixed by #16
Open

reader/validation: throw informative exception #12

bertsky opened this issue Nov 23, 2020 · 2 comments · May be fixed by #16

Comments

@bertsky
Copy link
Contributor

bertsky commented Nov 23, 2020

I sometimes have trouble debugging PAGE-XML documents that just won't open in PageViewer, despite the fact that they validate under the schema and there is no obvious mistake. The problem is that PageViewer won't tell you (except that when it outright crashes, you at least get a stack trace).

Now I digged into /PrimaDla/src/org/primaresearch/dla/page/io/xml/XmlPageReader.java and found that XmlPageReader.read() does have all the information in a PageErrorHandler instance called lastErrors. But this gets thrown away.

Why is this not piggy-backed on an exception which PageViewer's event listener can then react on?

For example, it would help seeing (at least on the console):

There is no ID/IDREF binding for IDREF 'region0015'
@bertsky
Copy link
Contributor Author

bertsky commented May 24, 2023

Writing code for PAGE-XML that builds on prima-core-libs is difficult without informative error messages. As a user, I frequently get null even with files that validate perfectly under libxml2 (xmllint, xmlstarlet, Python lxml etc), which is not as strict as the parser used here.

Any news here @chris1010010?

@bertsky bertsky linked a pull request May 25, 2023 that will close this issue
@stweil
Copy link
Contributor

stweil commented Feb 8, 2024

@bertsky, please add an example document which does not open in PageViewer and which can be used to test your pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants