create and modify xml file using javascript (want to save xml file on client side)

Posted by user201478 on Stack Overflow See other posts from Stack Overflow or by user201478
Published on 2009-11-25T09:11:56Z Indexed on 2010/05/12 19:14 UTC
Read the original article Hit count: 399

Filed under:
|

Hi ,

How to save xml file on client side using javascript...?

        if (window.XMLHttpRequest) {
            xhttp = new XMLHttpRequest();
        }
        else // Internet Explorer 5/6
        {
            xhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xhttp.open("GET", "User.xml", false);
        xhttp.send("");
        xmlDoc = xhttp.responseXML;

        xmlDoc.getElementsByTagName("Username")[0].childNodes[0].nodeValue = 'asdasf';
        xmlDoc.getElementsByTagName("password")[0].childNodes[0].nodeValue = 'asdAS';
        xmlDoc.getElementsByTagName("UserId")[0].childNodes[0].nodeValue = '12';
        xmlDoc.save("User.xml");

this is not working.. showing error as save is not a function.

Thanks Suneetha.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about Xml