Hello,
I need a simple way to read/write/search xml files from within mushclient. I would use sqlite, but I don't think it's worth it for an equipment database, and I think I would rather use xml.
Any ideas?
Thanks :)
Let me be polite, and call you out on your BS before you get too far down the path to be insulted by any such opinion. :)
XMLs strength is that it is universal and can be interpreted by a lot of different applications for a lot of different purposes. It's primary purpose is as a go-between, and not for things where you'd like 'high' performance with reading and writing data. For anything involving a lot of live, changing data, it is the wrong format. While many people think of XML as a database, it is not a database. It can be made to hold the structure of one, but that is where it ends.
Depending on what you want/need, a database may be what you want. If you want persisting equipment across sessions, sqlite is indeed a good way to go. However, merely using lua tables which you serialize and deserialize at the proper times may be a far easier and more flexible way to start out, as you do not need queries and everything will be native to your scripting language (assuming you use Lua, which I am assuming since it is what most people use.)
Summary: do yourself a favor, and forget about XML. If anything is not worth the effort for your purpose, it is XML.
On that I create a database, add some stuff, and read it back, in about 35 lines of code.
Worstje is right though, for small to medium cases, simple Lua tables are fine (you can serialize with various methods described in the Lua section).
However for a lot of data, or to share between multiple world files (eg. multiple characters on one MUD) then you might find that the SQL database is faster to load up, and easier to share.