Referencing XML schemas and DTDs
Your XML file may reference an external XML schema (XSD) or DTD file, for example:
or
If the referenced URL or the namespace URI is not recognized, it's marked as an error. To solve the problem:
Place the caret at the referenced URL and press Alt+Enter.
From the list of suggested options, select one of the following:
Fetch external resource. RustRover downloads the referenced file and associates it with the URL (or the namespace URI). The error highlighting disappears. The XML file is validated according to the downloaded schema or DTD. (The associations of the URLs and the namespace URIs with the schema and DTD files are shown on the Schemas and DTDs page in the Settings dialog.)
Manually set up external resource. Use this option when you already have an appropriate schema or DTD file available locally. The Map External Resource dialog will open, and you'll be able to select the file for the specified URL or namespace URI (for example,
http://www.example.org/xsds/example.xsd
orhttp://www.example.org
). The result of the operation is the same as in the case of fetching the resource.Ignore external resource. The URL or the namespace URI is added to the list of Ignored Schemas and DTDs. (This list is shown on the Schemas and DTDs page in the Settings dialog.) The error highlighting disappears. RustRover won't validate the XML file, however, it will check if the XML file is well-formed.
Add Xsi Schema Location for External Resource. This intention action lets you complete your root XML elements. If the namespace is already specified, RustRover can add a couple of missing attributes.
For example, if you have a fragment like this:
and you invoke the Add Xsi Schema Location for External Resource intention action on the value of the xmlns
attribute, the result will be:
At this step, you can add the schema URL, and then map the URL (or the namespace URI) onto an appropriate schema file, or add the URL (or the URI) to the list of Ignored Schemas and DTDs.