Currently, Notepad++ recognizes XML files by their file name extension (.xml). Opening a ".xml" file enables XML syntax highlighting and collapsible nodes.
But there are many kinds of files with various extensions other ".xml" that contain XML (.config, .csproj, .csproj.user, .manifest, ...). It is impractical to list all extensions for XML content files in the Notepad++ configuration file.
I propose a simple workaround. When opening a file, if the extension is not already recognized by Notepad++, read the beginning of the file and look for an XML declaration (<?xml version="1.0" encoding="utf-8"?>). If the declaration is found, then set the language to XML.
Of course, there are some minor details to think about like what if the declaration is preceded by whitespace. Also, this feature should probably be avoided for very large files (10+ MB), since the analysis of the XML content can take some time.
All in all, I think this is a pretty simple addition that many users could find useful. What do you think?
If indeed there are too many extensions whichshould be aliased with .xml, so that the usual mehanism becomes unpractical, then it is probably a good thing to consider. Please post a feature request ticket about it.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.