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
{{ message }}
Repository navigation
Separate instructions for testing well formed XML files and validation against DTD #947
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.
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.
If I understand your need you would like to validate:
only XML syntax
XML syntax + errors coming from DTD rules
XML syntax + errors coming from XSD rules
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:
XML.Syntax: XML errors syntax
XML.DTD : XML errors coming from DTD rules
DTD.Syntax: DTD errors syntax (when you open the DTD)
...
After that you could use filter from the Problems vscode view
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.
If I understand your need you would like to validate:
* only XML syntax
* XML syntax + errors coming from DTD rules
* XML syntax + errors coming from XSD rules
with separate commands?
To learn XML I can understand the need but it requires some work.
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.
This is an example:
As you can see, is in spanish but dont difficult to understand:
F2 Check xml file is well formed
F5 Check if is valid against DTD
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.
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:
* XML.Syntax: XML errors syntax
* XML.DTD : XML errors coming from DTD rules
* DTD.Syntax: DTD errors syntax (when you open the DTD)
* ...
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?
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.
We should provides a new command Revalidate only XML syntax from the current XML file
About checking if a DTD file is correct, i havent seen any place to test it.
vscode-xml provides a DTD validator, no?
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
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.
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...
So id feel more comfortable with something like Check valid against DTD and other order or command Check valid against XSD.
F2 Check xml file is well formed
We should provides a new command Revalidate only XML syntax from the current XML file
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.
About checking if a DTD file is correct, i havent seen any place to test it.
vscode-xml provides a DTD validator, no?
If it has i dont know...how can you test if a DTD file syntax is correct or not ?
As said i dont know any software or online application that does that.
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
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.
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.
If I understand your need you would like to validate:
only XML syntax
XML syntax + errors coming from DTD rules
XML syntax + errors coming from XSD rules
with separate commands?
Yes if not would be confusing specially with noobs or people beginning to learn xml, dtd, xsd...
Then in the future would come to check against XSLT ;)
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...
So id feel more comfortable with something like Check valid against DTD and other order or command Check valid against 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 Check valid against DTD/XSD/RelaxNG.
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 ?
Open DTD file and you will see errors (or the first error).
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.
We should provides a new command Revalidate only XML syntax from the current XML file
In my opinion should be Check xml file is well-formed
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.
we should keep one command like Check valid against DTD/XSD/RelaxNG.
yes, I agree with this. Maybe we could rename the command something like "Revalidate current XML file against schema (DTD, XSD, RelaxNG)"
And dont get a mixed problems console.
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.
We should provides a new command Revalidate only XML syntax from the current XML file
In my opinion should be Check xml file is well-formed
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.
we should keep one command like Check valid against DTD/XSD/RelaxNG.
yes, I agree with this. Maybe we could rename the command something like "Revalidate current XML file against schema (DTD, XSD, RelaxNG)"
And dont get a mixed problems console.
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:
Document that you only have to open the xml file with vscode-xml extension enabled to check if an xml file is well formed.
Also assume that the same happens with DTD files. You open it and it tells you if there is some error (or at least first one, would be great to show all the errors).
Validate against DTD/XSD perhaps XSLT in the future...no revalidate... revalidate is a word only read here.
As said most of software like XMLCopyEditor, online validators, separates the well formed docuement vs valid ( not revalid) against DTD or XSD file.
Using the command to run schema (DTD, XSD, RelaxNG) validation won't prevent mixing errors in the error panel.
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.
@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.
@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...
Open DTD file and you will see errors (or the first error).
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.
I tried it seems it works....is possible to show all errors or only the first one ?
This should be documented or put in README, just to notice to noobies that when you open xml or dtd file, are tested by default ( xml file that is well formed and dtd that the syntax is correct)
I tried it seems it works....is possible to show all errors or only the first one ?
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 xml.validation.stopOnFatalError which could be set to true by default (to have the current behavior) and you could set to false to report several errors (which could be not relevant).
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.
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.
Activity
angelozerr commentedon Nov 15, 2023
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?
angelozerr commentedon Nov 15, 2023
Glad vscode-xml please you :)
ejgutierrez74 commentedon Nov 16, 2023
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.
This is an example:

As you can see, is in spanish but dont difficult to understand:
F2 Check xml file is well formed
F5 Check if is valid against DTD
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.
ejgutierrez74 commentedon Nov 16, 2023
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.
angelozerr commentedon Nov 16, 2023
This command exists with Revalidate current XML file command.
We should provides a new command
Revalidate only XML syntax from the current XML filevscode-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.
Separate instructions for testing well formed XML files and validation
Separate instructions for testing well formed XML files and validation
Separate instructions for testing well formed XML files and validation
ejgutierrez74 commentedon Nov 17, 2023
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...
So id feel more comfortable with something like Check valid against DTD and other order or command Check valid against XSD.
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 ?
As said i dont know any software or online application that does that.
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...
Then in the future would come to check against XSLT ;)
angelozerr commentedon Nov 17, 2023
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
Check valid against DTD/XSD/RelaxNG.@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
Separate instructions for testing well formed XML files and validation
datho7561 commentedon Nov 17, 2023
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.
ejgutierrez74 commentedon Nov 18, 2023
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
angelozerr commentedon Nov 18, 2023
@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.
ejgutierrez74 commentedon Nov 18, 2023
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...
ejgutierrez74 commentedon Nov 20, 2023
I tried it seems it works....is possible to show all errors or only the first one ?
This should be documented or put in README, just to notice to noobies that when you open xml or dtd file, are tested by default ( xml file that is well formed and dtd that the syntax is correct)
Thanks
angelozerr commentedon Nov 20, 2023
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.
angelozerr commentedon Nov 20, 2023
A thing that we could do is to provide a settings like
xml.validation.stopOnFatalErrorwhich could be set to true by default (to have the current behavior) and you could set to false to report several errors (which could be not relevant).ejgutierrez74 commentedon Nov 21, 2023
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
angelozerr commentedon Nov 21, 2023
This option doesn't exists, we need to implement it.
ejgutierrez74 commentedon Nov 21, 2023
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.