XML: Storing Strings: Difference between revisions

From FSDeveloper Wiki
Jump to navigationJump to search
No edit summary
Line 32: Line 32:
1. Strings of up to 64 alphanumeric characters, including spaces, in length can be stored in a single, unitless L:Var. All ascii special characters: !, @, #, $, % etc. etc. ''except'' & , / , \ , < , and ' (single quote) are accommodated in addition to all of the alphanumerics.
1. Strings of up to 64 alphanumeric characters, including spaces, in length can be stored in a single, unitless L:Var. All ascii special characters: !, @, #, $, % etc. etc. ''except'' & , / , \ , < , and ' (single quote) are accommodated in addition to all of the alphanumerics.


2. The L:Var can have any name and there can be any number of such 'string' L:Vars in a gauge. The 'string' L:Vars can be read by any XML gauge of your panel set, similar to normal L:Vars.
2. The L:Var can have any name and there can be any number of such 'string' L:Vars in a gauge. The 'string' L:Vars can be read by any XML gauge in your panel set, similar to normal L:Vars.


3. Functional Backspace
3. Functional Backspace

Revision as of 00:29, 14 September 2011

XML: Storing Strings

The need to store strings is an issue sometimes faced when coding in XML, particularly when designing a gauge that utilizes the gps module (for example, when making an FMS). Options to store string data include:


1. Use of XML String Operators ord chr and scat to store and retrieve the ascii code equivalent of individual string characters in L:Vars. This has been the standard approach.

2. Macros that make use of the String Operators and enable more than one string character (up to 6) to be stored into a single L:Var. For example, Roman Stoviak has written a very clever set of macros that use String and Numerical Operators to store up to 6 string characters into L:Vars. http://forum.avsim.net/topic/299204-...g-string-data/

3. The internal registers, e.g., s0 … s49, with the limitation that these registers are wiped clean every update cycle.

4. String to memory dll module. Doug Dawson’s bottomless bag of cool tricks includes a prototype (September 2011) module that will allow strings to be stored into memory. Tested in FSX. Requires the loading of the dll module but you won't need the macros from 2. See this FSDeveloper link: [1]

5. XML read/write to hard disk. Robbie McElrath has completed a dll module that enables very easy file read/write capability: XML--> HDD--> XML. Accommodates strings and numbers, works with all text and .csv file formats, FS9 and FSX. He will be releasing it soon (Q4 2011). http://forum.avsim.net/topic/299204-...g-string-data/


A variation on 2), Robbie has scripted XML macros that utilize String and Bit Operators to manipulate strings and store the result into L:Vars. Please see this FSDeveloper link: [2]

Features of these macros:

1. Strings of up to 64 alphanumeric characters, including spaces, in length can be stored in a single, unitless L:Var. All ascii special characters: !, @, #, $, % etc. etc. except & , / , \ , < , and ' (single quote) are accommodated in addition to all of the alphanumerics.

2. The L:Var can have any name and there can be any number of such 'string' L:Vars in a gauge. The 'string' L:Vars can be read by any XML gauge in your panel set, similar to normal L:Vars.

3. Functional Backspace

4. FS9 and FSX.

The macros and further discussion of storing strings are in this FSDeveloper thread: [3]