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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP loadXML not loading

Status
Not open for further replies.

Smith3

Programmer
Nov 24, 2003
8
US
I have an asp page making multiple sql calls to the server and the second loadXML is coming up false. Here is how I am loading the xml document.

success = objXmlData.loadXML(objXmlHttp.responseXML.xml)

I checked the objXmlHttp.responseText and it has the data I was trying to get but it won't load into the xml document. Can someone help me?

Smith3
 
Is the page your getting that data to have the correct MIME header? (text/xml) If not then it won't oparse correctly in the Response object and give you xml.
Also the return type of the objXmlHttp.ResponseXml property is XML Document object, so you don't need to use the LoadXML property to, you could merely set your variable = to the .ResponseXml.

If you want to use LoadXML use the .ResponseText property which will return the response in string format, rather than as an XMLDOM object.

-T

01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
The never-completed website:
 
I didn't see the MIME header in my asp. I am new to asp and I received this asp from another person. Where would I find the MIME header? The first sql statement works fine, it's the second sql statement that does not load. I am using loadXML so I can access each child object.

Like so...

var acctno = rootNode.childNodes.item(0).childNodes.item(1).text

Do I need to clear or reset any variables?

Here is my code...

var objXmlHttp = Server.CreateObject("MSXML2.XMLHTTP")
var objXmlData = Server.CreateObject("MSXML2.DOMDocument")

var sql= "SELECT Bank_No, Account_No, SubTotal_Level FROM global.GNLDetailView WHERE Load_Date='" + sdate + "' AND Dept_No='9999' And SubTotal_Acct = 0 AND Account_Type='A'"

sql = Server.URLEncode (sql);

var graphName= Server.URLEncode ("GNL statement of condition test.dqv")

url = " + sql + "&sessionId=" + Request.Cookies("SessionId8050") + "&graphName=" + graphName

objXmlHttp.open ("GET", url,false)

objXmlHttp.send();

if (objXmlHttp.status != 200){
Response.write (objXmlHttp.responseText)
Response.end
}
Response.write(objXmlHttp.responseXML.xml)
success = objXmlData.loadXML(objXmlHttp.responseXML.xml)
if (success){
}
else {Response.Write("Unable to load the XML Content ")
}

rootNode = objXmlData.documentElement
var acctno = rootNode.childNodes.item(0).childNodes.item(1).text
var levelcode = rootNode.childNodes.item(0).childNodes.item(2).text

var sql= "SELECT Bank_No, Account_Desc, Current_Balance FROM global.GNLDetailView WHERE Load_Date='" + sdate + "' AND SubTotal_Acct='" + acctno + "' And Level_Code='" + levelcode + "'"
//Response.Write(sql)

sql = Server.URLEncode (sql);

var graphName= Server.URLEncode ("GNL statement of condition test.dqv")

url = " + sql + "&sessionId=" + Request.Cookies("SessionId8050") + "&graphName=" + graphName

//Response.write(url);
objXmlHttp.open ("GET", url,false)

objXmlHttp.send();

if (objXmlHttp.status != 200){
Response.write (objXmlHttp.responseText)
Response.end
}
success = objXmlData.loadXML(objXmlHttp.responseXML.xml)
if (success){
}
else {Response.Write("Unable to load the XML Content 2 ")
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top