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

Relax NG schema validation not working when DOCTYPE declaration missing with file association #831

Closed
AidanRandtoul opened this issue Dec 7, 2022 · 3 comments · Fixed by eclipse-lemminx/lemminx#1393
Labels
bug Something isn't working relaxng
Milestone

Comments

@AidanRandtoul
Copy link

The following error message appears above the root tag in the xml file:

Document root element must match DOCTYPE root "null"

With this error the validation based on the schema sometimes works however the completion and hover does not work at all. It cannot either complete based on exisiting tags in the file, which is something the extension supports when schema validation is switched off.

I am using Relax NG compact schema and the issue still occurs when using the non-compact schema.

@fbricon
Copy link
Collaborator

fbricon commented Dec 7, 2022

can you please provide a sample xml file and its schema, reproducing the issue?

@fbricon fbricon added bug Something isn't working relaxng labels Dec 7, 2022
@dngulin
Copy link

dngulin commented Dec 7, 2022

I confirm the bug.

A sample schema:

element foo {
    element bar { text }
}

An xml-file with error:

<?xml version="1.0" encoding="UTF-8"?>
<foo><bar>baz</bar></foo>

An xml-file without error:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE foo>
<foo><bar>baz</bar></foo>

The schema is associated to the file using an xml.fileAssociations setting.

@angelozerr angelozerr changed the title Relax NG schema validation not working when DOCTYPE declaration missing Relax NG schema validation not working when DOCTYPE declaration missing with file association Dec 7, 2022
angelozerr added a commit to angelozerr/lemminx that referenced this issue Dec 7, 2022
@angelozerr
Copy link
Contributor

File association is not a standard association (it belongs to vscode-xml) . If you use xml-model association it should work.

I started to create a PR eclipse-lemminx/lemminx#1393 to fix this issue.

angelozerr added a commit to angelozerr/lemminx that referenced this issue Dec 8, 2022
@angelozerr angelozerr added this to the 0.23.0 milestone Dec 8, 2022
angelozerr added a commit to angelozerr/lemminx that referenced this issue Dec 8, 2022
datho7561 pushed a commit to eclipse-lemminx/lemminx that referenced this issue Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working relaxng
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants