Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Writing XML

Reply
Thread Tools

Writing XML

 
 
Jim
Guest
Posts: n/a
 
      06-02-2006
Hi folks,

Could anyone help me with this one?

I want to put something on my website were people can leave their email
address to sign up for our newsletter. I've tried using JScript that writes
to an xml file.

When you click on 'enter' you are redirected to the 'done.html'. I've set
write permissions to the xml file but it doesn't seem to be working, can
anyone see what I'm doing wrong?



add.html
---------
<html>
<body>
<form name="add_email" method="post" action="add.asp">
<table>
<tr>
<td><p>Enter email</p></td>
<td><input type="text" name="email" id="email"></td>
<td><input type="submit" name="submit" value="enter"></td>
</tr>
</table>
</form>
</body>
</html>



add.asp
--------
<%@ Language=JScript%>

<%

var email = Request.Form("email")

var xmlDoc=Server.CreateObject("MICROSOFT.FreeThreaded XMLDOM");
xmlDoc.async="false";
xmlDoc.load(Server.MapPath("/test/email_address.xml"));

var nodeList = xmlDoc.getElementsByTagName("address");

if(nodeList.length > 0){

var parentNode = nodeList(0);
var addressNode = xmlDoc.createElement("address");
var emailNode = xmlDoc.createElement("email");

addressNode.text = address;
emailNode.text = email;

parentNode.appendChild(addressNode);
addressNode.appendChild(emailNode);

xmlDoc.save(Server.MapPath("/test/email_address.xml"));

}

Response.Redirect("done.html")

%>



email_address.xml
-------------------
<address>
<email>(E-Mail Removed)</email>
<email>(E-Mail Removed)</email>
<email>(E-Mail Removed)</email>
</address>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Different results parsing a XML file with XML::Simple (XML::Sax vs. XML::Parser) Erik Wasser Perl Misc 5 03-05-2006 10:09 PM
Any problems with writing the information into a file - Multi-users perform writing the same file at the same time ???? HNguyen ASP .Net 4 12-21-2004 01:53 PM
Print XML parsing to JspWriter (out) Class org.xml.sax.helpers.NewInstance can not access a member of class javax.xml.parsers.SAXParser with modifiers "protected" Per Magnus L?vold Java 0 11-15-2004 02:27 PM
What XML technologies to learn first for "XML Processing" and "XML Mapping"? Bomb Diggy Java 0 07-28-2004 07:26 AM
Writing a gui to map foreign XML <> local XML in python Christopher Boomer XML 0 07-28-2003 02:26 PM



Advertisments