0

I wanted to add condition to get to my xml tag and do something within the tag.

These are the sample of my xml file

<ROOT>
    <FILE1>
        <ENGLISH_LANGUAGE>
            <ANOTHER_TAG></ANOTHER_TAG>
        </ENGLISH_LANGUAGE>
        <MANDARIN_LANGUAGE>
            <ANOTHER_TAG></ANOTHER_TAG>
        </MANDARIN_LANGUAGE>
    </FILE1>
</ROOT>

Using the sample of xml tags as given above, I would like to add some if else condition for tag..

I'm reading the file in xDocument.. below are the sample of codes I've written.

 Dim xmlFile As String = "XmlFile.xml"
 Dim xdoc As XDocument = xDocument.Load(xmlFile)
 Dim root As String = xdoc.Root.Name.ToString

 Dim strAll As String
 strAll = File.ReadAllText(xmlFile)

How can I add the if else condition to get tag? and do something within the tag.. Thanks in advance..

ari
  • 13
  • 4
  • Check this: [looping through XML file using VB.NET](https://stackoverflow.com/questions/17276580/looping-through-xml-file-using-vb-net) –  Oct 31 '19 at 05:51
  • but this is using xmlDocument property right? I'm using xDocument.. @JQSOFT – ari Oct 31 '19 at 06:13
  • Then check this: [Getting all nodes of XML doc](https://stackoverflow.com/questions/7467496/c-sharp-getting-all-nodes-of-xml-doc?noredirect=1&lq=1). –  Oct 31 '19 at 06:24

0 Answers0