We made some changes

Our new forums are here!

Saving money on data

Mint SIM is the perfect way to get cheap data in the U.S.

Don't count Windows Phone out just yet

Dead? Psh. Here are 5 reasons to stick with Windows 10 Mobile

VPN vs. Proxy

The difference between a proxy and a VPN

Latitude attitude

Dell Latitude 7280 is a business laptop with tons of consumer attitude

4K all the way

You probably don't NEED a 4K webcam, but we love Logitech's BRIO 4K anyway

Long live Windows phone

Contrary to popular belief, Windows phone won't die anytime soon


Dell's already awesome XPS 15 gets even better in 2017

Surface Pwn 5

Surface Pro 5, Project NEON details leaked on LinkedIn?

Redefining the PC

Why Microsoft's Surface phone could be MUCH more than a mere 'phone'

Surface table meets Windows 10

Yes, we did put Windows 10 on the original Surface table ... and it rocks

Cream o' the crop

Before buying a Microsoft laptop, check out our pick for the absolute best

Simple and secure, just the way I like it

We think Windows 10 Cloud is a great idea, here's why

uber micro

Halo Wars 2 has something for everyone. Here's our full review.

Oldie but goldie

We reviewed Microsoft's decade-old Surface table

Creators Update comin' at ya

These are the coolest new features in the next big Xbox One update (video)

Buyer's guide

The Razer Blade 14 is the best laptop Razer has to offer

Windows 10 app gems

10 terrific Windows 10 apps you should be using

Tower of power

Here's what we think of Dell's XPS Tower Special Edition

Quite a deal

Grab the complete C# coding bootcamp for $41!

< >
Welcome to the Windows Central Forums Create Your Account or Ask a Question Answers in 5 minutes - no registration required!
Results 1 to 4 of 4
  1. Sebastiaan den Boer's Avatar

    12 Posts
    0 Post(s)
    0 Thread(s)
    Hi there,
    Currently I'm working on an app that has code elements from the WordPress sample built-in. This means however, that posts show up in a WebBrowser control. As the WebBrowser control overrides the gesture events, swipes to the left or right are being ignored by the pivot.
    I'm currently passing the source of the WebBrowser to a RichTextBox, but I've been unable to remove HTML-tags, like <p class="">, <img>, etc.

    var html = new StringBuilder();
    html.Replace("<p>", String.Empty);h
    return html.ToString();

    When I remove the html.Append(htmlSubString); the entire content of the textbox disappears...
    I'm currently trying to use this code as a "filter", but it does not seem to work. As I've never worked with this part of coding before, it's hard for me to understand why this doens't work.
    It would be great if someone could show me a revised version of my code or some website with an explanation so I can finally finish this app.
    Also IF it is not too much of a problem, I'd like the images in the HTML to be converted into an image in XAML.

    Anyone know how to do this? If not, thanks for reading anyway
  2. Bee Mon's Avatar

    764 Posts
    0 Post(s)
    0 Thread(s)
    I personally have not used this yet but it seems that many are using the HTMLAgilityPack library to convert HTML content to a DOM structure that you can then use either XPath or LINQ to extract and transform.

    Codeplex site: Html Agility Pack - Home
    Nuget page: NuGet Gallery | HtmlAgilityPack 1.4.6
    Nokia article: HTML Page parsing using HTMLAgilityPack - Nokia Developer Wiki
  3. 2Scratch's Avatar

    2 Posts
    0 Post(s)
    0 Thread(s)
    Well, if this is actual code sequence, then no surprise that it's not working.
    First of all you are calling Replace method on empty String(Builder), so first line should be:
    var html = new StringBuilder(htmlSubString); // htmlSubString or whatever your source html is.
    Then replace will do nothing. You should consider using regexes to detect starting and ending tags.
    Next, StringBuilder is used to create/edit a string, when you are going to do many append's.
    So to remove some tags on string, it wont be needed.

    So go with this:
    string filteredHtml = System.Text.RegularExpressions.Regex.Replace(initialHtml, "A regex pattern that matches starting OR ending tags", "");

    BTW, if you're not so much familiar with regex, RegExr is a good place to start testing.
  4. 2Scratch's Avatar

    2 Posts
    0 Post(s)
    0 Thread(s)
    You should go with regex.
    string filteredHtml = System.Text.RegularExpressions.Regex.Replace(initialHtml, "A regex pattern that matches starting OR ending tags", "")

Similar Threads

  1. I wrote this to Microsoft.
    By Parteek Agnihotri in forum Nokia Lumia 920
    Replies: 105
    Last Post: 08-03-2013, 05:48 PM
  2. Replies: 5
    Last Post: 08-01-2013, 08:33 AM
  3. Was ... close to buying a L1020 today
    By gsquared in forum Nokia Lumia 1020
    Replies: 3
    Last Post: 07-29-2013, 03:55 PM

Posting Permissions