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..

3
  • Check this: looping through XML file using VB.NET Commented Oct 31, 2019 at 5:51
  • but this is using xmlDocument property right? I'm using xDocument.. @JQSOFT Commented Oct 31, 2019 at 6:13
  • Then check this: Getting all nodes of XML doc. Commented Oct 31, 2019 at 6:24

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.