Hello guys.
From the original topic of not requiring plugins to quickly saving a small amount of data for use online or with an XML driven database; Mugen is quite right about this not being a great way of storing sensitive information such as passwords or puzzle clues.
For such things,
consider encrypting the XML string as a whole, or at least the values in each XML node. There is also one way encryption that could be used for passwords or similar data that you would not want someone to ever read.
If you feel it is not the end of the world if a DBPRO user hacks such a file, consider storing strings in an array, convert that into a memblock and use [Write Memblock] to add the memblock to an open file. The contents of this file could not be interpreted in a text editor by any being from planet earth.
Here is what was added to the array: "<Message>Hi, my name is sam and I like to eat fish and play with monkeys</Message>"
Here is what the text file looks like in a text editor:4 8&„
"What does this file do? What does that say?".
dim a(1) as string
a(1) = "<Message>Hi my name is sam, and I like to eat fish and play with monkeys</Message>"
open to write 1, "c:\text.txt"
make memblock from array 1, a()
write memblock 1, 1
close file 1
Well at least most of your players will not be able to interpret the secret information; but they could type in a few words and cause you program to crash when loading the file back; thus, we probably should not make such a file easy to find in the first place, although, anyone could open any file of anykind and screw it up if they wanted.
The key is to put what ever you do not want them to read, in a difficult to find place, in a difficult to read form. In other words,
write it in backwards Chinese-Egyptian-Algebra-Fusion, put it underneath a pile of pooh in a treasure chest, and bury it under the ocean near the Bermuda Triangle, to the east, below the sharks (Make sure you have it memorized because you might find it difficult to get it back). Hyperbole aside, there are some serious hackers out there, some of them far, some maybe in your very room right now.
Commercial games such as Civilization 5 feature 100s of script files, text files, XML files and image files fully exposed for the players to change. So what! Let them modify the game if they want to. As for the save game files, they are sensitive and therefore encrypted.
---
Following on with the topic of loading XML data, without plugins. Yes, I tend to use a plugin, the XML features in the
Styx Plugin; we can all use what ever reader we want, however, if you needed to create your own reader, to work the way you want it to work (with XML namespaces, multi root level nodes etc), feel free to use my
LoadString() or
LoadDoc() snippets. Expand them and modify them for the purpose you need. Copy, paste and just call them to load up any string you saved using my SaveString() command in the original post above.
Happy days!