This is a pure JavaScript solution for your problem (I hope).
JSFiddle
// The initial string
var xmlString = '<?xml version="1.0" ?><myRoot><someNode></someNode></myRoot>';
// Parse the string with the function defined below
var doc = parseXml(xmlString);
// Extract the name of the root element
var rootName = doc.documentElement.nodeName;
alert(rootName); // Alerts "myRoot" in this example
// Cross-browser function to parse an XML string
function parseXml(xmlString) {
var doc;
if (window.ActiveXObject) {
// Internet Explorer
doc = new ActiveXObject("MSXML.DOMDocument");
doc.async = false;
doc.loadXML(xmlString);
} else {
// Other browsers
var parser = new DOMParser();
doc = parser.parseFromString(xmlString, "text/xml");
}
return doc;
}