Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Writing XML

From: "Jim" <jim1234@-------.--->
To: NULL
Date: 6/2/2006 3:46:00 PM

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.FreeThreadedXMLDOM");
  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>a@b...</email>
    <email>c@d...</email>
    <email>c@d...</email>
</address> 




transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent