Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP & XML runtime error '800a01a8' 1

Status
Not open for further replies.

jammer1221

Programmer
Jul 30, 2003
352
US
Hi All,

I am receiving the error "Microsoft JScript runtime error '800a01a8'" inside of this script.

Error Message:
Code:
Microsoft JScript runtime error '800a01a8' 

Object required 

/aspxml.asp, line 16

Script:
Code:
<%@ Language=JScript%>
<%Server.ScriptTimeout=21478836%>
<%Response.Buffer=false%>

<%
var objXMLDoc = Server.CreateObject("MSXML2.DOMDocument");
objXMLDoc.async = false;
objXMLDoc.load(Server.MapPath("/menu/menu.xml"));
var xmlQuery = "//node[@data='/curriculumdevelopment/elementary/open-wide.html']";


var docHeadlines = objXMLDoc.documentElement.selectSingleNode(xmlQuery);

while (typeof(docHeadlines.parentNode)=="object") {

for (x=0;x<docHeadlines.attributes.length;x++) {//line 16
if (docHeadlines.attributes(x).name=="label") {
if (docHeadlines.attributes(x).value!="") Response.Write(docHeadlines.attributes(x).value+" > ");
docHeadlines=docHeadlines.parentNode;
break;
}
}
}


%>

There is output. The error comes after the expected output. Any advice as to what causes this error and how to fix it would be greatly appreciated!

Let me know if you need any more info.

Thanks,
Matt
 
Maybe [tt]docHeadlines[/tt] is getting set to Nothing/Null/Undefined when the following line executes:
[tt]docHeadlines=docHeadlines.parentNode;[/tt]

So then when it loops back to check if it is done with the iterations... the value of [tt]docHeadlines[/tt] is bogus.
 
Hi Sheco,

I'm a PHP guy and this is my best attempt at ASP. But, I was under the impression that the while loop would not continue if docHeadlines was not an object. So is it possible in ASP for docHeadlines to be eqaul to Nothing/null/undefined and still be an object? Would you advise that I change the while loop? If so, to what?

Also, I changed the while loop a little.

From this:
Code:
while (typeof(docHeadlines.parentNode)=="object") {
To this:
Code:
while (typeof(docHeadlines)=="object") {

Thanks for the help!

Matt
 
Yes the outer while loop is designed to terminate when docHeadlines is no longer an object but the inner for loop is also dependant on docHeadlines being an object. The inner loop runs as long as [tt]x[/tt] is less than [tt]docHeadlines.attributes.length[/tt].



 
[tt]while (typeof(docHeadlines.parentNode)=="object") {

for (x=0;x<docHeadlines.attributes.length;x++) {//line 16
if (docHeadlines.attributes(x).name=="label") {
if (docHeadlines.attributes(x).value!="") Response.Write(docHeadlines.attributes(x).value+" > ");
break;
}
}
docHeadlines=docHeadlines.parentNode;
}
[/tt]
 
Hey guys,

Thank you all for the help. I did finally solve it. I'll post what I did incase someone else stumbles on this thread. I added this code under the while loop.
Code:
if (docHeadlines.attributes==null) break;

Thanks,
Matt
 
While you think you do it correct, you better follow what I propose (or any variation of it). [1] If is how you move the node up the tree. If you think the script arrives at a stage docHeadlines.attributes==null, your docHeadlines is already in the void (not it - as an domdocment or domelement object - has .attributes collection null, mind you!) and it should have already been filtered out in the while-statement. [2] If no node has the name "label", do you not notice that you are in an infinite loop?! At the end, it is up to you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top