-
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
XML did not validate when bounded DTD file was not found #167
Comments
agreed, seems like the reasonable thing to do. |
Also, is there any way to specify a DTD search path? Our application accepts XML messages and manages the DTD path internally, so absolute DTD paths are not possible nor portable. |
file associations work for XSDs, but not for DTD apparently. cc @angelozerr |
I agree that it should work like this, but problem comes from Xerces (the java library which manage validation) which throw an exception (IOException) when DTD is not found instead of reporting this problem as error. Throwing an exception stops in this case validation. Other XML editors like WTP XML Editor from Eclipse has this problem. To fix this problem, we must find a solution to catch the IOEception, report it as an error, not re-throw the error to continue the validation.
Indeed, it's a Xerces limitation. To manage file association for XSD, we use @c600g even if LSP4XML supports DTD, the DTD support must be improved again. Indeed we focus our work on XSD because today we consider that XSD is more used than DTD. But if we have a lot of user feedbacks which need DTD, we could see if we will spend more time to support DTD. |
What about using XML catalog? Could you please add a sample of DTD and a XML file that you wish to manage ? |
@angelozerr I have attached a zip archive containing a sample DTD and XML request which validates against that DTD to this comment. |
Thanks @c600g! Ok if I understand your requirement you have a XML which declares a DTD: <!DOCTYPE inEQUAL_PMT SYSTEM "inEQUAL_PMT.dtd">
<inEQUAL_PMT> and your main problem is that it doesn't work in vscode. Is that? If it that you must write a XML catalog and configure vscode to use it. If you don't know how to write a XML catalog and configure settings in vscode please see this issue #87 You will find a sample of catalog. Please give us feedback if it works fr you.
I'm working on this issue. |
Thanks very much for the tip @angelozerr. I've never worked with XML catalogs in the past, but after a bit of research on the subject, I think I have it working as expected. Here is the catalog.xml file I am using which works for me now: <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD XML Catalogs V1.1//EN" "http://www.oasis-open.org/committees/entity/release/1.1/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system">
<system systemId="inEQUAL_PMT.dtd" uri="file:///home/alank/work/sce/Compile/32/xml/inEQUAL_PMT.dtd" />
<rewriteSystem systemIdStartString="in" rewritePrefix="file:///home/.../xml/in" />
<rewriteSystem systemIdStartString="out" rewritePrefix="file:///home/.../xml/Output/out" />
</catalog> |
Is there any way to specify a different XML catalog file for different operating systems? I mostly work on Linux but will occasionally need to do some work on a Windows 10 machine. This would require a different |
See redhat-developer/vscode-xml#167 Signed-off-by: azerr <azerr@redhat.com>
In response to my comment above, it looks as if the VS Code team is working on os and platform specific qualifiers in the settings.json file, which will hopefully resolve the issue in the near future. |
See redhat-developer/vscode-xml#167 Signed-off-by: azerr <azerr@redhat.com>
See redhat-developer/vscode-xml#167 Signed-off-by: azerr <azerr@redhat.com>
Great!
To be honnest with you, I'm not an expert with XML catalog. Please try it and give us feedback. XML catalog is very used in the XML words.
Sorry I don't understand what you mean? Here a demo with my current work: |
@angelozerr I am hoping that the VS Code developers will implement OS and/or hostname qualifiers for the settings.json file, so that I could then specify a different catalog.xml file for Windows vs. Linux. See this issue for what I am talking about. The plugin works fine for me on my Linux box now with the addition of the catalog.xml file. Thanks for all of your assistance! |
Thank's for the information.
You are welcome! The DTD validation when DTD doesn't exists will come soon. |
See redhat-developer/vscode-xml#167 Signed-off-by: azerr <azerr@redhat.com>
Fixed with eclipse-lemminx/lemminx#512 This feature will be available in 0.8.0 |
If I load an XML file with a specified DTD such as the following:
If the extension can not find the DTD, then I understand why no validation can be done. However, it also does not check for well-formedness (e.g. non-matching closing tags), which I would expect the extension to fall back upon.
The text was updated successfully, but these errors were encountered: