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

Initialize RelaxNG support with validation/completion/hover #828

Closed
6 tasks
BalduinLandolt opened this issue Jul 26, 2020 · 10 comments · Fixed by #841
Closed
6 tasks

Initialize RelaxNG support with validation/completion/hover #828

BalduinLandolt opened this issue Jul 26, 2020 · 10 comments · Fixed by #841
Labels
enhancement New feature or request validation
Milestone

Comments

@BalduinLandolt
Copy link
Contributor

First step of #237, see also redhat-developer/vscode-xml#236.

To Do:

@BalduinLandolt

This comment has been minimized.

@BalduinLandolt

This comment has been minimized.

@BalduinLandolt
Copy link
Contributor Author

@angelozerr I'm getting somewhere with this! :)

I just drafted a pull request with what I have so far.
It's currently very much a hack and I know that lots of things need improovement.

It does not yet work when packaged and used in vs code, but from the test cases you can see that it can produce proper diagnostics.

Firstly, I'd be greatful if you could give me general feedback, if the general direction I'm taking seems reasonable to you.

Furthermore, I have some more concrete questions:

  • when I know the href pointing to the schema from xml-model, what is the best way of making this schema available for validation? I'm assuming there is already a system that can handle local files, remote files, relative paths, etc.?
  • I don't get the catalog.xml... how do I use that? and should I use it at all?
  • the jing dependency... in which of the two pom.xml do I add that?
  • I added one of the TEI .rng schemas to the resources for test purposes. Is that a porblem license-wise?

@BalduinLandolt
Copy link
Contributor Author

also, the validation creates errors and warnings, but honestly, I can't think of a way/case to get a warning. Any ideas?

@angelozerr
Copy link
Contributor

Firstly, I'd be greatful if you could give me general feedback, if the general direction I'm taking seems reasonable to you.

I will try to do my best to find time and play with your PR. But your implementation means that you will parse twice the XML document (one by xerces, and one by jing) . That's why I wonder if we could create XMLModelRelaxNGValidator which extends XMLModelValidator which validate the XML content when XML is parsed by xerces. But I'm not sure it's possible.

For your other comments, please let me time to study more jing.

@BalduinLandolt
Copy link
Contributor Author

I will try to do my best to find time and play with your PR.

For your other comments, please let me time to study more jing.

Sure thing, no hurry!

But your implementation means that you will parse twice the XML document (one by xerces, and one by jing) . That's why I wonder if we could create XMLModelRelaxNGValidator which extends XMLModelValidator which validate the XML content when XML is parsed by xerces. But I'm not sure it's possible.

I absolutely see your point. I just could not figure out how to do that... But I can try and see what I can do.
If you have a look at "JARV" here, maybe this could help too.

In any case, I'll see what I can do and will keep you updated. And if you find time to look into it, let me know if you have any suggestions.

@angelozerr
Copy link
Contributor

angelozerr commented Jul 29, 2020

If you have a look at "JARV" here, maybe this could help too.

Today Xerces is on the top for validation because we customize it to have advanced support like error range instead of offset range. If I understand correctly JARV provides a Validation API, so it means that Xerces will not on the top of validation.

In otherwords I would like to provides a Xerces XNI component implementd with Jing. Perhaps
https://github.com/georgebina/dita-ng/blob/master/src/org/ditang/relaxng/defaults/RelaxNGDefaultsComponent.java is a good start?

To study...

In any case, I'll see what I can do and will keep you updated. And if you find time to look into it, let me know if you have any suggestions.

I will try as soon as I will find time.

@BalduinLandolt
Copy link
Contributor Author

you mean something like this? :)
https://people.apache.org/~andyc/neko/doc/index.html

I just came across this page, which lead me to NekoXNI. I haven't tried it out yet, but if I understand you correctly, that might be something, right?

@BalduinLandolt
Copy link
Contributor Author

Well, the download link is dead, and I can't seem to find the files anywhere online... So NekoXNI is clearly not an option. (Or maybe you have better luck?)

If we were to write a Jing-XNI-component ourself... roughly where would that come into play? In the LSPXMLParserConfiguration, so it gets passed to the LSPSAXParser before parsing?

@angelozerr
Copy link
Contributor

@BalduinLandolt please see my draft PR #841

@datho7561 datho7561 added this to the 0.22.0 milestone Oct 13, 2022
@datho7561 datho7561 added enhancement New feature or request validation labels Oct 13, 2022
@datho7561 datho7561 linked a pull request Oct 13, 2022 that will close this issue
@angelozerr angelozerr changed the title Validation for RelaxNG schema Initialize RelaxNG support with validation/completion/hover Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request validation
Projects
None yet
3 participants