Search code examples
c#texttypesova

parsing text from HTML source


I have this Html (xml form) result in my program example

All I want is get info from this source(director - music .....) is there any way to grouping text like 1 and 2 in picture with c# ?


Solution

  • The quickest option you have is to use .Split. First I will split the entire source with the character { (this will give you your sections) and then I will .Split again each one of those sections with the character | From there you only need to parse what you need, you'll end up with an array of Name=Values.

    Something like this will help:

    var blocks = YourVariableHoldingSource.Split('{')
    foreach(var block in blocks){
      var details = blocks.Split('|')    
      foreach(var data in details){
         MessageBox.Show(data);
      }
    }