Display Error

The DetectXML.jsee only seems works on a freshly opened documents. But if you move the cursor below the first line and then re-open the document it can’t find “<?xml” since the cursor position is saved and past the 1st line. I was unable to get the “strFirstLine = document.GetLine( 1 );” to work as it spits out a “Expected (” error.

Is there an alternate method for automagically detecting and switching to XML scheme?