PhpStorm 8.0.2 Web Help

Referencing DTD or Schema

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, PhpStorm supports standard ways, in particular, xsi attribute.

If PhpStorm 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+Enter.
  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+Enter.
  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 (Enter).
  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+Enter 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.

To add Xsi schema location for external resources

  1. In the xml file, specify URI of DTD or schema.
  2. Press the Alt+Enter 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+Enter 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.

See Also

Reference:

Last modified: 10 December 2014