Code Inspection and Quick-Fixes in XML
The key features of ReSharper's code analysis are also supported in XML. You can find the detailed information on these features in the corresponding topics of the Code Analysis section. In the main topic of the section, you can also find the feature matrix and check what exactly is supported in XML.
In this topic, you can find some examples of using code analysis features in XML.
Code Inspection
ReSharper identifies various problems in XML files, such as invalid attributes, incorrect document structure, and so on For instance, ReSharper warns about unexpected attribute in the XML header:
![ReSharper: XML code highlighting ReSharper: XML code highlighting](https://resources.jetbrains.com/help/img/dotnet/2021.1/ReSharper_by_Language__XML__Code_Highlighting_01.png)
The analysis is performed by applying Code Inspections to the current document or in any specified scope.
Examples of Quick-Fixes
Fix XML processing instruction
If there is some problem with the processing instruction, ReSharper informs you and suggests a quick-fix to solve the problem.
![ReSharper: Fix XML processing instruction quick-fix ReSharper: Fix XML processing instruction quick-fix](https://resources.jetbrains.com/help/img/dotnet/2021.1/ReSharper_by_Language__XML__Quick-Fixes__fix_processing_instruction_01.png)
After applying the quick-fix, the processing instruction is fixed according to XML rules.
![ReSharper: Fix XML processing instruction quick-fix ReSharper: Fix XML processing instruction quick-fix](https://resources.jetbrains.com/help/img/dotnet/2021.1/ReSharper_by_Language__XML__Quick-Fixes__fix_processing_instruction_02.png)
Delete erroneous XML comment
If there is a comment inside a start tag, ReSharper provides a quick-fix to delete that comment.
![ReSharper: Delete erroneous XML comment quick-fix ReSharper: Delete erroneous XML comment quick-fix](https://resources.jetbrains.com/help/img/dotnet/2021.1/ReSharper_by_Language__XML__Quick-Fixes__delete_comment_01.png)
After applying the quick-fix the comment is properly deleted.
![ReSharper: Delete erroneous XML comment quick-fix ReSharper: Delete erroneous XML comment quick-fix](https://resources.jetbrains.com/help/img/dotnet/2021.1/ReSharper_by_Language__XML__Quick-Fixes__delete_comment_02.png)
Insert closing tag
If the document structure is incorrect and there is an unmatched opening tag, use this quick-fix to insert the corresponding closing tag.
![ReSharper: Insert closing tag quick-fix ReSharper: Insert closing tag quick-fix](https://resources.jetbrains.com/help/img/dotnet/2021.1/ReSharper_by_Language__XML__Quick-Fixes__insert_closing_tag_01.png)
After applying this quick-fix the closing id
tag is inserted.
![ReSharper: Insert closing tag quick-fix ReSharper: Insert closing tag quick-fix](https://resources.jetbrains.com/help/img/dotnet/2021.1/ReSharper_by_Language__XML__Quick-Fixes__insert_closing_tag_02.png)