You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The README lists some validation with XSD and DTD. However, currently RNG (RELAX NG) isn't supported (doesn't show up in the list).
This makes it especially hard to write DocBook 5 documents, for example. DocBook 5 is based on RNG, there is no officially blessed DTD nor XSD available.
Proposed solution
It would be cool if RNG could be supported too like the other schema languages. For example, code completion, hover etc.
@tomschr thanks for creating this issue. As @fbricon mentionned, I started to implement XML validation based on RELAXNG in eclipse-lemminx/lemminx#841 PR, but it requires to add new JAR (Jing), so LemMinx JAR will grow up. This PR is just for XML validation based on RELAXNG.
Providing a good support for RELAXNG (like we have for XSD / DTD) means:
XML completion based on RNG
XML validation based on RNG
XML hover based on RNG (documentation)
RNG completion (like we have for XSD complexType)
RNG validation to validate the RNG (not the XML bound woth RNG)
RNG references element
RNG rename element
RNG higlight for references element
RNG codelens for references element
Same support for RNG compact. In this case it will require to implement a fault tolerant parser for RNG compact syntax since it doesn't follow the same syntax than XML.
As you can see it's a lot of work! But if we see that we have a lot of people who are interested with RELAXNG we could try to start with XML validation based on RELAXNG.
Please vote for this issue (like you did, thanks!)
Thanks for your feedback, could you create an another issue for that please because it's not the same topic than RELAXNG (just support another grammar kind). Thanks!
thanks for creating this issue. [...] I started to implement XML validation based on RELAXNG in eclipse-lemminx/lemminx#841 PR, but it requires to add new JAR (Jing), so LemMinx JAR will grow up. This PR is just for XML validation based on RELAXNG.
Thank you for all your hard work. This is really appreciated! 👍 Yes, I've looked into this. It would be really great to see support for RELAX NG (RNG) as we need it for DocBook 5.
Yes, I've installed it and tried it with one of my XML files. I've created this little example:
XML example file
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://docbook.org/xml/5.1/rng/docbookxi.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<articleversion="5.1"xml:lang="en"xml:id="art-hpc-install"xmlns="http://docbook.org/ns/docbook"xmlns:xi="http://www.w3.org/2001/XInclude"xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Test</title>
<para>The quick brown fox jumps over the lazy dog.</para>
</article>
Although it reports the XML as "XML is valid", it seems not to know or load the RNG.
Placing the cursor after </para> and pressing Ctrl+Space opened a small popup with "Loading". Unfortunately, it seems, it couldn't find the related DocBook 5.1 RNG schema as it offers nothing more.
However, DocBook 5.1 RNG is installed on my openSUSE Leap 15.1 system:
I've added this XML catalog file into the VSCode setting key xml.catalogs, but it seems it wasn't used.
To test if the plugin generally works and it's not a XML catalog problem, I've replaced the above official DocBook URI in href of xml-model with my local path. The result was the same.
Another issue that I've discovered is the handling of the DOCTYPE declaration. This is okay:
<!DOCTYPEarticle [
<!ENTITYfoo"FooFoo">
]>
<!-- ... rest the same ... ->
It even detects the foo entity when typing the ampersand. This is great! 👍
However, when using a parameter entity, it fails (although foo.ent exists in the same directory):
<!DOCTYPEarticle [
<!ENTITY % ent SYSTEM "foo.ent">
%ent;
]>
<!-- ... rest the same ... ->
Not sure if that helps. It was just a quick test and maybe I did something wrong or missed to configure it. Let me know if I can help you with more testing etc.
I would have contributed even more, but I know nothing about Node.js or Java.
How are RNG files associated? I've tried a catalog file and a reference to the rng file <?xml-model href="file:///Users/patrick/stuff/xml/changelog.rng" ?> in the xml-model PI.
Activity
fbricon commentedon Apr 8, 2021
Depends on eclipse-lemminx/lemminx#841
angelozerr commentedon Apr 8, 2021
@tomschr thanks for creating this issue. As @fbricon mentionned, I started to implement XML validation based on RELAXNG in eclipse-lemminx/lemminx#841 PR, but it requires to add new JAR (Jing), so LemMinx JAR will grow up. This PR is just for XML validation based on RELAXNG.
Providing a good support for RELAXNG (like we have for XSD / DTD) means:
XML completion based on RNG
XML validation based on RNG
XML hover based on RNG (documentation)
RNG completion (like we have for XSD complexType)
RNG validation to validate the RNG (not the XML bound woth RNG)
RNG references element
RNG rename element
RNG higlight for references element
RNG codelens for references element
Same support for RNG compact. In this case it will require to implement a fault tolerant parser for RNG compact syntax since it doesn't follow the same syntax than XML.
As you can see it's a lot of work! But if we see that we have a lot of people who are interested with RELAXNG we could try to start with XML validation based on RELAXNG.
Please vote for this issue (like you did, thanks!)
@tomschr have you tried https://marketplace.visualstudio.com/items?itemName=raffazizzi.sxml ? Could you give us feedback please.
pgundlach commentedon Apr 8, 2021
Schematron support would be great as well.
(I'd be happy to beta test rng support)
angelozerr commentedon Apr 8, 2021
Thanks for your feedback, could you create an another issue for that please because it's not the same topic than RELAXNG (just support another grammar kind). Thanks!
tomschr commentedon Apr 9, 2021
@angelozerr Hi Angelo,
Thank you for all your hard work. This is really appreciated! 👍 Yes, I've looked into this. It would be really great to see support for RELAX NG (RNG) as we need it for DocBook 5.
Yes, I've installed it and tried it with one of my XML files. I've created this little example:
XML example file
Although it reports the XML as "XML is valid", it seems not to know or load the RNG.
Placing the cursor after
</para>and pressing Ctrl+Space opened a small popup with "Loading". Unfortunately, it seems, it couldn't find the related DocBook 5.1 RNG schema as it offers nothing more.However, DocBook 5.1 RNG is installed on my openSUSE Leap 15.1 system:
I've added this XML catalog file into the VSCode setting key
xml.catalogs, but it seems it wasn't used.To test if the plugin generally works and it's not a XML catalog problem, I've replaced the above official DocBook URI in
hrefofxml-modelwith my local path. The result was the same.Another issue that I've discovered is the handling of the DOCTYPE declaration. This is okay:
It even detects the
fooentity when typing the ampersand. This is great! 👍However, when using a parameter entity, it fails (although
foo.entexists in the same directory):Not sure if that helps. It was just a quick test and maybe I did something wrong or missed to configure it. Let me know if I can help you with more testing etc.
I would have contributed even more, but I know nothing about Node.js or Java.
Keep up this great work! 😍
VSCode system details
tomschr commentedon Apr 9, 2021
I've opened issue #451.
fbricon commentedon Oct 14, 2022
Initial RelaxNG support is now available from vscode-xml pre-releases starting with v0.21.2022101304.

Please give it a try and report any issues
pgundlach commentedon Oct 14, 2022
How are RNG files associated? I've tried a catalog file and a reference to the rng file
<?xml-model href="file:///Users/patrick/stuff/xml/changelog.rng" ?>in the xml-model PI.angelozerr commentedon Oct 14, 2022
It should work with:
If you write this comment, it doesn't work I suppose, is that?
If it that, could you do the demo at eclipse-lemminx/lemminx#841 (comment) and tell us if it is working for you.
If it is working for you and it doesn't work with your usecase, could you share your RNG and XML file.
angelozerr commentedon Oct 14, 2022
@pgundlach please wait it seems that prerlease don't embed the RelaxNG support. Let us invesitgate why?
angelozerr commentedon Oct 14, 2022
Ok, prerelease has been fixed, now you can install it and RelaxNG support should be available.
tomschr commentedon Oct 17, 2022
@angelozerr Thank you!
In https://marketplace.visualstudio.com/items?itemName=redhat.vscode-xml, there is no RELAX NG in the "Feature" section mentioned. Maybe you want to update that? 🙂
angelozerr commentedon Oct 17, 2022
You are welcome!
Thanks for your suggestion, but I'm doing that in #787
When release will be done, it will promote RelaxNG support.
angelozerr commentedon Oct 17, 2022
It will look like this https://github.com/redhat-developer/vscode-xml/blob/9cd07fba66403f6ceac41a37ff610cebb227afe7/README.md
angelozerr commentedon Oct 19, 2022
Fixed with eclipse-lemminx/lemminx#841
We will create the release soon but now you can install the prerelease of vscode-xml.
See documentation at https://github.com/redhat-developer/vscode-xml/blob/main/docs/Features/RelaxNGFeatures.md#relaxng-features