-
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
Separate instructions for testing well formed XML files and validation against DTD #947
Comments
If I understand your need you would like to validate:
with separate commands? To learn XML I can understand the need but it requires some work. I think the thing that you want is to distinguish the erros (Syntax, errors coming from DTD rules, etc). A thing that we can try is to use the source information of the reported diagnostic. Today source is xml: which is not relevant. We could have:
After that you could use filter from the Problems vscode view You can click on view as table you could see better the code: What do you think about this idea? |
Glad vscode-xml please you :) |
F
For example XML Copy Editor has two instructions/commands : one to test if an xml file is well formed and other to test if is valid against a DTD. As you can see, is in spanish but dont difficult to understand: Also there is the online resource i told you https://www.xmlvalidation.com/ that does the work this way...separating things. About checking if a DTD file is correct, i havent seen any place to test it. I found the DTD language grammar, but dont know any online or software resource that checks it ( i havent tested any payment software have to say). So If its included ok, but for me/students not strictly necessary. |
Id have to try when new pre-release is out with my students..but as said in previous post, not the best solution for me, but better than the one we have now. Dont know the work it requires, but many resources do this way, so i suppose is not a very complicated solution. |
This command exists with Revalidate current XML file command.
We should provides a new command
vscode-xml provides a DTD validator, no?
For the moment there are nothing about that, the screenshot is the current version. My idea is to replace xml with XML.Syntax, XML.DTD and after that you could use filter. This problem view comes from vscode and there are no way to customize it. |
against DTD See redhat-developer/vscode-xml#947 Signed-off-by: azerr <[email protected]>
against DTD Fixes redhat-developer#947 Signed-off-by: azerr <[email protected]>
against DTD Fixes redhat-developer#947 Signed-off-by: azerr <[email protected]>
Then id suggest to change the name of the command because its a little confusing. Term revalidate is confusing and "xml file" suggests that you are validating again a file against whatever ( dont know) but xml file suggests some xml file validation...
Then id suggest to change the name of the command because its a little confusing....i suppose for people with other mother language different than english. In my opinion should be Check xml file is well-formed ( as XML Copy Editor and other validators has). It confuses with validation against a DTD or XSD file. Id put Check well formed or Check XML file is well formed.
If it has i dont know...how can you test if a DTD file syntax is correct or not ?
Perhaps if we divide into different commands as mentioned would be easier for me/my students and general people. And dont get a mixed problems console.
Yes if not would be confusing specially with noobs or people beginning to learn xml, dtd, xsd... |
Having several command will be hard (or require some more work) because vscode doesn't know that XML is bound to an XSD, DTD, etc, so we should keep one command like @fbricon @datho7561 what do you think about this suggestion?
@fbricon @datho7561 what do you think about this suggestion?
Open DTD file and you will see errors (or the first error).
Ok |
against DTD See redhat-developer/vscode-xml#947 Signed-off-by: azerr <[email protected]>
I don't think we should add a command to check if the XML document is well formed. We check whether the current file is well-formed when you first open it, and check again whenever it changes. There should be no reason to manually retrigger the syntax validation.
yes, I agree with this. Maybe we could rename the command something like "Revalidate current XML file against schema (DTD, XSD, RelaxNG)"
Using the command to run schema (DTD, XSD, RelaxNG) validation won't prevent mixing errors in the error panel. This is because schema validation is run when you first open the file and whenever you change the file. I believe that filtering the errors based on the error code as Angelo described in this comment is the best way to separate the errors related to the document being malformed and the errors related to the document not repecting the schema. |
Please change the syntax:
Usually you first check if xml file is well formed, and then check if its valid. Thats the reason why i asked for two different instructions. As most other validators does. Thank for your work and effort |
@ejgutierrez74 we dont control the validation process. Xerces load the DTD and the XML syntax is done in same time than the check XML follows DTD rules. It seems that your invalid DTD sample crashes this process because it seems that there is à bug in Xerces himself and in this case XML syntax cannot be done but it should. We cannot do nothing except reporting this bug to Xerces project which seems not be very activate. |
dont want to critic your work, just want to understand, why as said xml validators online and xmlcopy editor, and think notepadd++ can separate the instructions and vscode-xml not...Suppose all works in a similar way... |
I tried it seems it works....is possible to show all errors or only the first one ? Thanks |
It depends if it is a fatal error or not. Your sample with your invalid DTD report a fatal error and in this case the validation stops. We could avoid stopping the validation process when a fatal error occurs to have several errors but the main problem with this strategy is that Xerces can reports a lot of errors which are not relevant because errors depends from the fatal error. Once the fatal error is fixed, the other errors could disapear. IMHO I think this strategy is annoying because you could try to fix some errors after the fatal error but the fix could not be corrected when you will fix the fatal error. |
A thing that we could do is to provide a settings like |
In my opinion is not important, but again has to be documented and noticed...that there is that option, but DTD validation stops with the first fatal error....perhpas print fatal error in a some kind of highlighting or remark. Thanks for your work |
This option doesn't exists, we need to implement it. |
Sorry for my bad english...id try to explain myself better. In my opinion is not important but again has to be documented and noticed. Be clear that only shows one error in case its Fatal one, and once is fixed you can continue fixing other possible errors... ...if finally you implement this option, also should be clear that this option exists and what is by default. |
Related to #943 , #945
Would it possible to make two different instructions: one to test if a xml file is well formed and other to validate it against DTD file. Thats the way XML copy editor works, and many online validators.
Or at least in problems output, make a clear difference ( ideally separated by horizontal line or something like that ) between the xml file ( errors of not well formed file) and errors that came from DTD ( from validation of the xml file against DTD). Because mixing the two diferent source of errors, would be some kind of mess....specially to my students.
As @angelozerr asked me, i open a issue to separate, the bug from this feature request or enchancement.
The validation check is performed against any XML schema or DTD declared inside the XML document.
If neither an XML schema nor a DTD is declared, only a syntax check is performed.
Another example:
https://www.liquid-technologies.com/online-xml-validator
But in this case it misses the XML vs DTD validator...
My students and me were very grateful.... ;)
The text was updated successfully, but these errors were encountered: