473,545 Members | 1,994 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"No Properties" error... can't navigate dom elements. Please help...

hi.

for some reason i am not able to navigate the dom.
i keep getting the 'no properties' error but i think i
am doing everything right. this is an XML response
from an AJAX call.

The ajax method to call the server code looks like this.
i am passing a cookie as a parameter:

Code:

var stockquote = get_cookie("sto ckquote");
ajaxSend('GET', 'data.aspx',sto ckquote, dataResponseHan dler, false);

the code coming from the server looks like this:

Code:

Public Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

Dim con As System.Data.Sql Client.SqlConne ction = New
System.Data.Sql Client.SqlConne ction(connectio n stuff...)
Dim editcriteriacmd As System.Data.Sql Client.SqlComma nd = New
Data.SqlClient. SqlCommand(sele ct statement stuff..., con)

con.Open()

'EDITPROFILE STUFF

Dim edit_dr As Data.SqlClient. SqlDataReader =
editcriteriacmd .ExecuteReader( Data.CommandBeh avior.CloseConn ection)

'main declarations
dim sex as string
dim age_frm as string
dim age_to as string
dim type as string
[SNIP]

If edit_dr.HasRows Then
While edit_dr.Read
sex = edit_dr.Item("s ex").ToString ()
age_frm = edit_dr.Item("a ge1").ToString( )
age_to = edit_dr.Item("a ge2").ToString( )
type = edit_dr.Item("t ype").ToString( )
[SNIP]
End While
End If

edit_dr.Close()

Dim sbhtml As New System.Text.Str ingBuilder

sbhtml.Append(" <?xml version='1.0' encoding='ISO-8859-1'?>")
sbhtml.Append(" <search>")
sbhtml.Append(" <sex>")
sbhtml.Append(s ex.ToString)
sbhtml.Append(" </sex>")
sbhtml.Append(" <agefrom>")
sbhtml.Append(a ge_frm.ToString )
sbhtml.Append(" </agefrom>")
sbhtml.Append(" <ageto>")
sbhtml.Append(a ge_to.ToString)
sbhtml.Append(" </ageto>")
sbhtml.Append(" <type>")
sbhtml.Append(t ype.ToString)
sbhtml.Append(" </type>")
[SNIP]
sbhtml.Append(" </search>")

Context.Respons e.ContentType = "text/xml"
Response.Write( sbhtml.ToString )

End Sub

the response is parsed in the dataResponseHan dler function.

Code:

function dataResponseHan dler(ajaxReques t)

{ //1

// if xmlhttp shows "loaded"
if (ajaxRequest.re adyState==4)

{ //2

// if "OK"
if
(ajaxRequest.st atus==200)

{ //3

try { //4

//UNCOMMENT FOR
ERROR CHECKING - RESPONSETEXT IN NEW WINDOW
//var doc =
ajaxRequest.res ponseText;
//
doc=doc.replace (/</g, '<').replace(/\>/g, '>');

//childWin=window .open("", "childwin") ;

//childWin.docume nt.write("<pre> "+doc+"</pre>");

//childWin.docume nt.close();

var dom =
parse(ajaxReque st.responseText );

var search =
dom.getElements ByTagName('sear ch').item(0);

if (search) {
alert("search has something") } else { alert("search is empty"); }

var sex;
var age_frm;
var age_to;
var type;
[SNIP]

if
(search.getElem entsByTagName(" sex")[0].nodeValue != "") {
sex =
search.getEleme ntsByTagName("s ex")[0].nodeValue;
alert("sex:
"+sex);
}

if
(search.getElem entsByTagName(" age_frm")[0].firstChild.nod eValue != "")
{
age_frm =
search.getEleme ntsByTagName("a ge_frm")[0].firstChild.nod eValue;

alert("agef: "+age_frm);
}

if
(search.getElem entsByTagName(" age_to")[0].firstChild.nod eValue != "") {
age_to =
search.getEleme ntsByTagName("a ge_to")[0].firstChild.nod eValue;

alert("aget: "+age_to);
}

if
(search.getElem entsByTagName(" type")[0].firstChild.nod eValue != "") {
type =
search.getEleme ntsByTagName("t ype")[0].firstChild.nod eValue;

alert("type: "+type);
}

} //4

catch (e) { //5

alert("There has
been an error. The problem is that " + e.message + ". This is a '" +
e.name + "' problem.");

} //5

} //3

else

{ //6
alert("Problem retrieving
XML data")
} //6

} //2

} //1


i am parsing the code using the below parse function:

Code:

function parse(xml) {

var dom;

try {
dom = new
ActiveXObject(" Microsoft.XMLDO M");
dom.async = false;
dom.loadXML(xml );
} catch (error) {
try {
var parser = new
DOMParser();
dom =
parser.parseFro mString(xml, "text/xml");
delete parser;
} catch (error2) {
if (debug)
alert("XML parsing is
not supported.");
}
}

return dom;

}

no matter what i do i keep getting that search has no properties. but
the below line is correct, isn't it?
var search = dom.getElements ByTagName('sear ch').item(0);

so, if that is correct, then the problem is the content of the
response. but, when i uncomment my errorhandling code:

//UNCOMMENT FOR ERROR CHECKING - RESPONSETEXT IN NEW WINDOW
//var doc = ajaxRequest.res ponseText;
// doc=doc.replace (/</g, '<').replace(/\>/g, '>');
//childWin=window .open("", "childwin") ;
//childWin.docume nt.write("<pre> "+doc+"</pre>");
//childWin.docume nt.close();

i get the below line:

<?xml version='1.0'
encoding='ISO-8859-1'?><search><se x>male</sex><agefrom>18 </agefrom><ageto> 100</ageto><type>som etype</type></search>
so, that is everything. i am probably overlooking something obvious
but, at this point, i need another set of eyes to point
it out.

thanks.

Oct 24 '06 #1
1 2762
ok.

i have sorted this out.
i had a spelling error in the XML doc.

pbd22 wrote:
hi.

for some reason i am not able to navigate the dom.
i keep getting the 'no properties' error but i think i
am doing everything right. this is an XML response
from an AJAX call.

The ajax method to call the server code looks like this.
i am passing a cookie as a parameter:

Code:

var stockquote = get_cookie("sto ckquote");
ajaxSend('GET', 'data.aspx',sto ckquote, dataResponseHan dler, false);

the code coming from the server looks like this:

Code:

Public Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

Dim con As System.Data.Sql Client.SqlConne ction = New
System.Data.Sql Client.SqlConne ction(connectio n stuff...)
Dim editcriteriacmd As System.Data.Sql Client.SqlComma nd = New
Data.SqlClient. SqlCommand(sele ct statement stuff..., con)

con.Open()

'EDITPROFILE STUFF

Dim edit_dr As Data.SqlClient. SqlDataReader =
editcriteriacmd .ExecuteReader( Data.CommandBeh avior.CloseConn ection)

'main declarations
dim sex as string
dim age_frm as string
dim age_to as string
dim type as string
[SNIP]

If edit_dr.HasRows Then
While edit_dr.Read
sex = edit_dr.Item("s ex").ToString ()
age_frm = edit_dr.Item("a ge1").ToString( )
age_to = edit_dr.Item("a ge2").ToString( )
type = edit_dr.Item("t ype").ToString( )
[SNIP]
End While
End If

edit_dr.Close()

Dim sbhtml As New System.Text.Str ingBuilder

sbhtml.Append(" <?xml version='1.0' encoding='ISO-8859-1'?>")
sbhtml.Append(" <search>")
sbhtml.Append(" <sex>")
sbhtml.Append(s ex.ToString)
sbhtml.Append(" </sex>")
sbhtml.Append(" <agefrom>")
sbhtml.Append(a ge_frm.ToString )
sbhtml.Append(" </agefrom>")
sbhtml.Append(" <ageto>")
sbhtml.Append(a ge_to.ToString)
sbhtml.Append(" </ageto>")
sbhtml.Append(" <type>")
sbhtml.Append(t ype.ToString)
sbhtml.Append(" </type>")
[SNIP]
sbhtml.Append(" </search>")

Context.Respons e.ContentType = "text/xml"
Response.Write( sbhtml.ToString )

End Sub

the response is parsed in the dataResponseHan dler function.

Code:

function dataResponseHan dler(ajaxReques t)

{ //1

// if xmlhttp shows "loaded"
if (ajaxRequest.re adyState==4)

{ //2

// if "OK"
if
(ajaxRequest.st atus==200)

{ //3

try { //4

//UNCOMMENT FOR
ERROR CHECKING - RESPONSETEXT IN NEW WINDOW
//var doc =
ajaxRequest.res ponseText;
//
doc=doc.replace (/</g, '<').replace(/\>/g, '>');

//childWin=window .open("", "childwin") ;

//childWin.docume nt.write("<pre> "+doc+"</pre>");

//childWin.docume nt.close();

var dom =
parse(ajaxReque st.responseText );

var search =
dom.getElements ByTagName('sear ch').item(0);

if (search) {
alert("search has something") } else { alert("search is empty"); }

var sex;
var age_frm;
var age_to;
var type;
[SNIP]

if
(search.getElem entsByTagName(" sex")[0].nodeValue != "") {
sex =
search.getEleme ntsByTagName("s ex")[0].nodeValue;
alert("sex:
"+sex);
}

if
(search.getElem entsByTagName(" age_frm")[0].firstChild.nod eValue != "")
{
age_frm =
search.getEleme ntsByTagName("a ge_frm")[0].firstChild.nod eValue;

alert("agef: "+age_frm);
}

if
(search.getElem entsByTagName(" age_to")[0].firstChild.nod eValue != "") {
age_to =
search.getEleme ntsByTagName("a ge_to")[0].firstChild.nod eValue;

alert("aget: "+age_to);
}

if
(search.getElem entsByTagName(" type")[0].firstChild.nod eValue != "") {
type =
search.getEleme ntsByTagName("t ype")[0].firstChild.nod eValue;

alert("type: "+type);
}

} //4

catch (e) { //5

alert("There has
been an error. The problem is that " + e.message + ". This is a '" +
e.name + "' problem.");

} //5

} //3

else

{ //6
alert("Problem retrieving
XML data")
} //6

} //2

} //1


i am parsing the code using the below parse function:

Code:

function parse(xml) {

var dom;

try {
dom = new
ActiveXObject(" Microsoft.XMLDO M");
dom.async = false;
dom.loadXML(xml );
} catch (error) {
try {
var parser = new
DOMParser();
dom =
parser.parseFro mString(xml, "text/xml");
delete parser;
} catch (error2) {
if (debug)
alert("XML parsing is
not supported.");
}
}

return dom;

}

no matter what i do i keep getting that search has no properties. but
the below line is correct, isn't it?
var search = dom.getElements ByTagName('sear ch').item(0);

so, if that is correct, then the problem is the content of the
response. but, when i uncomment my errorhandling code:

//UNCOMMENT FOR ERROR CHECKING - RESPONSETEXT IN NEW WINDOW
//var doc = ajaxRequest.res ponseText;
// doc=doc.replace (/</g, '<').replace(/\>/g, '>');
//childWin=window .open("", "childwin") ;
//childWin.docume nt.write("<pre> "+doc+"</pre>");
//childWin.docume nt.close();

i get the below line:

<?xml version='1.0'
encoding='ISO-8859-1'?><search><se x>male</sex><agefrom>18 </agefrom><ageto> 100</ageto><type>som etype</type></search>
so, that is everything. i am probably overlooking something obvious
but, at this point, i need another set of eyes to point
it out.

thanks.
Oct 24 '06 #2

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

Similar topics

0
1528
by: Michael Bourgon | last post by:
Here's something I found a few months ago, and it seems to come in handy pretty often, so I figured I'd share. Disclaimer: you are modifying a SYSTEM TABLE. This may not work in the next version of SQL Server. When you right click on a Database in the Enterprise Manager and choose Properties, in order to show the last backup time, it has...
3
2079
by: kj | last post by:
This problem is driving me nuts. The code at the end of this post below works fine with IE, but fails with Mozilla. You can see it in action at http://tinyurl.com/2jvo3 With Mozilla 1.4 and 1.6, the function msg works fine if it's installed as an onclick handler for the button, but fails as an onload handler for the page. The error is...
134
7780
by: James A. Donald | last post by:
I am contemplating getting into Python, which is used by engineers I admire - google and Bram Cohen, but was horrified to read "no variable or argument declarations are necessary." Surely that means that if I misspell a variable name, my program will mysteriously fail to work with no error message. If you don't declare variables, you...
2
1752
by: holysmokes99 | last post by:
I am developing a component in .Net 1.1, and want to debug it using the "start external program" of the debugger in the IDE. The program I want to start references both 1.1 and 2.0 components. The problem is that when I launch this from VS2003, the external program starts only for a moment and then bails out of memory with no error, and the...
21
7805
by: comp.lang.tcl | last post by:
set php {<? print_r("Hello World"); ?>} puts $php; # PRINTS OUT <? print_r("Hello World"); ?> puts When I try this within TCL I get the following error:
2
2476
by: jj555s | last post by:
I get a Message that says "No error occured." when I tried to write in a file. What does it mean?
1
2649
by: luispunchy | last post by:
I have an accordion style dropdown list/sublist menu (functions similar to the "today on WebMD video" widget found on http://www.webmd.com/) - it will allow users to click on a headline (from the main list) to open up the full listing (sublist) below that headline. My JavaScript is almost but not quite working as needed. It also serves up an...
2
1835
bugboy
by: bugboy | last post by:
Hi i'm a beginner at php and my simple web query page doesn't work.. i swear i had it working at one point but now i've come back to it it doesn't. • My form works • My DB connection works • My query works in my client... so it should work here. It has the right DB and all the right table names... i've only changed the word = 'myword' to...
6
5678
by: Uh Clem | last post by:
Is there a way to update form/control properties via VBA and have them still be there after the form is re-opened? When a textbox value is updated by the user, I need that value to be there next time the form is loaded. Sure I could store the value in the database, but this happens to be an unbound form, so I'm hoping for something simple. ...
0
7409
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...
0
7664
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. ...
0
5982
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...
1
5343
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...
0
4958
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...
0
3465
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...
0
3446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1023
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
720
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.