reading a xml file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi iam getting 1kb xml file like this

<Transfer><rec>1</rec><Message>sds</Message><From>testingnet</From></Transfer>




i want to read only between<from> in the xml

the result should result me only testingnet

i have searched a lot of stuff, i could not find out the easy way to read in windows, vb.net
any body help me, to find the result in between the tags.
 
Hi ,

you can use GetElementsByTagName method in xml Dom object ...


I saved your xml content like demo.xml

<?xml version="1.0" ?>
<Transfer>
<rec>1</rec>
<Message>sds</Message>
<From>testingnet</From>
</Transfer>



and i wrote code in c# like


System.Xml.XmlDocument obj= new System.Xml.XmlDocument();
obj.Load("c:\\demo.xml");
MessageBox.Show( obj.GetElementsByTagName("From").Item(0).InnerText);



bye

rajamanickam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top