When an XML file references his schema (xsd) url, editing is easier in Eclipse. We can validate the xml file against this schema and use eclipse content assist which suggest possible values of tags.
An invalid reference to the schema.
In my current work, I have to edit XML files whose schema reference are invalid.
In the example below the xsd definition is not only commented out but also malformed. However I want the document to validate against modelSchema.xsd but I am not allowed to modify the header.
This is not the first time I see this on production environments. I suspect this is a quick and dirty workaround to avoid a parsing error when the server is not well configured to reach the Internet (or the schema is not deployed locally on the server).
<!--?xml version="1.0" encoding="UTF-8"?--> <!-- xsi:schemaLocation="http://www.alfresco.org/model/dictionary/1.0 modelSchema.xsd" --> <model name="my:customModel" xmlns="http://www.alfresco.org/model/dictionary/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <description>Custom Model</description> <author>odm</author> <version>1.0</version> </model>
Workaround: force eclipse to validate localy
Copy the xsd file localy and configure eclipse XML catalog to use the local schema to validate and provide content-assist.
Under Global preferences/XML/XML catalog, add a new entry:
location myEclipseProject/modelSchema.xsd key type: namespace entry key: http://www.alfresco.org/model/dictionary/1.0
Right click on the xml file, launch “validate”.