ablount

ablount

  • NA
  • 3
  • 0

loop thru xml child nodes

Mar 16 2005 11:30 AM
(Type your message here) Pretty sophisticated forum for an xml/vb .net newby ... need to one loop thru each successive node to grap info from child nodes to populate variables. Here's a couple of xml files I have tried on this project (and I can change it if I formed it incorrectly). - - c:\TestSource - c:\TestSourceAgain and also tried xml this way: c:\testSource c:\testTarget c:\testSourceAgain c:\testTargetAgain and here's the code that almost does it -- I've done variations on it trying to get the info (source and target) in one turn around the block 'cause this stuff cycles thru the source over and over again when what I need is for it to find the source and target info together in one turn (then I'll make it perfom an action); then another target and source (and I'll run it thru its paces again). '===================WORKS!!!! A LITTLE!!!! ====================== 'For Each node In doc.DocumentElement ' '''put sourcepath node into variable to use as relative path ' Dim SourcePath As String ' Dim TargetPath As String ' Dim sourcepaths As XmlNodeList ' sourcepaths = doc.GetElementsByTagName("Source") ' Dim sourcenode As XmlNode ' For Each sourcenode In sourcepaths ' SourcePath = sourcenode.ChildNodes(0).Value ' lblStatus.Text = SourcePath.ToString ' Next ' Dim targetpaths As XmlNodeList ' targetpaths = doc.GetElementsByTagName("Target") ' Dim targetnode As XmlNode ' For Each targetnode In targetpaths ' TargetPath = targetnode.ChildNodes(0).Value ' lblStatus.Text = TargetPath.ToString ' Next 'Next ====================== thanks, for any and all help on this!

Answers (3)