# Generate a schema from an XML file

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/help/ruby/2026.3/llms.txt).

A schema is required for running [structure validation checks](validating-web-content-files.html) on a web content file. RubyMine can scan any XML file for the existing elements and attributes and generate a DTD for it.

## Generate a schema from an XML file

Procedure:

1. Open the file in the editor.

2. In the main menu, go to `Tools | XML Actions | Generate Schema From XML File`. The Convert Schema File dialog opens.

![Convert Schema File dialog](https://resources.jetbrains.com/help/img/idea/2026.3/rm_convert_schema_file.png)

3. In the Output type area, specify the format for the generated schema. The available options are:

* [RELAX NG - XML Syntax](https://relaxng.org/spec-20011203.html)

* [RELAX NG - Compact Syntax](https://relaxng.org/compact-20021121.html)

* [W3C XML Schema](https://www.w3.org/XML/Core/)

* [DTD](https://www.w3schools.com/xml/xml_dtd_intro.asp)

4. Specify the encoding, indentation, and maximum line length.

5. In the Output Destination field, specify where you want the generated schema file to be stored.

6. Optionally:

Click Advanced and specify additional options in the Advanced Conversion Options dialog that opens. For more information, refer to the [RELAX NG official website](https://relaxng.org/jclark/trang-manual.html).

> **Tip:**
> If the Generate Schema From XML File action is disabled, make sure that the XML file is not  [marked as plain text](configuring-project-structure.html#exclude-files)
>
> and is not in an  [excluded directory](configuring-project-structure.html#ws_configure_projects_content_root_folder_categories_configure)
>
> .

## Convert DTD to other schemas

Procedure:

1. Open the `.dtd` file in the editor and select `Tools | XML Actions | Convert Schema...` from the main menu. The Convert Schema File dialog opens.

2. In the Output type area, specify the format for the generated schema. The available options are:

* [RELAX NG - XML Syntax](https://relaxng.org/spec-20011203.html)

* [RELAX NG - Compact Syntax](https://relaxng.org/compact-20021121.html)

* [W3C XML Schema](https://www.w3.org/XML/Core/)

3. Specify the encoding, indentation, and maximum line length.

4. In the Output Destination field, specify where you want the generated schema file to be stored.

5. Optionally:

Click Advanced and specify additional options in the Advanced Conversion Options dialog that opens. For more information, refer to the [RELAX NG official website](https://relaxng.org/jclark/trang-manual.html).

## See also

### Language and Framework-Specific Guidelines

[Style Sheets](style-sheets.html)

### Procedures

[Validating web content files](validating-web-content-files.html)

