views:

36

answers:

1

Hello i have this XML

<?xml version = '1.0' encoding = 'windows-1251'?>
<ICBSProxy>
<Message type="">
  <Version>01.00</Version>
  <Parameter name="xICBSXPProxy.ProcessingDetail" id="1">
     <Value>1250484</Value>
  </Parameter>
  <Parameter name="xICBSXPProxy.ProcessingError" id="2">
     <Value>0</Value>

  </Parameter>
  <Parameter name="Row1" id="3">
     <Value>19/09/2010 12:19:40|iliani|08000367|63|        0.50|42560175||744213|00|Y</Value>
  </Parameter>
  <Parameter name="xICBSXPProxy.AppType" id="4">
     <Value>xEXTServicePrep</Value>
  </Parameter>
  <Parameter name="xICBSXPProxy.ProcessingLevel" id="5">

     <Value>1</Value>
  </Parameter>
  <Parameter name="TotalRowCount" id="6">
     <Value>1</Value>
  </Parameter>
  <Parameter name="xICBSXPProxy.ProcessingAccept" id="7">
     <Value>Y</Value>

  </Parameter>
  <Parameter name="RowCount" id="8">
     <Value>1</Value>
  </Parameter>
</Message>
</ICBSProxy>

this is the response of payment gateway for a transaction . I need to read via ASP from this remote xml the parameter row1 more exactly the columns that say 744213 wich is transid and the Y that means transaction accepted if there is N then is denied in order to add in my db the status of trans and transid . Any sample code that could help me ? i searched a full day without success , thank you guys

+1  A: 

This is how to load the xml

Set XMLDom = CreateObject("MSXML2.DOMDocument.4.0")
XMLDom.setProperty "SelectionLanguage", "XPath"


objxml.Load "<URL OF XML HERE>"

This is to get the Row1 text

xmltext = XMLDom.documentElement.selectSingleNode("//Parameter[@name='Row1']/value").text

Here is how to split the text (if it follows the same principle as the example)

Set r = New RegExp
r.ignorecase = true
r.global = true
r.pattern = "\|\|(.*?)\|.*?\|(.*?)$"

set matches = r.execute( xmltext )(0).submatches

transid = matches.item(0)
yesno = matches.item(1)
Gaby