-
Notifications
You must be signed in to change notification settings - Fork 93
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
Validate XML with DTD/XML Schema by using xml-model #688
Conversation
775ab48
to
8171763
Compare
This PR supports validation with DTD, XML Schema (with or without namespace) with xml-model processing instruction. You cand find 3 XML files in org.eclipse.lemminx/src/test/resources/xml-model folder with those 3 cases. For instance, create the XML file: <?xml version="1.0" encoding="UTF-8" ?>
<?xml-model href="http://www.docbook.org/xml/5.0/xsd/docbook.xsd"?>
<book xmlns="http://docbook.org/ns/docbook">
<title />
<BAD_ELEMENT />
</book> which means that XML file must be validated with XSD And you should see (after the XML Schema is downloaded in the cache folder): This PR doesn't manage validator for xml-model (ex : href with bad XSD uri, an xml-model which doesn't define a href attribute etc) I will create an issue for that. @xorye @fbricon @BalduinLandolt please give me feedback. Thanks! |
I only looked over it briefly, so a real review of the changes is still necvessary... but: Good job! I'm guessing it will need a unit test? And some more documentation? Concerning the namespace, I still think it works the way it is supposed to. Have you tried if you get an error if you change the namespace for an element, that it otherwise legal? It should then produce an error, ideally saying that the elenemt "bad_namespace:good_element" is not legal. Next thing: I'd also test, if an XML with multiple works correctly.
And finally: https://www.w3.org/TR/xml-model/ suggests a series of other pseudo-attributes (of which I have seen "type" a lot, all the others not so much...), would there be any point in including them in some way? |
Thanks :) But please play with this PR to check it works like you expect.
JUnit tests exists with the 3 usecases. See https://github.com/eclipse/lemminx/pull/688/files#diff-8ffaa3160f7438abd9b1067ca631c6df
I comment my code. Which documentation do you want?
I created 2 issues for that to improve range of error + code action (quick fix) , see: If you could be interested to implement one of this issue, please tell me and I will explain more how to do that by giving you some directives.
different kinds of schema (xsd and dtd; rng and xsd; etc.) Please create issues for that. |
As soon as I have time!
Woops... I guess I looked over it all troo briefly. Sorry! In that case, even better. :)
Again: as soon as I have more time... :)
And again: as soon as I have time. ^^ |
...se.lemminx/src/main/java/org/eclipse/lemminx/extensions/xerces/xmlmodel/XMLModelHandler.java
Outdated
Show resolved
Hide resolved
Indeed it's an another issue, please create an issue for that. As Xerces messages was not easy to read, @NikolasKomonen reformat the original message to provide a better understand of the message. I think there is a bug in LSPMessageFormatter, please create an issur for that. Thanks! |
Good luck!
I understand totally, but I would like to avoid working on the same feature than you. For instance even if your PR #685 could be good, I cannot use it, because there are some many changed to do (it was difficult to help you before trying t implement validation with xerces). We would love to have other contributors, that's why it's very important to keep your motivation. It seems that you are interested to work on xml-model topic, that's why I think we should discuss together what issues you want to do. I could help you if you need because when you don't know the code base it's difficult to contribute, but I think you should start with little contribution. Please create (little) issues or please tell me which issues you want to be assigned. Please note, if you wish to contribute you need to have an Eclipse account (to sign ECA) and sign your commit. |
thanks! :)
I understand completly and I'm glad my work (or for now: enthusiasm) is appreciated. |
I fear that I will not have time to explain related topic like using git, commit, etc. I can help you to give you some information with code base (ex : which utilities class you should use, etc), but for other thing (ex : explain how to sign commit, etc), I fear I will have no time to do that. |
I wasn't thinking that basic. :) |
See eclipse-lemminx#697 Signed-off-by: azerr <[email protected]>
Validate XML with DTD/XML Schema by using xml-model
See #633
Signed-off-by: azerr [email protected]