473,395 Members | 1,783 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Append XML using ASP

This should be pretty simple for you guys. I've been trying to append values
to my XML file but I can't get it to work correctly.

index.html passes the values of a form to the new_user.asp file and I want
it to write my members.xml file.

Once the xml file has been written and saved, I coded the ASP file to
redirect to google, just to see if its working, which it does but the data
has not been written to the XML file.

Any ideas where I'm going wrong.

index.html
=======

<html>
<body>
<form action="new_user.asp" method="post" name="new_user_form">
<table>
<tr>
<td>
<table>
<tr>
<td>Username:</td>
<td><input name="Username" type="text"></td>
</tr>
<tr>
<td>Email Address:</td>
<td><input name="Email" type="text"></td>
</tr>
<tr>
<td>Password:</td>
<td><input name="Password" type="password"></td>
</tr>
</table>
<p><input type="submit" name="submit" value="submit"></p>
</td>
</tr>
</table>
</form>
</body>
</html>

new_user.asp
=========

<%@ Language=JScript%>

<%

var username = Request.Form("Username")
var email = Request.Form("Email")
var password = Request.Form("Password")

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

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

if(nodeList.length > 0){

var parentNode = nodeList(0);
var memberNode = xmlDoc.createElement("member");
var usernameNode = xmlDoc.createElement("username");
var emailNode = xmlDoc.createElement("email");
var passwordNode = xmlDoc.createElement("password");

usernameNode.text = username;
emailNode.text = email;
passwordNode.text = password;

parentNode.appendChild(memberNode);
memberNode.appendChild(usernameNode);
memberNode.appendChild(emailNode);
memberNode.appendChild(passwordNode);

xmlDoc.save(Server.MapPath("/members.xml"));

}

Response.Redirect("http://www.google.co.uk")

%>

members.xml
=========
<members>
<member>
<username>thomas</username>
<email>th****@hotmail.com</email>
<password>123456</password>
</member>
</members>
Jul 20 '05 #1
2 2180


thomas wrote:

Once the xml file has been written and saved, I coded the ASP file to
redirect to google, just to see if its working, which it does but the data
has not been written to the XML file.


Could be a rights problem, make sure the account under which ASP is
exectued has the rights to access and overwrite that file.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #2
You should also wrap this in an Application.Lock(), and Application.UnLock()
if you want to handle multiple concurrent requests safely.

"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:42**********************@newsread4.arcor-online.net...


thomas wrote:

Once the xml file has been written and saved, I coded the ASP file to
redirect to google, just to see if its working, which it does but the
data has not been written to the XML file.


Could be a rights problem, make sure the account under which ASP is
exectued has the rights to access and overwrite that file.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: yaffa | last post by:
dear folks, i'm trying to append a semicolon to my addr string and am using the syntax below. for some reason the added on of the ; doesn't work. when i print it out later on it only shows the...
25
by: Yves Glodt | last post by:
Hello, if I do this: for row in sqlsth: ________pkcolumns.append(row.strip()) ________etc without a prior:
3
by: Jonathan Buckland | last post by:
Can someone give me an example how to append data without having to load the complete XML file. Is this possible? Jonathan
9
by: JMCN | last post by:
hi- i have inherited an access 97 database that keeps track of the loans. i have been running into referential intergrity problems when i try to append new loans to table. first of all is a...
1
by: Aaron | last post by:
Hello fellow programmers, I am trying to run an append/update query from code, a command button on a form initiates the queries. the format i am using is; ...
14
by: vbMark | last post by:
Greetings, This seems like it should be simple but I can't figure out how to do this. I just want to append binary file 2 on to the end of binary file 1. Sample code please? Thanks!
4
by: robboll | last post by:
When I try to use an append query from an oracle link it takes forever. I am exploring the idea of doing an append action using a pass-through query. If I have an Oracle ODBC connection to...
10
by: HYRY | last post by:
I have the following questions, I am using Python 2.4.2 19167152 #1 11306608 #1 1. the address of a.append and list.append is different, can I get the address of...
3
by: hikosj | last post by:
Hi all, I have a problem with a query in access that I cant seem to figure out. I have a form named frmRecruitment with a subform named sfrmParticipant. At the moment I am using an append query to...
4
by: franc sutherland | last post by:
Hello, I am using Access 2003. I am having trouble trapping the "can't append all the records in the append query" error message when appending data to a query from a table which is linked to...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.