Hi....
I have just written a c# code which connects to a web server....
Pulls out xml, extracts data and inserts the data onto a database.....

however i have a small problem scrubbing certain data of junk values.....

few examples of the data i want to scrub are posted below...

<span style="font-family: sans-serif; font-size: 13px; line-height: 19px; "><b><span style="font-weight: normal;">Robert De Niro, who is thought of as one of the greatest actors of his time, was born in New York City in 1943 to two artists. He was trained at the Stella Adler Conservatory and the American Workshop. He first gained fame for his role in Bang the Drum Slowly (1973), but he gained his reputation as a volatile actor in Mean Streets (1973), which was his first film with director Martin Scorsese. In 1974 De Niro received an Academy Award for best supporting actor for his role in The Godfather: Part II (1974) and received Academy Award nomations for best actor in Taxi Driver (1976), The Deer Hunter (1978), and Cape Fear (1991). He won the best actor award in 1980 for Raging Bull (1980). De Niro currently heads his own production company, Tribeca Film Center, and made his directorial debut in 1993 with A Bronx Tale (1993).</span>  </b><p></p></span>
Saif Ali Khan (Hindi: सैफ़ अली ख़ान, Bengali: সাইফ আলি খান, Urdu: سیف علی خان, pronounced [sɛːf ˈəliː ˈxaːn]; born 16 August 1970 in New Delhi, India) is an Indian actor in Bollywood films. He is the son of the Nawab of Pataudi, Mansoor Ali Khan Pataudi, and the actress Sharmila Tagore. He has two sisters; actress Saba Ali Khan and Soha Ali Khan. He is the heir apparent to the headships of both the royal houses of Bhopal and Pataudi.  Khan made his debut in 1992 with Parampara. He had his first major successes with the 1994 films Main Khiladi Tu Anari and Yeh Dillagi. After going through several years of decline in the 1990s, he rose into prominence with his performance in Dil Chahta Hai (2001), which marked his professional turning point. His performance in Nikhil Advani's Kal Ho Naa Ho (2003) won him the Filmfare Best Supporting Actor Award, and he won the National Film Award for Best Actor for his performance in Hum Tum (2004). He then had commercial success with films like Salaam Namaste (2005), Race (2008) and Love Aaj Kal (2009), and starred in critically acclaimed projects such as Parineeta (2005) and Omkara (2006). These successes put him among the most successful actors in the industry.[3] Since 2009, Khan has branched out into film production. He is the founder-owner of his production company Illuminati Films.
<FONT size=3><FONT face=Calibri><B><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN" lang=EN>John Gavin Malkovich</SPAN></B><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN" lang=EN> (December 9, 1953) was born in Christopher, Illinois. Malkovich is an American actor, producer, and director. Over the last 25 years, Malkovich has appeared in more than 70 motion pictures. For his roles in Places in the Heart and In the Line of Fire, he received Academy Award nominations. He has also appeared in critically acclaimed films such as Empire of the Sun, The Killing Fields, Dangerous Liaisons, Con Air, Being John Malkovich, and Changeling.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></FONT></FONT>  <P style="MARGIN: 0in 0in 10pt; mso-layout-grid-align: none" class=MsoNormal><FONT size=3><FONT face=Calibri><B><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN" lang=EN>Early life</SPAN></B><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN" lang=EN><o:p></o:p></SPAN></FONT></FONT></P>  <P style="MARGIN: 0in 0in 10pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN" lang=EN><FONT size=3><FONT face=Calibri>His paternal grandparents were Croats, natives of Ozalj in Karlovac County, Croatia. His mother was of Scottish and German ancestry. He grew up in Benton, Illinois, in a large house on South Main Street. His father, Daniel Malkovich, was a state conservation director and publisher of Outdoor Illinois, a conservation magazine. His mother, Joe Ann (née Choisser), owned the Benton Evening News (a local newspaper in Benton, Il.), as well as Outdoor Illinois. Malkovich attended Logan Grade School, Webster Junior High, and Benton Consolidated High School, in Benton, Illinois. During his high school years, he appeared in various plays and the musical, Carousel. He was also a member of a folk/rock musical trio, and was a member of a local summer theater/comedy project in Benton in 1972, where he co-starred in Jean-Claude Van Itallie's America Hurrah. Upon graduation from high school, he entered Eastern Illinois University, and then transferred to Illinois State University, where he majored in theatre.<o:p></o:p></FONT></FONT></SPAN></P>  <P style="MARGIN: 0in 0in 10pt; mso-layout-grid-align: none" class=MsoNormal><FONT size=3><FONT face=Calibri><B><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN" lang=EN>Career</SPAN></B><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN" lang=EN><o:p></o:p></SPAN></FONT></FONT></P>  <P style="MARGIN: 0in 0in 10pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN" lang=EN><FONT size=3><FONT face=Calibri>In 1976, Malkovich, along with Joan Allen, Gary Sinise, and Glenne Headly, became a charter member of the Steppenwolf Theatre Company in Chicago. He moved to New York City in 1980 to appear in a Steppenwolf production of the Sam Shepard play True West, for which he won an Obie Award. Malkovich then directed a Steppenwolf co-production, the 1984 revival of Lanford Wilson's Balm in Gilead, for which he received a second Obie Award and a Drama Desk Award. His Broadway debut that year was as Biff in Death of a Salesman, alongside Dustin Hoffman as Willy. Malkovich won an Emmy Award for this role when the play was adapted for television by CBS in 1985.<o:p></o:p></FONT></FONT></SPAN></P>  <P style="MARGIN: 0in 0in 10pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN" lang=EN><FONT size=3><FONT face=Calibri>One of the actor's first forays into film was as an extra alongside Allen, Terry Kinney, George Wendt, and Laurie Metcalf in Robert Altman's 1978 film A Wedding. He made his feature film debut in 1984, as Sally Field's blind boarder Mr. Will in Places in the Heart; for his portrayal of Mr. Will, Malkovich received his first Academy Award nomination for Best Supporting Actor. He also portrayed Al Rockoff in The Killing Fields. He continued to have steady work in films like Empire of the Sun, directed by Steven Spielberg, and the 1987 film adaptation of Tennessee Williams's The Glass Menagerie, with Paul Newman and Joanne Woodward. A few years later, Malkovich became a star when he portrayed the sinister and sensual Valmont in the 1988 film Dangerous Liaisons. He later reprised this role for the music video of Walking on Broken Glass by Annie Lennox.<o:p></o:p></FONT></FONT></SPAN></P>  <P style="MARGIN: 0in 0in 10pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN" lang=EN><FONT size=3><FONT face=Calibri>Malkovich starred in the 1992 film adaptation of John Steinbeck's award-winning novella Of Mice and Men as Lennie alongside Gary Sinise as George. In 1994, he was nominated for another Oscar, in the same category, for In the Line of Fire. Though he played the title role in the Charlie Kaufman-penned Being John Malkovich, he played a slight variation of himself, as indicated by the character's middle name of "Horatio". Malkovich has a cameo in the movie Adaptation.—also written by Kaufman—appearing as himself during the filming of Being John Malkovich. The Dancer Upstairs, Malkovich's directorial film debut, was released in 2002. Recent film roles include The Hitchhiker's Guide to the Galaxy, Beowulf, Burn After Reading, Changeling and Red.<o:p></o:p></FONT></FONT></SPAN></P>  <P style="MARGIN: 0in 0in 10pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN" lang=EN><FONT size=3><FONT face=Calibri>Malkovich has hosted three episodes of the NBC sketch show Saturday Night Live. The first occasion was in January 1989 with musical guest Anita Baker; the second in October 1993 with musical guest Billy Joel (and special appearance by former cast member Jan Hooks); and the third was in December 2008 with musical guest T.I. with Swizz Beatz (and special appearances by Justin Timberlake, Molly Sims, and Jamie-Lynn Sigler).<o:p></o:p></FONT></FONT></SPAN></P>  <P style="MARGIN: 0in 0in 10pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN" lang=EN><FONT size=3><FONT face=Calibri>In keeping with his renaissance-man image, he also is a costume designer and has his own line of men's clothing called Technobohemian.<o:p></o:p></FONT></FONT></SPAN></P>  <P style="MARGIN: 0in 0in 10pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN" lang=EN><FONT size=3><FONT face=Calibri>In a 2008 interview on College Hour, Malkovich revealed that he has been discussing making a motion picture adaptation of the Arnon Grünberg novel The History of My Baldness.<o:p></o:p></FONT></FONT></SPAN></P>  <P style="MARGIN: 0in 0in 10pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN" lang=EN><FONT size=3><FONT face=Calibri>In November 2009, Malkovich appeared in an advertisement for Nespresso with fellow actor George Clooney. He portrayed Quentin Turnbull in the film adaption of Jonah Hex. Malkovich was due to play the role of The Vulture in Spider-Man 4, but the project was canceled in January 2010.<o:p></o:p></FONT></FONT></SPAN></P>  <P style="MARGIN: 0in 0in 10pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN" lang=EN><FONT size=3><FONT face=Calibri>Malkovich is known for his distinctive voice, which The Guardian describes as "a reedy, faintly orgasmic drawl".<o:p></o:p></FONT></FONT></SPAN></P>  <P style="MARGIN: 0in 0in 10pt; mso-layout-grid-align: none" class=MsoNormal><FONT size=3><FONT face=Calibri><B><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN" lang=EN>Personal life and political views</SPAN></B><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN" lang=EN><o:p></o:p></SPAN></FONT></FONT></P>  <P style="MARGIN: 0in 0in 10pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN" lang=EN><FONT size=3><FONT face=Calibri>Malkovich was married to Glenne Headly from 1982 to 1988. They divorced after Malkovich became involved with Michelle Pfeiffer, his co-star in Dangerous Liaisons. He later met his long-term partner Nicoletta Peyran on the set of The Sheltering Sky where she was the second assistant director, in 1989. They have two children; Amandine (born 1990) and Loewy (born 1992).<o:p></o:p></FONT></FONT></SPAN></P>  <P style="MARGIN: 0in 0in 10pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN" lang=EN><FONT size=3><FONT face=Calibri>Malkovich is a conservative. Actor William Hootkins, who worked with Malkovich in BBC Television's Rocket to the Moon, stated, "In fact, he's so right-wing you have to wonder if he's kidding."<o:p></o:p></FONT></FONT></SPAN></P>  <P style="MARGIN: 0in 0in 10pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN" lang=EN><FONT size=3><FONT face=Calibri>In a 2002 appearance at the Cambridge Union Society, when asked whom he would most like to "fight to the death," Malkovich replied that he would "rather just shoot" journalist Robert Fisk and British MP George Galloway. Fisk reacted with outrage. When interviewed by The Observer, Malkovich elaborated on his comments: "I hate somebody who is supposed to be a Middle Eastern expert who thinks Jesus was born in Jerusalem. I hate what I consider his vile anti-semitism. This being said, I apologize to both Fisk and Galloway; they seem like good men but if they make such a heinous mistake again, I will not hesitate to murder them brutally by way of the gallows." Malkovich later added: "I'm a Christopher Hitchens fan myself, but no one has thinner skins than journalists, in my experience, and I come from a family of them... They can dish it out but they can't take it. But the reason I don't like the topic, why I don't really say anything about a whiner like Fisk, is it gives them more oxygen."<o:p></o:p></FONT></FONT></SPAN></P>  <P style="MARGIN: 0in 0in 10pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN" lang=EN><FONT size=3><FONT face=Calibri>Malkovich is fluent in French and for nearly 10 years, lived and worked in a theater in southern France. He and his family left France in a dispute over taxes in 2003, and since then he has lived in Cambridge, Massachusetts. In a 2008 interview on The Late Show With David Letterman, Malkovich said he had just spent five weeks that summer living in France.<o:p></o:p></FONT></FONT></SPAN></P>  <P style="MARGIN: 0in 0in 10pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN" lang=EN><FONT size=3><FONT face=Calibri>Malkovich is a confirmed atheist.<o:p></o:p></FONT></FONT></SPAN></P>  <P style="MARGIN: 0in 0in 10pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN" lang=EN><FONT size=3><FONT face=Calibri>In April 2005, while speaking at Illinois State, Malkovich was awarded his bachelor's degree in theatre. When attending the university as a student in the 1970s, he failed to take his last remaining graduation requirement, a test on the United States Constitution; this requirement was waived for Malkovich.<o:p></o:p></FONT></FONT></SPAN></P>  <P style="MARGIN: 0in 0in 10pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ansi-language: EN" lang=EN><FONT size=3><FONT face=Calibri>Malkovich lost millions to Bernard Madoff's Ponzi scheme when it collapsed in 2008.<o:p></o:p></FONT></FONT></SPAN></P>  <P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri> </FONT></o:p></P>

as you can see... there are a lot of junk (xml and html) which i don't want on the database.....


I initially thought of using string replace.... then thought of regular expressions....
But the problem is there is no superset i can describe....
do these tags fall under a particular category or does C# have a class library which can handle such data.....

I haven't posted the C# code because it is too big(8 pages) and the problem i have is not with the code....
i just need an extra function to scrub out invalid data.....
Please help.....

Recommended Answers

All 2 Replies

Try this:

// Convert < > etc. to HTML
String sResult = HttpUtility.HtmlDecode(sData);
// Remove HTML tags delimited by <>
String result = Regex.Replace(sResult, @"<[^>]*>", String.Empty);

If you are using a .NET Forms app, you will have to specifically reference "System.web" in order to get your hands on "HttpUtility". "Regex" is in "System.Text.RegularExpressions".

thank you cris.....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.