TheWizardofInt Posted March 14, 2005 Posted March 14, 2005 I have a stream to read, which is like this: <Import> <Name>Fred Jones</Name> <Address>101 Main Street</Address> </Import> <Import> <Name>Fred Smith</Name> <Address>103 Front Street</Address> </Import> Obviously it is more complicated than that - I just have to read the first import then the next, into multiple datasets. If I don't know for sure that the first Node will be 'Import' (it could be 'Imports', 'Data', 'Feed', 'Contact') how can I tell the thing to take all of the Nodes with the start item of 'whatever' and read them? Quote Read the Fovean Chronicles Because you just can't spend your whole day programming!
david7777 Posted March 14, 2005 Posted March 14, 2005 with an xml structure of: <Root> <Import> <Name>Fred Jones</Name> <Address>101 Main Street</Address> </Import> <Import> <Name>Fred Smith</Name> <Address>103 Front Street</Address> </Import> </Root> Imports System.Xml Dim xmld As XmlDocument Dim ImportNode As XmlNode Dim KeyNode As XmlNode Dim nodelist As XmlNodeList 'Link to XML document xmld = New XmlDocument() xmld.Load(ftp_files_dd.SelectedItem.Value & "/ImageKeys.Xml") 'Get the list of Import nodes nodelist = xmld.SelectNodes("/Root/Import") For Each ImportNode In nodelist ' Get attribute by using: ' MyVar = ImageNode.Attributes.GetNamedItem("MyAttributeName").Value '..... Your code ..... For Each KeyNode In ImageNode.ChildNodes 'Get sub node values here by using: ' KeyValueVar = KeyNode.InnerText '..... Your code ..... Next Next Not sure if this is what you were looking for, but maybe it will help..? Quote Bypass your proxy and get anonymous internet surfing FREE!
TheWizardofInt Posted March 14, 2005 Author Posted March 14, 2005 Thanks for replying. No, that is what I am already doing. When it gets t the second instance of the datastream, it happily goes on and adds it to the first stream Quote Read the Fovean Chronicles Because you just can't spend your whole day programming!
david7777 Posted March 15, 2005 Posted March 15, 2005 Maybe you could provide a more complex XML structure - so that we can understand your problem more clearly? Quote Bypass your proxy and get anonymous internet surfing FREE!
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.