Click here to Skip to main content
15,905,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

From this article: Writing XML using JavaScript[^]

The program is good and simple for use. However, it only display xml data on screen.

Can I modify this program to write xml data into a file or email them to someone? Could you help me to do so?


Thanks,
Paulus
[removed email]
Posted
Updated 17-Jul-11 16:42pm
v3

what you need to know is how to create a text file with javascript.


try this link

http://www.c-point.com/JavaScript/articles/file_access_with_JavaScript.htm[^]


C#
function WriteFile()
{

var fh = fopen("c:\\MyFile.txt", 3); // Open the file for writing

if(fh!=-1) // If the file has been successfully opened
{
    var str = "Some text goes here...";
    fwrite(fh, str); // Write the string to a file
    fclose(fh); // Close the file
}

}

WriteFile();



and you can pass the Output XMLWriter to the WriteFile function.

good luck.
 
Share this answer
 
v2
It might be best to post your question on the article itself rather than posting it here. The author knows his code better than anyone else.

So ask your question here Writing XML using JavaScript - Comments section[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900