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

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

Fetching a DTD or schema file

To resolve a reference to a DTD or schema file, use the Fetch external resource intention action.

  1. In an xml file, specify a URI of the DTD or schema. If the corresponding file is not found, the reference is marked as an error.
  2. Place the cursor within the reference and press Alt+Enter.
  3. In the suggestion list, select Fetch external resource.

RubyMine downloads the file and creates a mapping between the URI and the local file. The reference becomes resolved.

To see the mapping, go to the Schemas and DTDs page in the setting dialog.

Mapping a DTD or schema URI to a local file

  1. In an xml file, specify a URI of the DTD or schema. If the corresponding file is not found, the reference is marked as an error.
  2. Place the cursor within the problematic URI and press Alt+Enter.
  3. In the suggestion list, select Manually Setup External Resource.
  4. In the dialog that opens, select a file for the specified URI and click OK.

Ignoring a DTD or schema

  1. In an xml file, specify a URI of the DTD or schema. If the corresponding file is not found, the reference is marked as an error.
  2. Place the cursor within the reference and press the Alt+Enter.
  3. In the suggestion list, select Ignore External Resource. The URI is added to the Ignored Schemas and DTDs list.

To remove the URI from the Ignored Schemas and DTDs list,

  1. Open the Schemas and DTDs page of the setting dialog.
  2. Under Ignored Schemas and DTDs, select the URI and click delete.
  3. Click OK in the Settings dialog.

Adding an Xsi schema location for an external resource

  1. In an xml file, specify a URI of the DTD or schema.
  2. Press Alt+Enter if the specified DTD or schema is not found and marked as an error.
  3. In the suggestion list, select Add Xsi Schema Location for External Resources.

Configuring a schema for an XML file

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

  1. In an xml file, specify the schema. If the desired file is not found, the reference is marked as an error.
  2. Place the cursor within the reference and press Alt+Enter.
  3. In the suggestion list, select 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

Last modified: 3 February 2015
comments powered by Disqus