Get rid of HTML and XML tags (5/30/2008)

 When you work with word xml files and locate a field in the schema what you read usually contains XML decorating tags that most probably you don’t need them in your code. How can we get rid of them?
It is pretty simple. Brush up your .NET knowledge and remember we have a class called Regex which is a short name for Regular Expression object. Using Regex you can simply define a pattern for XML or HTML tags. This pattern will be something like this: "<[^>]*>".
The very same Regex class has Replace function that works just like Replace in String class. Having them all together in C# you will have a code like this:
 

  public string RemoveTags(String originalMessage)

  {

      Regex rgx = new Regex("<[^>]*>");

      return rgx.Replace(originalMessage, "");

  }

This function simply gets an HTML/XML String and returns pure text. Don’t forget to add
using System.Text.RegularExpressions;
to your file header.
Enjoy
Alireza
 


By: edy  
i have files that say htlm but should be in player and will not open. How do i convert an htlm to player mode, if this makes any sense
URL:  
By: krish  
URL: http://5099.freesharepoint2007.com/Sharewiki/Wiki%20Pages/Home.aspx  
Your name:
Email:
URL:
Comments:
 

 -