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!

Receiving an XML file to an ASP form processing script

Status
Not open for further replies.

wbodger

Programmer
Apr 23, 2007
769
US
OK, I believe that I am going to be having an outside vendor post data to me in a format like this:

Code:
<html>
<form action="[URL unfurl="true"]http://www.laplink.com/mysupport/register/cbtest.asp"[/URL] method="POST">
<table>
<tr><td>XML</td><td><TEXTAREA NAME="XML" COLS="80" ROWS="10">
<?xml version="1.0" encoding="UTF-8"?><cbn:PaidOrderNotification xmlns:cbn="[URL unfurl="true"]http://xml.cleverbridge.com/1.021/cleverbridgeNotification.xsd"><cbn:Purchase[/URL] cbt:Id="85582" xmlns:cbt="[URL unfurl="true"]http://xml.cleverbridge.com/1.021/cleverbridgeTypes.xsd"><cbt:Status>Test[/URL] Order</cbt:Status>...</cbn:PaidOrderNotification>
</TEXTAREA></td></tr>
<tr><td>PURCHASE_ID</td><td><input name="PURCHASE_ID" value="85582"></td></tr>
<tr><td>RUNNING_NO</td><td><input name="RUNNING_NO" value="1"></td></tr>
<tr><td>PRODUCT_ID</td><td><input name="PRODUCT_ID" value="1454"></td></tr>
<tr><td>QUANTITY</td><td><input name="QUANTITY" value="1"></td></tr>
<tr><td>EMAIL</td><td><input name="EMAIL" value="martin@cleverbridge.com"></td></tr>
<tr><td>COMPANY</td><td><input name="COMPANY" value="cleverbridge AG"></td></tr>
<tr><td>FIRSTNAME</td><td><input name="FIRSTNAME" value="Martin"></td></tr>
<tr><td>LASTNAME</td><td><input name="LASTNAME" value="Trzaskalik"></td></tr>
</table>
<tr></td><td><input type="submit">
</form>
</html>

Now, I want ot grab the standard form values (no problem), but I also need to parse out some values from that XML data posted in the textarea. What I have been trying is many different iterations of this

Code:
<%@ Language=VBScript %>
<%
Dim myDoc  
  
set myDoc = Server.CreateObject("Microsoft.XMLDOM")  
  
myDoc.async=false  
  
myDoc.loadXML request

Set Root = MyDoc.documentElement

MessageBox.show( Root.selectSingleNode("cbt:Street1").childNodes(0).nodeValue)
MessageBox.show(Root.getElementsByTagName("cbt:City").items(0).nodeValue)
MessageBox.show(Root.getElementsByTagName("cbt:PostalCode").items(0).nodeValue) 
%>

which gives me

Code:
Microsoft VBScript runtime (0x800A01A8)
Object required: 'Root.selectSingleNode(...)'
/mysupport/register/cbtest.asp, line 13

So, it looks like I'm not even getting the XML loaded. Anybody out there know how I actually get that XML loaded so I can parse it?

Thanks,
Willie
 
Got it. I was treating streamed text as a file. Switched to loadXML (instead of load) and everything works great.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top