Jump to content

Asp and XML


andreathedove

Recommended Posts

Hello,I have error with this code:

<p align="center"><%	// CREO IL DOM	set xmlbanner = Server.CreateObject("Microsoft.XMLDOM")	// CARICO IL FILE XML	xmlbanner.async = false	xmlbanner.load(Server.MapPath("../mdb-database/xml/adv.xml"))	// RECUPERO I NODI CHE MI INTERESSANO	banner = xmlbanner.getElementsByTagName("Content[nome='prezzi_pazzi_468*60']/circuito1")	dcircuito1 = xmlbanner.getElementsByTagName("Content[nome='prezzi_pazzi_468*60']/dcircuito1")	ID = xmlbanner.getElementsByTagName("Content[nome='prezzi_pazzi_468*60']/ID")	att1 = xmlbanner.getElementsByTagName("Content[nome='prezzi_pazzi_468*60']/attivo1")	// GENERO UN NUMERO CASUALE IN FUNZIONE DEL NUMERO DI NODI PRESENTE NEL FILE XML	casuale = Math.floor(Math.random() * banner.length)	// STAMPO A VIDEO IL BANNER	BANNER_ = banner(casuale).textdcircuito1_ = dcircuito1(casuale).text%></p>

The erroe is:http://www.allinonenet.it/prezzi_pazzi/adv2.aspThanks,Andrea

Link to comment
Share on other sites

casuale = Math.floor(Math.random() * banner.length)
It's a long time since I did any classic ASP, but... The above line of code allows casuale to be greater than dcircuito1.length. So depending on the data this could result in a null object reference here:
dcircuito1_ = dcircuito1(casuale).text

Also I think for object assignments in vbscript you need to use set? In which case you would need to change this:

banner = xmlbanner.getElementsByTagName....

to:

set banner = xmlbanner.getElementsByTagName....

and the same for the other similar lines.

Link to comment
Share on other sites

It's a long time since I did any classic ASP, but... The above line of code allows casuale to be greater than dcircuito1.length. So depending on the data this could result in a null object reference here:
dcircuito1_ = dcircuito1(casuale).text

Also I think for object assignments in vbscript you need to use set? In which case you would need to change this:

banner = xmlbanner.getElementsByTagName....

to:

set banner = xmlbanner.getElementsByTagName....

and the same for the other similar lines.

thank you very much,andrea
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...