-
Notifications
You must be signed in to change notification settings - Fork 82
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
Schema Declaration in Processing Instructions and RELAXNG/ODD Schema #236
Comments
XML Schema support should work, if you have some trouble, please attach a zip which contains your vscode project with XML and XML Schema and explain us what you want to do.
For RelaXNG, it exists an issue at eclipse-lemminx/lemminx#237 but I fear it's a long and hard task. I wonder if RelaxNG is a lot used compare to XML Schema? |
Thanks for the quick reply!
Alright. I thought it might just be my mistake.
Well... I suppose on a global scale, RelaXNG is not used a lot. By no means as much as XML Schema, at least. But it definitely gets used: For example, the entire Text Encoding Initiative and all TEI customizations are built around ODD, RelaXNG and Schematron Schemas and usually use RelaXNG. So that's countles projects working with .rng Schemas, and especially big institutions like the German Text Archive or the Cambridge Digital Library providing all of their data in XML that is validated against .rng Schemas. Long story short: I'm sure there are more people who wold be very greatful to see this implemented. :-) |
I did try it out, see the attached zip file: When I open these files in Oxygen XML editor, I get the expected behaviour: "xml.fileAssociations": [
{
"systemId": "C:\\Users\\baldu\\OneDrive\\Desktop\\validation_test\\schema.xsd",
"pattern": "**/*.xml"
}
], it works perfectly again... I'm really confused what I'm doing wrong. |
It seems that you are using xml-model https://www.w3.org/TR/xml-model/#the-xml-model-processing-instruction which is not supported (why I don't know if Xerces can support it, let me investigate that). But the standard mean to bind your XML with a XML Schema is: <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="./schema.xsd"> I mean, if your write your XML like: <?xml version="1.0" encoding="UTF-8"?>
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="./schema.xsd">
<a>
blah
</a>
<a>
<b/>
</a>
</root> It should work. |
Cool, that works indeed. Thanks! Again, in the context of TEI, I've seen xml-model used a lot. So if that would be supported eventually, that would be great! |
@angelozerr where would I start best, if I wanted to contribute either to the support of the xml-model processing instruction or the implementation of relaxng in the lemminx language server? |
Indeed, it's the LemMinx LS which should manage that which is written in Java. It should be fantastic to have those contribution, I think we should manage at first xml-model processing instruction (how to manage that with Xerces) and RelaXNG (quick search with RelaxNG wriiten in Jav ais https://github.com/relaxng/jing-trang) I suggets you that you create several little issues in LemMinx (what you want to have/provide) |
Let's not get ahead of ourselfs... This is somewhat beyond the scope of my usual projects. But I see what I can do. ;-)
Aye, will do. |
@BalduinLandolt I read some documentation about RelaxNG and starts playing with Jing. I see more what it is RelaxNG and what we need to do to support it and to be honnest with you it can be a long task if we want to support RelaxNG like we have done for XML Schema (DTD is not finished yet), I mean:
As you can see, there are a lot of big tasks and it is not detailed. I think the first step is to manage I'm afraid that it's a very long and hard task. We love contribution, and we try to do our best to help contributors, I suggets you that you read https://github.com/redhat-developer/vscode-xml#contributing But as I tried to explain you, it's a very big task, so the first step is to play with Jing and xml-model before trying to integrate to LemMinx. |
@BalduinLandolt I think your original requirement is eclipse-lemminx/lemminx#633 For RelaxNG, let's create another issues. |
Yes, let's keep the processing instructions and the RelaxNG/Schematron separate issues. I'll see what I can do. But I'm rather busy with other things, so don't expect too frequent stuff from me. (I'm mostly doing this to procrastinate from other things... ^^) |
I will study this issue once I will fix some bugs with DTD |
Fixed with eclipse-lemminx/lemminx#633 |
First of all, thanks for this great extension!
I'm unsure if it's just me being dumb... But the only way I can get schema validation to work is to use
xml.fileAssociations
in the settings. But that's somewhat impractical, as I can only add one schema and then every XML is validated with that one schema.I'd love to be able to validate XMLs simply by adding the processing instruction
<?xml-model href="some-schema.xsd" type="application/xml" schematypens="http://www.w3.org/2001/XMLSchema"?>
(with the schema being a local file relative to the XML file's location, or a URL of a .xsd somewhere in the internet).Maybe I'm all wrong... but I would have actually expected this to be a fairly straight forward functionality.
And also, having RELAXNG or even ODD schema validation on top of .dtd and .xsd would be amazing.
The text was updated successfully, but these errors were encountered: