Generating DTD
A Data Type Definition (DTD) is required for running structure validation checks on a web content file. IntelliJ IDEA can scan any XML file for the existing elements and attributes and generate a DTD for it.
Generate a DTD for an XML file
Open the file in the editor.
From the main menu, select Tools | XML Actions | Generate DTD From XML File. IntelliJ IDEA inserts the resulting DTD as a section above the first line of the file.
tip
If the Generate DTD From XML File action is disabled, make sure that the XML file is not marked as plain text and is not in an excluded directory.
Convert DTD to XSD
Open the .dtd file in the editor and select Tools | XML Actions | Convert Schema from the main menu. The Convert Schema File dialog opens.
In the Output type area, specify the format for the generated schema. The available options are:
Specify the encoding, indentation, and maximum line length.
In the Output Destination field, specify where you want the generated schema file to be stored.
Optionally:
Click Advanced and specify additional options in the Advanced Conversion Options dialog that opens. See the RELAX NG official website for details.