Validating web content files
JetBrains Rider performs two different validity checks:
On-the-fly validation is available for all Web content files and is performed as you edit the file. JetBrains Rider checks well-formedness, that is, detects various violations of syntax requirements, such as unclosed tags, wrong end-tag name, duplicate tags, unresolved links, and so on. All encountered errors are highlighted in the editor.
However, this form of code validation is rather soft, that is, not all requirements are taken into account.
Full validation involves structure validation in addition to well-formedness check. Full validation is available for files that are associated with an XSD (XML Schema Definition) Schema or contain a Data Type Definition (DTD). JetBrains Rider checks whether the structure of your XML file complies with the structure defined in the corresponding DTD or Schema.
The results of full validation are provided as a Message View.
Choosing the default HTML language level
Normally, an HTML or an XHTML file has the <!DOCTYPE>
declaration which states the language level of the used in the source code from the file. This language level is used as a standard against which the contents of the file are validated. If an HTML or an XHTML file does not have a <!DOCTYPE>
declaration, the contents of the file will be validated against the default standard (schema).
In the Settings/Preferences dialog Ctrl+Alt+S, go to . The Default XML Schemas page opens.
In the Default HTML Language Level area, choose the default schema to validate HTML and XHTML files without a
<!DOCTYPE>
declaration. The available options are:HTML 4 or HTML 5: select one of these options to have files treated as HTML 4 or HTML 5 and validated against one of these standards.
Other doctype: select this option to have HTML files by default validated against a custom DTD or schema and specify the URL of the DTD or schema to be used.
Note that code completion is available in this field: press Ctrl+Space to see the list of suggested URLs.
Choose the XSD (XML Schema Definition) Schema to validate XML files. The available options are:
XML Schema 1.1: see W3C XML Schema Definition Language (XSD) 1.1 Part 1: Structures and W3C XML Schema Definition Language (XSD) 1.1 Part 2: Datatypes for details.
XML Schema 1.0: see XML Schema Part 1: Structures Second Edition and XML Schema Part 2: Datatypes Second Edition for details.
Choosing the default schema to validate XML files
In the Settings/Preferences dialog Ctrl+Alt+S, click Schemas and DTDs under Languages and Frameworks, and then click Default XML Schemas. The Default XML Schemas page opens.
In the Default XML Schema Version area, Choose the XSD (XML Schema Definition) Schema to validate XML files. The available options are:
XML Schema 1.1: see W3C XML Schema Definition Language (XSD) 1.1 Part 1: Structures and W3C XML Schema Definition Language (XSD) 1.1 Part 2: Datatypes for details.
XML Schema 1.0: see XML Schema Part 1: Structures Second Edition and XML Schema Part 2: Datatypes Second Edition for details.
Running full validation on an XML file
Open the desired XML file in the editor, or just select it in the Project tool window.
Right-click any code element in the editor and from the context menu, choose
.