Sign in to follow this  
n4gix

XML Strings

Recommended Posts

Hi!Is there any possibility in XML that you save a string in a costum variable like 'string' (>L:Variable, string)I've tried something like this but it doesn't work:------------------------------------------------------------------ 'hs' (>L:Var,string) :%( (L:Var,string) )%!s!:------------------------------------------------------------------Any ideas?Best Regards,Harry

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Harry, Unfortunately L:vars don't support string data types. You'd have to test the value and convert it to a string based on its numeric value. Generally, at least for the stuff I've been doing, I haven't needed anything too robust (simple case lookups), but you could write a parser of some kind if you wanted to be able to store and retrieve 'string' data as numeric values.%((L:Word, enum))%{case}%{:1}%Alpha%{:2}%Bravo%{:3}%Delta%{end}--Jon

Share this post


Link to post
Share on other sites

Hi,Just a curious question:What do you want to achieve with the string.Some typing or must there be a function too?Jan"Beatus Ille Procul Negotiis"

Share this post


Link to post
Share on other sites

Well I had to ask for someone who isn't an AVSIM user.He wanted to write the color string(e.g. 'red') into a L var.Then he wanted to write this variable into the color="" attribute of a Text-String, so that the color changes by changing the L var.But of course there is a much better way to do this:TEST:%((L:farbe, enum))%!d! (L:farbe, enum) 3 == if{ 0 (>L:farbe, enum) } els{ (L:farbe, enum) 1 + (>L:farbe, enum) } Regards,Harry

Share this post


Link to post
Share on other sites

>But of course there is a much better way to do this:>Color="%( (L:farbe, enum) 0 == if{ 'white' } (L:farbe, enum) 1>== if{ 'green' } (L:farbe, enum) 2 == if{ 'yellow' } (L:farbe,>enum) 3 == if{ 'red' } " A similar solution was posted in this very forum last year. A search would have found it quickly... ;)Had the original question been more descriptive of the "end result," one of us could have pointed to that thread... ;)Here's a link to another way to accomplish "dynamic color changes" in a fixed text string:http://forums.avsim.net/dcboard.php?az=sho...16945&mode=full

Share this post


Link to post
Share on other sites

Hi Bill!Well, the problem is that the person who asked me didn't tell me all information at first. So I didn't know what he wanted to do.(I thought he just wants to work with strings in L:vars)I think you know the FXP forum!? Have a look here: http://www.wcm.at/forum/showthread.php?s=&...15&pagenumber=1After he told me that he "just" wants to set the color of the text, I knew that this posting here at AVSIM was senseless, because the solution was pretty easy(the code above took me 5min of work...so it wasn't really difficult).But nevertheless, I've learnd something new: There is no possibility to make L: vars of the kind string.(or at least just with some extra add ons)...Regards,Harry

Share this post


Link to post
Share on other sites

Not a problem, sir! No, I was not aware of that forum you so graciously provided a link to. Although I can still read fluently, my written (not to mention spoken!) Deutsch is nicht so gut heute... ;)I have always had a love of great music. When I was a small boy, lo these many decades ago, I "fell in love" with the idea of being a choirboy, and rather shocked my father and mother by daring to suggest that they emigrate to your lovely Austria so I could audition for the Weinersangerknaben... I'll leave their response to that suggestion to your imagination! ;)While a student at Leysin American School in Leysin-Feydey, Suisse I would take the train to Wein at least once each month to attend sung Mass at the Cathedral... all so I could revel in the dulcet tones of such lovely voices of angels!

Share this post


Link to post
Share on other sites

Und die Wiener "Schrammel" mit Wein im Heurigen....Jan"Beatus Ille Procul Negotiis"

Share this post


Link to post
Share on other sites

>Und die Wiener "Schrammel" mit Wein im Heurigen....>Is dat Fries :-) ????Sorry, I'm a bit "melig" in view of my "other" threads in the other forum :-)Haven't had the time to visit my favorite forum for a few days; I must admit,it's relaxing ..LOL Cheers, Rob

Share this post


Link to post
Share on other sites

Hi!I think you know the FXP Forum already, because you've once written some answers to questions about your Socata!?Yes, the S

Share this post


Link to post
Share on other sites

>I think you know the FXP Forum already, because you've once>written some answers to questions about your Socata!?Oh my, that was years ago! I'd quite forgotten about it... ;)>Yes, the S

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this