I'm loading an xml document and pulling the data out. All is working fine. How do I get it tp itterate through or to the next record. I'm only sseing the same record on everything I've tried. There's 3k records in my file.
I've looked through some samels here but I always wind up staying on the same record.
Can soneone point me in the right direction.
Thanks!
I've looked through some samels here but I always wind up staying on the same record.
Can soneone point me in the right direction.
Thanks!
Code:
Dim XMLDealsDoc As New XmlDocument
Dim xmlDealsrdr As XmlTextReader = New XmlTextReader("c:\deals.xml")
xmlDealsrdr.WhitespaceHandling = WhitespaceHandling.None
XMLDealsDoc.Load(xmlDealsrdr)
Dim NSDealsManager As New XmlNamespaceManager(XMLDealsDoc.NameTable)
NSDealsManager.AddNamespace("df", XMLDealsDoc.DocumentElement.NamespaceURI)
Dim couponidSTR As String = Nothing
Dim merchantidSTR As String = Nothing
Dim merchantnameSTR As String = Nothing
Dim networkSTR As String = Nothing
Dim labelSTR As String = Nothing
Dim restrictionsSTR As String = Nothing
Dim couponcodeSTR As String = Nothing
Dim linkSTR As String = Nothing
Dim directlinkSTR As String = Nothing
Dim startdateSTR As String = Nothing
Dim enddateSTR As String = Nothing
Dim imageSTR As String = Nothing
Dim typeSTR As String = Nothing
Dim categorySTR As String = Nothing
Dim statusSTR As String = Nothing
Dim lastupdatedSTR As String = Nothing
Dim changeauditSTR As String = Nothing
Dim couponid As XmlElement = DirectCast(XMLDealsDoc.SelectSingleNode("df:deals/df:item/df:couponid", NSDealsManager), XmlElement)
Dim merchantid As XmlElement = DirectCast(XMLDealsDoc.SelectSingleNode("df:deals/df:item/df:merchantid", NSDealsManager), XmlElement)
Dim merchantname As XmlElement = DirectCast(XMLDealsDoc.SelectSingleNode("df:deals/df:item/df:merchantname", NSDealsManager), XmlElement)
Dim network As XmlElement = DirectCast(XMLDealsDoc.SelectSingleNode("df:deals/df:item/df:label", NSDealsManager), XmlElement)
Dim label As XmlElement = DirectCast(XMLDealsDoc.SelectSingleNode("df:deals/df:item/df:merchantname", NSDealsManager), XmlElement)
Dim restrictions As XmlElement = DirectCast(XMLDealsDoc.SelectSingleNode("df:deals/df:item/df:restrictions", NSDealsManager), XmlElement)
Dim couponcode As XmlElement = DirectCast(XMLDealsDoc.SelectSingleNode("df:deals/df:item/df:couponcode", NSDealsManager), XmlElement)
Dim link As XmlElement = DirectCast(XMLDealsDoc.SelectSingleNode("df:deals/df:item/df:link", NSDealsManager), XmlElement)
Dim directlink As XmlElement = DirectCast(XMLDealsDoc.SelectSingleNode("df:deals/df:item/df:directlink", NSDealsManager), XmlElement)
Dim startdate As XmlElement = DirectCast(XMLDealsDoc.SelectSingleNode("df:deals/df:item/df:startdate", NSDealsManager), XmlElement)
Dim enddate As XmlElement = DirectCast(XMLDealsDoc.SelectSingleNode("df:deals/df:item/df:enddate", NSDealsManager), XmlElement)
Dim image As XmlElement = DirectCast(XMLDealsDoc.SelectSingleNode("df:deals/df:item/df:image", NSDealsManager), XmlElement)
Dim type As XmlElement = DirectCast(XMLDealsDoc.SelectSingleNode("df:deals/df:item/df:dealtypes/df:type", NSDealsManager), XmlElement)
Dim category As XmlElement = DirectCast(XMLDealsDoc.SelectSingleNode("df:deals/df:item/df:categories/df:category", NSDealsManager), XmlElement)
Dim status As XmlElement = DirectCast(XMLDealsDoc.SelectSingleNode("df:deals/df:item/df:status", NSDealsManager), XmlElement)
Dim lastupdated As XmlElement = DirectCast(XMLDealsDoc.SelectSingleNode("df:deals/df:item/df:lastupdated", NSDealsManager), XmlElement)
Dim changeaudit As XmlElement = DirectCast(XMLDealsDoc.SelectSingleNode("df:deals/df:item/df:changeaudit", NSDealsManager), XmlElement)
couponidSTR = couponid.InnerText.ToString()
merchantidSTR = merchantid.InnerText.ToString()
merchantnameSTR = merchantname.InnerText.ToString()
networkSTR = network.InnerText.ToString()
labelSTR = label.InnerText.ToString()
restrictionsSTR = restrictions.InnerText.ToString()
couponcodeSTR = couponcode.InnerText.ToString()
linkSTR = link.InnerText.ToString()
directlinkSTR = directlink.InnerText.ToString()
startdateSTR = startdate.InnerText.ToString()
enddateSTR = enddate.InnerText.ToString()
imageSTR = image.InnerText.ToString()
typeSTR = type.InnerText.ToString()
categorySTR = category.InnerText.ToString()
statusSTR = status.InnerText.ToString()
lastupdatedSTR = lastupdated.InnerText.ToString()
changeauditSTR = changeaudit.InnerText.ToString()
Response.Write(couponidSTR & "<br />")
Response.Write(merchantidSTR & "<br />")
Response.Write(merchantnameSTR & "<br />")
Response.Write(networkSTR & "<br />")
Response.Write(labelSTR & "<br />")