I know this should be very simple but I've been searching for hours and still not found a solution.
I just need to display some simple XML date in an asp page.
Here's some sample XML data:
Please note the sample has no data but my real xml file does.
All I need is a nice loop to pull out all the seperate info from each "Voucher" using the node name as a heading. For example
Voucher1
ProgrammeID = sample
StartDate = 01/01/2011
.... etc
So far all I have managed to do is display all the info with no nodename heading. Here's the code so far:
This outputs all the text from the childnodes of the "Voucher" node but I have been unable to access these childnodes seperately.
Thanks in advance for any help on this.
I just need to display some simple XML date in an asp page.
Here's some sample XML data:
Code:
<ReturnVoucherObj>
<StatusCode>0</StatusCode>
<StatusMsg />
<Vouchers>
<Voucher>
<ProgrammeID></ProgrammeID>
<StartDate></StartDate>
<EndDate></EndDate>
<VoucherDescription></VoucherDescription>
<VoucherCode></VoucherCode>
<MerchantSiteID></MerchantSiteID>
<LandingPage></LandingPage>
<Status></Status>
<MerchantSiteName></MerchantSiteName>
</Voucher>
</Vouchers>
</ReturnVoucherObj>
Please note the sample has no data but my real xml file does.
All I need is a nice loop to pull out all the seperate info from each "Voucher" using the node name as a heading. For example
Voucher1
ProgrammeID = sample
StartDate = 01/01/2011
.... etc
So far all I have managed to do is display all the info with no nodename heading. Here's the code so far:
Code:
set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load(Server.MapPath("voucher.xml"))
Set getVouchers = xmlDoc.getElementsByTagName("Voucher")
For i = 0 To (getVouchers.Length - 1)
response.write getVouchers.item(i).text & "<br /><br />"
Next
This outputs all the text from the childnodes of the "Voucher" node but I have been unable to access these childnodes seperately.
Thanks in advance for any help on this.