

/****************************
 @by wtt
 @20151107
 @把字符串转换为对象数组
 *****************************/
export function XmlHelper() {

    var m_xmlDoc;
    this.loadFileXml = function (xmlFile) {
        var xmlDoc = null;
        if (window.ActiveXObject) {
            xmlDoc = new ActiveXObject('Microsoft.XMLDOM'); //IE浏览器
            xmlDoc.async = false;
            xmlDoc.load(xmlFile);
        }
        else if (navigator.userAgent.indexOf("Firefox") > 0) { //火狐浏览器

            xmlDoc = document.implementation.createDocument('', '', null);
            xmlDoc.load(xmlFile);
        }
        else { //谷歌浏览器
            var xmlhttp = new window.XMLHttpRequest();
            xmlhttp.open("GET", xmlFile, false);
            xmlhttp.send(null);
            if (xmlhttp.readyState == 4) {
                xmlDoc = xmlhttp.responseXML.documentElement;
            }
        }
        return xmlDoc;
    }

    this.getNodeTagName = function (node) {
        var value, tagName
        if (document.all) {
            value = node.text; //IE
            tagName = node.tagName
        }
        else {
            tagName = node.nodeName;
            value = node.textContent;
        }
        return tagName;
    }

    this.getNodeValue = function (node) {
        var value, tagName
        if (node.nodeType != 1)
            return null;
        if (document.all) {
            value = node.text; //IE
            tagName = node.tagName
        }
        else {
            tagName = node.nodeName;
            value = node.textContent;
        }
        return value;
    }





}