Print Page | Close Window

Remove XAML XML information

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=14430
Printed Date: 23 November 2024 at 2:28am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Remove XAML XML information
Posted By: tobi
Subject: Remove XAML XML information
Date Posted: 01 June 2009 at 1:05pm
Does anybody know a simple way to remove the XAML xml information from a
styled item ?
I have a listbox with XAML formatted entries and need to get the
text which is displayed in the listbox only !





Replies:
Posted By: Boris
Date Posted: 07 August 2009 at 9:51am
Hi
 
I have this if it helps.
 
Function TextFromXAML(sXaml As String) As String
Dim find%
Dim p
Dim txt As String
        find% = InStr(sXaml, "</Run")
            If find% <= 0 Then find% = InStr(sXaml, "</TextBlock")
 

            If find% > 0 Then
                txt = Left(sXaml, find% - 1)
                    p = Split(txt, ">")
                        txt = CStr(p(UBound(p)))
                            TextFromXAML = txt
            End If
End Function


-------------
Boris

Product: Xtreme SuitePro (ActiveX) version 16.4.0 16.3.1

Platform: Windows XP (32bit) - SP 3

Language: Visual Basic 6.0 SP6

VS 2005-2008-2010-2013


Posted By: jpbro
Date Posted: 07 August 2009 at 12:02pm
It turns out that this is a trickier problem than it first appears! For example, Boris' method fails if the TextBlock contains <LineBreak/> tags, or if the TextBlock has been defined like:

<TextBlock Text='This is a test'/>

It also won't reverse entity encodings such as &amp; and &#163; . It is still a very useful function as long as you keep your XAML within a specific definition though (I'm not knocking it, just pointing out some potential pitfalls).

I'm working on a more general algorithm now, and I will post it when it is available.


-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: Boris
Date Posted: 07 August 2009 at 12:16pm
Hi jpbro,
 
I have been a little lazy. This was a piece of code that I use to split out the known elements I have used to add to combos amd list boxes in one of my apps. If you do come up with a more global version I would like to see this as I have only coded this for my own specific needs. But, it does show that CJ could add a very useful property to some of the controls.
 
CJ are you reading this?
 
Best regards,
 


-------------
Boris

Product: Xtreme SuitePro (ActiveX) version 16.4.0 16.3.1

Platform: Windows XP (32bit) - SP 3

Language: Visual Basic 6.0 SP6

VS 2005-2008-2010-2013


Posted By: jpbro
Date Posted: 07 August 2009 at 2:29pm
Hey guys,

Here's my first attempt at a XAML > Plaintext converter:

https://forum.codejock.com/forum_posts.asp?TID=14928&PID=51713#51713 - https://forum.codejock.com/forum_posts.asp?TID=14928&PID=51713#51713

Bug reports, questions and ideas are welcome.


-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: Boris
Date Posted: 09 August 2009 at 2:46pm
That looks fairly compreshensive!
 
Well done.
 
If I need to use a lot more XML in my lists I'll definately try using this rather than my version.
 
Thanks jpbro
 
 


-------------
Boris

Product: Xtreme SuitePro (ActiveX) version 16.4.0 16.3.1

Platform: Windows XP (32bit) - SP 3

Language: Visual Basic 6.0 SP6

VS 2005-2008-2010-2013


Posted By: jpbro
Date Posted: 09 August 2009 at 4:00pm
Thanks Boris!

I just made a few bug fixes and re-uploaded the source to the same post as before...I hope it comes in handy some day!



-------------
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