You could utilize a macro script for that, which acts on event “File Opened”
– save the macro as “DetectXML.jsee” to your EmEditor folder (I have a sub folder “Macros” created for that use)
– utilize “Macros > Select…” and select this new macro file to add it to MyMacros category.
– chose “Macros > Customize…”
– select the macro (at the end of the list),
– enable “[x] Run at Events”
– press at [Events…] and chose “[x] File Opened”
Test by opening an file containing XML structured text but lacks the XML extension (or not)
(you may want to delete the “alert()” lines)
alert ('xml file detected'); //this line can be delete
alert("Current Configuration: " + document.ConfigName); //line can be delete
document.ConfigName = "XML"; //switch configuration to XML
alert("Configuration switched to: " + document.ConfigName); //line can be delete
Could be improved with
strFirstLine = document.GetLine( 1 ); if strFirstLine.indexOf(“<?xml”)…..
to detect at top of document only.