Closed blasss closed 1 year ago
Error in XML editor of wild web developer:
Your analysis of the cause of the issue seems correct. Please consider submitting a pull request that fixes it.
@blasss @mickaelistria After the commits is merged, can we consider the issue fixed?
No objection to close.
Closing as resolved with https://github.com/eclipse/wildwebdeveloper/commit/1d7a22329569f209479c3ddb1c0c2de192dcd6c9
We develop a Eclipse plugin that contributes XML schemas to the XML catalog using the extension point
org.eclipse.wst.xml.core.catalogContributions
.The XML schema documents are packaged with the plugin and thus use a relative URI to reference the files. What is special about the schema documents is that they use
include
-elements [https://www.w3.org/TR/xmlschema11-1/#compound-schema] to assemble multiple schema documents. The additional schema documents are as well packaged with the plugin and are referenced relative.In contrast to the XML editor of WTP this doesn't work with the XML editor of wild web developer. The editor complains about errors in the schema document, where the number of errors correlates with the number of
include
-elements.I could already track this down to the fact that the system catalog (
<workspace>\.metadata\.plugins\org.eclipse.wildwebdeveloper.xml\system-catalog.xml
) contains a reference to the schema document that is extracted from the plugin (somewhere like<eclipse-installation>/configuration/org.eclipse.osgi/14/0/.cp/de/foo/schema.xsd
). Unfortunately the referenced schema documents are not extracted at all and therefore the relative references can't be resolved.With further investigation it became evident that this is related to the use of
FileLocator.toFileURL(URL)
to resolve URIs that are not offile
-scheme. The method is used inresolveURI(IConfigurationElement()
oforg.eclipse.wildwebdeveloper.xml.internal.ui.preferences.XMLCatalogs
, which is called bygetWTPExtensionCatalog()
. As denoted in JavaDoc the contents might be extracted to a cache in the file system. This seems to be the case for URIs to plugins without further resolving.From a users perspective the use of
include
-elements in a schema document is perfectly fine and therefore this should be supported by the XML editor.A possible fix I can think of might be resolving the URI to a native java protocol (FileLocator.resolve(URL)) and passing the schema document in its original location. The resolving should yield a jar-URI which should be perfectly fine for any java process.
Another more extensive option would be to scan the schema documents and include the referenced files in the cache as well.