WebStorm 8.0.0 Web Help

For an XML file to validate, you have to reference a DTD or a schema file. You can identify the DTD source in your xml file, for instance, like this:

<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd" >

To reference a schema file, WebStorm supports standard ways, in particular, xsi attribute.

If WebStorm cannot find the specified DTD or schema, they are marked as errors. In this case special intention actions are suggested to:

To fetch a DTD or schema file
  1. In the xml file, specify the URI of the DTD or schema. If the desired file is not found, the reference is marked as an error.
  2. Press Alt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+Enter, Shift+Alt+J or Ctrl+Shift+MAlt EnterAlt EnterCommand 1.
  3. In the suggestion list, choose Fetch external resource.
To map a DTD or schema URI to a local file
  1. In the xml file, specify the URI of the DTD or schema. If the desired file is not found, the reference is marked as an error.
  2. Press Alt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+Enter, Shift+Alt+J or Ctrl+Shift+MAlt EnterAlt EnterCommand 1.
  3. In the suggestion list, select the option Manually Set Up External Resource. The Resources dialog box opens showing the new URI selected.
  4. Click edit1 (EnterEnterEnterEnterEnterEnterEnterEnterEnterEnterEnter).
  5. In the External Resources dialog box, specify the path to the desired DTD or schema file and click OK.
  6. Apply changes and close the Resources dialog box.
To permanently ignore a DTD or schema
  1. In the xml file, specify the URI of the desired DTD or schema.
  2. Press the Alt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+Enter, Shift+Alt+J or Ctrl+Shift+MAlt EnterAlt EnterCommand 1 keyboard shortcut, if the specified DTD or schema is not found and marked as an error.
  3. In the suggestion list, select the option Ignore External Resource. The URI is added to the Ignored Resources list of the Resources dialog box.

Tip

To remove a URI from the ignore list, open the Resources dialog box (File | Settings | IDE Settings | Resources ), select the desired URI in the Ignored Resources list, then click Remove.

To add Xsi schema location for external resources
  1. In the xml file, specify URI of DTD or schema.
  2. Press the Alt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+Enter, Shift+Alt+J or Ctrl+Shift+MAlt EnterAlt EnterCommand 1 keyboard shortcut, if the specified DTD or schema is not found and marked as error.
  3. In the suggestion list, select the option Add Xsi Schema Location for External Resources.
To configure schema for XML file
  1. In the xml file, specify the schema. If the desired file is not found, the reference is marked as an error.
  2. Press Alt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+Enter, Shift+Alt+J or Ctrl+Shift+MAlt EnterAlt EnterCommand 1 keyboard shortcut, if the specified schema is not found and marked as error.
  3. In the suggested list, select the option Manually Setup External Resource. The Map External Resource dialog box opens showing the list of all schemas found in your project.
  4. In the Map External Resource dialog box, select the path to the desired schema file and click OK.

Note

WebStorm automatically tries to match schema by information available in the document, such as namespace or system id. If auto-detection fails or you need to adjust the schema manually, you can use Manually Setup External Resource intention.

See Also

Reference:

Web Resources: