﻿// copyright MAJENKA - http://majenka.net

// xml
    
//================================================================================================    

function XML() {}

XML.CreateDocFromString = function(xmlString)
{
    var xmlDoc = null;

    if (window.ActiveXObject) 
    {
        //for IE
        xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
        xmlDoc.async = "false";
        xmlDoc.loadXML(xmlString);
    } 
    else if (document.implementation && document.implementation.createDocument) 
    {
        // for Mozila and others
        var parser = new DOMParser();
        xmlDoc = parser.parseFromString(xmlString,"text/xml");
    }

    return xmlDoc;
}
    
XML.CreateDocFromFile = function(xmlFilePath)
{
    var xmlDoc = null;

    if (window.ActiveXObject)
    {
        // code for IE
        xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    }
    else if (document.implementation && document.implementation.createDocument)
    {
        // code for Mozilla, Firefox, Opera, etc.
        xmlDoc = document.implementation.createDocument("", "", null);
    }
//    else
//    {
//        alert('Your browser cannot handle this script');
//    }

    xmlDoc.async = false;
    xmlDoc.load(xmlFilePath);

    return(xmlDoc);
}