Print Page | Close Window

XAML Stripper

Printed From: Codejock Forums
Category: General
Forum Name: Visual Basic Code Snippets
Forum Description: Visual Basic Code Snippets
URL: http://forum.codejock.com/forum_posts.asp?TID=14928
Printed Date: 26 April 2024 at 6:10pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: XAML Stripper
Posted By: jpbro
Subject: XAML Stripper
Date 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 - 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




Replies:
Posted By: jpbro
Date 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




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net