-
Notifications
You must be signed in to change notification settings - Fork 97
Description
Opening any XSD file that attempts to import a no-longer-present http[s]-served XML Schema with the VSCode XML plugin, version v0.18.0 active causes a large number of errors to appear in the Problems pane. These are a result of attempting to parse a web page as an XSD.
Steps to reproduce
- Install and activate the XML Language Support by Red Hat plugin in Visual Studio Code.
- Download http://java.sun.com/xml/ns/j2ee/j2ee_1_4.xsd
- Open
j2ee_1_4.xsdin Visual Studio Code.
Observed result
See attached screenshot. The majority of the file is highlighted as an error. Many error messages like the following appear in the Problems view:
s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'digitalData = {'.
Confusingly, from a user's perspective, the error messages imply that the source code of that IBM webpage is present immediately following the closing angle bracket of the opening xsd:schema tag. The error highlight continues from that point until the end of the file.
Cause
j2ee_1_4.xsd lines 85-86 contain an import directive for http://www.ibm.com/webservices/xsd/j2ee_web_services_client_1_1.xsd, which is no longer present at that location. There is an HTTP redirect to a regular web page, https://www.ibm.com/products/software
Expected result
- The plugin gives a useful error message, indicating that a (perhaps transitively) imported schema is invalid, not the currently open file.
- The plugin highlights the location of problematic import(s) in the currently open file, rather than highlighting the whole file contents.
- In cases of transitive imports, the error message includes the "path" to the invalid schema, such as "http://www.ibm.com/webservices/xsd/j2ee_web_services_client_1_1.xsd is invalid, imported at http://java.sun.com/xml/ns/j2ee/j2ee_1_4.xsd [85,3], imported at deployment_plan.xsd [21,3]"
- The plugin detects and rejects an imported "schema" that starts with any of the usual indications of an HTML document, such as
<!DOCTYPE html>,<html>, etc. with a useful error message.
