473,666 Members | 2,461 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

xmlHttp.respons eXML.documentEl ement is returning null So unable to parse xml

15 New Member
Hi there,

I want to fetch data from database ,convert it in xml then send this xml from server.In Javascript file i am trying to parse it and bind these data to some control like textbox in client page.But the xmlHttp.respons eXML.documentEl ement returned from server is showing null:
I m using .Net,C#,(Ajax)
*************** *************** *************** ***********
code snippet: serverPage.aspx .cs
*************** *************** *************** ***********
SqlConnection connection=new SqlConnection(C onfigurationMan ager.AppSetting s["connect"]);
connection.Open ();
SqlDataReader dr;
SqlCommand cmd = new SqlCommand("sel ect employeeId,empl oyeeName,employ eeDesignation,s alary,phoneNo" + " from employeeTable where employeeId=" + employeeID, connection);
dr = cmd.ExecuteRead er();
if (dr.HasRows)
{
dr.Read();
System.Text.Str ingBuilder sb = new System.Text.Str ingBuilder();
sb.Append("<?xm l version='1.0' encoding='UTF-8'?>");
sb.Append("<Emp loyee>");
sb.Append("<Emp loyeeId><![CDATA["+dr["employeeId "].ToString()+"]]></EmployeeId>");
............... ............... ............... ............... .......
sb.Append("("</Employee>");
Response.Conten tType = "text/xml";
Response.Write( sb.ToString());
}
}
*************** *************** *************** *************** *******
in SelectEmployee. js
*************** *************** *************** *************** ******
............... .............
if(xmlHttp.stat us==200)
{

SetEmployeeLabe ls(xmlHttp.resp onseXML.documen tElement);
}
function SetEmployeeLabe ls(ClientNode)
{
............... ............... ....
*************** *************** *********
this part is not working
*************** *************** *********
if(ClientNode!= null)
{
var EmployeeId=Clie ntNode.getEleme ntsByTagName('E mployeeId');
var EmployeeName=Cl ientNode.getEle mentsByTagName( 'EmployeeName') ;
............... ............... ............... ...............
eidTb.value=Get InnerText(Emplo yeeId[0]);
enameTb.value=G etInnerText(Emp loyeeName[0]);
............... ............... ............... ...........

}
}
function GetInnerText(no de)
{
return(node.tex tContent||node. innerText||node .text);
}
Feb 9 '07 #1
2 10633
kenobewan
4,871 Recognized Expert Specialist
Did you receive and error? Have you tried if(!ClientNode) ?
Feb 11 '07 #2
ashish ranjan
15 New Member
Did you receive and error? Have you tried if(!ClientNode) ?
Hi there,

Thanks for looking in my problem.My problem is rectified,the problem was server side page (default.aspx)d efault Html content was appended to the responsexml content.
that's why it was showing Null value. in javaScript file.I removed html part in design part of server page(default.as px) and now it is working fine.

One's Again Thanks a lot.
Ashish
Feb 13 '07 #3

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

Similar topics

6
3079
by: Nemlah | last post by:
Hello, I am working on a site which utilizes PHP/JS and the new found XMLHTTP frenzy to update dynamically. WHile the whole mechanism works beautifull, i can't get to display greek Characters correct (They show up as ?). I tried following solutions to set the XML:lang or simple lang parameter in the div to el, but that didn't help.. Greek text in the surrounding page is showing up correct.. Here is the code i am using: The JS File
2
2520
by: mikeyjudkins | last post by:
Ive been banging my head on the wall for hours with this one, hopefully someone will know what Im doing wrong here :\ The Goal: I have an xml file that is generated on the fly via JSP which I want to load into a Microsoft.XMLHTTP ActiveX object and manipulate via javascript on the client side. Data is retreived from the server at the request of the javascript without having to reload the page. The Problem:
5
4339
by: dandiebolt | last post by:
Using xmlhttp I am accessing a document from the web that is not xml and is in fact not even proper html even though it is supposed to be (unbalanced tags). Here is the type of code I am using: url="http://www.domain.com/page.html"; var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); xmlhttp.open("GET", url, false); xmlhttp.send(); var xmlResp = xmlhttp.responseXML;
4
13350
by: Sanjay Dahiya | last post by:
I tried POSTing from XMLHttpRequest, i can get the XML right on server but responseXML from server is coming null. I can see the XML right in responseText. but responseXML is null. responseText to DOM conversion also fails while the XML in responseText seems valid .. -- here is the javascript code for sending --- { this.request.onreadystatechange = this.handleStateChange; if( this.request) {
1
1324
by: Dave H | last post by:
First.. What object (on the client) should I be using these days? var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); or var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); or maybe something different?
3
9555
by: Noozer | last post by:
Hrm.. last posting was mangled. Let's try again, with more detail... I'm just starting to try out "Ajax" web programming and I've got a question. AJAX is fairly straightforward. Javascript creates an XMLHttp object and then uses that to generate a hidden webpage with your results. What I'd like to know is, how can I retrieve multiple values from an XMLHttp request?For example, if my request generated an SQL query that returned a...
4
8272
by: sirjohnofthewest | last post by:
If I possessed the power to sway the mind of every user in the world to delete all forms of Internet Explorer I would die a happy man. Hi guys, I frequently visit this site to get answers to my problems and this one is really getting to me... I have a page that allows you to Browse Authors. There are three drop down boxes that auto-populate via AJAX. I have a file which it calls and returns the dynamically built XML file in the boxes...
1
3083
by: Sand Yaah | last post by:
i went thru a discussion put by eros and helped out by dmjpros. d questions asked were right and i tried each but there was no problem there. my code returns null in xmlHttp.responseXML and xmlHttp.responseText returns nothing. My Code: function commoPrice() { var cid = document.kerala.commodities.value; if(cid ==0)
0
8878
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...
1
8560
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7389
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6200
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
5671
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
4200
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2776
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
2
2012
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.