Codejock Forums Homepage
Forum Home Forum Home > General > Code Snippets > Visual Basic Code Snippets
  New Posts New Posts RSS Feed - XAML Stripper
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

XAML Stripper

 Post Reply Post Reply
Author
Message
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Topic: XAML Stripper
    Posted: 07 August 2009 at 2:27pm
Here's my first attempt at a generic XAML markup stripper. It seems to work pretty well so far (test against CJ markup examples). It's not as efficient as it could be (I could be short-circuiting the main loop in more places, and maybe even handle entities in the first pass), but it should do if you don't have to convert a lot of items. I will see if I have time to optimize it, but if anyone wants to pick up the task, I won't complain

Some decisions had to made about whitespace handling - I decided to collapse them all just like Markup display does, but this may not be suitable for all purposes (e.g. matching against data from the source that you generated the markup from). I also decided to add space between plain text from different tags. This isn't always the desired result (for example, the baseline example has a a space between the word Baseline and the number 2 in the converted text, that doesn't appear on the markup display. But it is the preferable result in more cases so I went with it).

Here's the source:

uploads/20090809_155906_StripMarkup.zip

Bug reports welcome, of course.
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 09 August 2009 at 3:58pm
Updated (latest version always in first post) - bug fixes for handling spaces between attribute name and equal sign, as well as for missing inline Text/Content attribute when tag is self-closed and last item.
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.203 seconds.