Active Server Pages Programming (ASP)/XML ASP Parser

Advertisement


Question
Hi Srini

Thanks so much for the assistance, i have tried but it does not work for me. Perhaps, i have not described the scenario in details. Here it is :

I have a list of POST parameters to be posted to a processor.
eg,
<input type="Hidden" name="amount"          Value=123>
<input type="Hidden" name="currency"        value=840>
<input type="Hidden" name="tr_callback_url" value="http://www.abc.com/result.asp">   

After posting those parameters to the processor, it is returned to a page on their own server (http://www.123.com/result.cfm) and stop running. Therefore, i could not retrieve the resulted data since it is not returned to http://www.abc.com/result.asp as i thought it would. Instead, on http://www.123.com/result.asp it displayed the following :

ANS : 112good
VIEW SOURCE :
<ProcessingResult><amount>112</amount><result>good</result></ProcessingResult>

Kindly advise me of the ways to retrieve the data in real time, so that i may update the resulted amount and result into our database. Thank you

Hope this helps

God bless
Gary Wong :-)




-------------------------
Followup To
Question -
Hi Expert

How are you doing?

I am new to XML parser and never would i ever thought of encountering it. Here is the scenario :

I post a list of paramter from ASP to another script processor. After processing my data, it returns the result to a page and stop running. On that particular page, the resulted data is displayed in XML format. Ie, by viewing the script, it obviously shows the resulted data in a tag format. eg, <title>something</title> etc..

Please advise me of the ways to retrieve those data in real time and update them to my database. Thank you so much for your kind assistance. it is truly a headache for me as i could hardly what a few XML parser tutorials are talking about.

Thank you

God bless
Gary Wong
Answer -
hi

Here is the sample to read the xml dynamically in ASP

<%
Option Explicit
Response.Buffer = True

Dim xml
  Set xml = Server.CreateObject("Microsoft.XMLDOM")
  xml.async = False
  xml.load (Server.MapPath("page.xml"))

Dim title, heading, paragraph, testHTML
  title = xml.documentElement.childNodes(0).text
  heading = xml.documentElement.childNodes(1).text
  paragraph = xml.documentElement.childNodes(2).text
  testHTML = xml.documentElement.childNodes(3).text

  Set xml = Nothing
%>
<html>
<head>
  <title><%= title %></title>
</head>
<body>
<h3 align="center"><%= heading %></h3>
<p align="center"><% = paragraph %></p>
<div align="center"><%= testHTML %></div>
</body>
</html>


Happy Programming!!

-srini

Answer
Hi

Give a try with XML HTTPrequest.  Here is the sample code

var objHTTP = new ActiveXObject("Microsoft.XMLHTTP")
objHTTP.Open('GET','result.asp',false)
objHTTP.Send()

Amount = objHTTP.Amount
Result = objHTTP.Result


Happy Programming!

-Srini

Active Server Pages Programming (ASP)

All Answers


Answers by Expert:


Ask Experts

Volunteer


Srini Nagarajan

Expertise

I can answer any kind of questions in ASP.NET, C#, VB.NET, SharePoint 2007, ASP, Coldfusion, Powerbuilder 7.00 / 8.00, JAVA servlets, MS SQL 2000 / MSSQL7, Sybase

Experience

Contact me if you need any custom development on ASP.NET, ASP, SharePoint 2007, Coldfusion, Powerbuilder.

©2012 About.com, a part of The New York Times Company. All rights reserved.