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

Xinclude schema validation issues #845

Closed
oscarlevin opened this issue Dec 17, 2022 · 7 comments
Closed

Xinclude schema validation issues #845

oscarlevin opened this issue Dec 17, 2022 · 7 comments
Milestone

Comments

@oscarlevin
Copy link

I'm very thankful that vscode-xml now helps validate PreTeXt documents against it's RelaxNG schema. I have enabled the xinclude validation, and it does appear that the files included this way get checked as well. However, there are two issues.

  1. In the root tag of the root document, I get validation errors of the form:
There are '2' errors in 'ch_intro.ptx'.xml
ch_intro.ptx(6, 2): Document root element "chapter", must match DOCTYPE root "null".
ch_intro.ptx(6, 2): element "chapter" not allowed here; expected element "pretext"

The schema has start element <pretext> and the <chapter> element is in the right place, but it is the root element of ch_intro.ptx file.

  1. When I open up a file that was the target of an <xi:include />, the root element of that "fragment" is not <pretext> (it is usually <chapter> or <section> ) so that gives a validation error (that the element is not allowed there.

I understand that the 2nd issue might be impossible to really fix (apparently oXygen doesn't fix it), but perhaps the error can be made less severe in settings for the top element of any document. The first issue seems like a bug of the xinclude mechanism.

@angelozerr
Copy link
Contributor

  1. In the root tag of the root document, I get validation errors of the form:

I think it is a bug with file association, because if you remove the file association and you use xml-model processing instruction it is working (you don't have those errors), BUT you have new errors because of 2 I think.

image

  1. When I open up a file that was the target of an <xi:include />, the root element of that "fragment" is not (it is usually or
    ) so that gives a validation error (that the element is not allowed there.

I don't know how to fix that for the moment, but you have the same error when you open the ptx root file (see my screenshot). XINclude is for the moment experimental, we need to find some time to improve it.

I will fix the file association problem at first.

@angelozerr
Copy link
Contributor

angelozerr commented Dec 18, 2022

  1. In the root tag of the root document, I get validation errors of the form:

I will provide soon a fix for that.

  1. When I open up a file that was the target of an <xi:include />, the root element of that "fragment" is not (it is usually or
    ) so that gives a validation error (that the element is not allowed there.

In docbook there is the same idea, you can declare a book element which have some chapter elements. The DTD docbook allowed to write an XML with book as root element and chapter as root element. I think your pretext.rng should allows that too.

@angelozerr
Copy link
Contributor

  1. In the root tag of the root document, I get validation errors of the form:

See eclipse/lemminx#1421

@angelozerr
Copy link
Contributor

@oscarlevin the PR eclipse/lemminx#1421 has been merged. Tomorrow you could install the prerelease and it should fix your issue with DOCTYPE.

@oscarlevin
Copy link
Author

Thanks @angelozerr . I'll check that out. Assuming that works, I think we can close this. I've figured out how to add new elements to <start> in Relax NG and that takes care of issue 2. Actually, it seems to also fix issue 1.

@angelozerr
Copy link
Contributor

@oscarlevin could you try the prerelease and check if the issue 1 is fixed?

@angelozerr
Copy link
Contributor

Fixed with eclipse/lemminx#1421

@oscarlevin if you find some issues with xinclude, please reopen it.

@angelozerr angelozerr added this to the 0.24.0 milestone Jan 4, 2023
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

No branches or pull requests

2 participants