Friday 27 January 2012

JavaScript function to get XML object from string

Here's a function that you can use to load an xml object from an xml-formatted string in JavaScript:

function loadXMLFromString(text)
    {
        try //Internet Explorer
        {
            xmlDoc=new ActiveXObject('Microsoft.XMLDOM');
            xmlDoc.async='false';
            xmlDoc.loadXML(text);
        }
        catch(e)
        {
            try //Firefox, Mozilla, Opera, etc.
            {
                parser=new DOMParser();
                xmlDoc=parser.parseFromString(text,'text/xml');
            }
            catch(e) {alert(e.message);}
        }
       
        return xmlDoc;
    }


Thursday 26 January 2012

How to remove whitespace dots in Visual Studio Text Editor

If white space (spaces, tabs, etc) is showing as dots in the visual studio text editor, you can undo this by using the key combination Ctrl+E,S.

If you prefer the dots (why??) you can enable them again by pressing Ctrl+R,W.

HTH