473,794 Members | 2,983 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting error while adding record in XML file

20 New Member
Hi,
This is my code:

<html>
<head></head>
<body>
<script language="javas cript" runat="server">

var xmlDoc=new ActiveXObject(" Microsoft.FreeT hreadedXMLDOM") ;
xmlDoc.async="f alse";
xmlDoc.load ("d:\testxml.xm l");
var uid = xmlDoc.createEl ement("userid") ;
var tref = xmlDoc.createEl ement("tenderre f");
var e = xmlDoc.createEl ement("error");
var tt=xmlDoc.creat eElement("tflag ");
uid.text ="Dipti";
tref.text = "1234";
e.text="err";
tt.text="ttlfla g";
var newdata= xmlDoc.createEl ement("DataTend er");
newdata.appendC hild(uid);
newdata.appendC hild(tref);
newdata.appendC hild(e);
newdata.appendC hild(tt);

//var x=xmlDoc.getEle mentsByTagName( "ErrorTende r");
var x = xmlDoc.document Element;

x.appendChild(n ewdata); //line no. 25, error here

xmlDoc.save("d: \testxml.xml");
</script>
</body>
</html>

In this i m trying to add new node to XMl file but i m getting this error, plz help me, it is very urgent


Error Type:
Microsoft JScript runtime (0x800A138F)
'x' is null or not an object
/dipti/tryxml2.asp, line 25


this is my xml file

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<ErrorTender>
<DataTender>
<userid>hjksahd </userid>
<tenderref>dfgd sgf</tenderref>
<error>dfsdfs d</error>
<tflag>dfdsf</tflag>
</DataTender>
</ErrorTender>


Thanks and regards
Jun 12 '07 #1
3 2868
acoder
16,027 Recognized Expert Moderator MVP
See this cross-browser example of loading an XML document. I'm not sure what FreeThreadedXML DOM is.
Jun 12 '07 #2
Dipti Singh
20 New Member
Thanks a lot for ur reply....
but please see the code, i m calling javascript code like this...

response.write "<script language='javas cript' runat='server'>
var xmlDoc=Server.C reateObject('Mi crosoft.XMLDOM' );
xmlDoc.async='f alse';
xmlDoc.load(Ser ver.MapPath('/writedata') + '\UploadedFiles \Error_xml.xml' );
var uid = xmlDoc.createEl ement('userid') ;
var tref = xmlDoc.createEl ement('tenderre f');
var e = xmlDoc.createEl ement('error');
var tt=xmlDoc.creat eElement('tflag ');
uid.text ='Dipti123'; tref.text = '1234';
e.text=err; tt.text=ttlflag ;
var newdata= xmlDoc.createEl ement('DataTend er');
newdata.appendC hild(uid);
newdata.appendC hild(tref);
newdata.appendC hild(e);
newdata.appendC hild(tt);
xmlDoc.appendCh ild(newdata);
xmlDoc.save(Ser ver.MapPath('/writedata') + '\UploadedFiles \Error_xml.xml' );
</script>"


this is b/w some vbscript code.

but i m getting error 'server' is undefined
can u help me plz.

Thanks
Jun 12 '07 #3
acoder
16,027 Recognized Expert Moderator MVP
I'm assuming the runat='server' is the problem.
Jun 12 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1960
by: shan | last post by:
#include<fstream> #include<iostream> #include<string> #include<iomanip> #include<stdlib.h> #include<conio.h> #include<stdio.h> using namespace std; class library
3
6902
by: Nathan Bloomfield | last post by:
Hi there, I am having difficulty with a piece of code which would work wonders for my application if only the error trapping worked properly. Basically, it works as follows: - adds records from rsSource into rsDest - if it finds a key violation then it deletes the current record from rsDest and adds the new record from rsSource. This works perfectly - but only for the first found duplicate record, it brings up the error
15
2976
by: sara | last post by:
Hi I'm pretty new to Access here (using Access 2000), and appreciate the help and instruction. I gave myself 2.5 hours to research online and help and try to get this one, and I am not getting it. Simple database: I want to have a user enter Supply Orders (just for tracking purposes) by Item. The user may also enter a new item - "new" is a combination of Item, PartNumber and Vendor - they could have the
2
5788
by: brenda.stow | last post by:
error msg " An error occured while referencing the object. You tried to run a visual basic procedure that improperly references a property or method of an object" This msg occurs everytime I add a new record to a subform. If I close msgbox I can then successfully add new record. Have looked on MS Technet and tried their 2 suggestions:- 1)LinkChildFields property contains the name of a form property - this isn't the case linkChildFields...
3
4334
by: Olav | last post by:
Hi all, I can not install CF 2.0 SP 1 on an Symbol PPT8800 running WinCE 4.2. The Install-Log say's cgacutil.exe failed with exit-code 80000004 and I get a messagebox indicating a support-Info '3'. This would mean I would not have enough space on my device. But I hard-reseted it befor I tryed to install and I have no other processes running while installing. Any ideas, whats going wrong???
7
16364
by: PW | last post by:
Hi, I have a form with unbound fields on it. The user selects a record from a recordset and I populate the unbound fields. When I try to change the unbound quantity text box, Access 2003 tells me "The data has been changed. Another user edited this record and saved the changes before you attempted to save your changes. Re-edit the record." This does not always happen. And yes, I can re-edit the quantity text
185
7137
by: jacob navia | last post by:
Hi We are rewriting the libc for the 64 bit version of lcc-win and we have added a new field in the FILE structure: char *FileName; fopen() will save the file name and an accessor function will return the file name given a FILE *. Questions: What would be the best name for this function?
1
3810
by: morrisqueto | last post by:
Hello, One of my websites just started sending a new rare error. The site has been working for almost 2 years without trouble, but today morning started giving away this error in all my views. Microsoft VBScript runtime error '800a01fb' An exception occurred: 'MoveNext' /test.asp, line 544 Here is the code:
11
2847
by: LayneMitch via WebmasterKB.com | last post by:
Hello. This is a reference file from a book I read in which the core subject is the use of 'event listeners'. I'm trying to load the file in Firefox and it's giving me an error message: Line: 5 Char: 1 Error: 'document' is undefined
0
9672
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10435
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10213
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6779
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.