Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ xml processing

xml processing

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Ogomez92   (42 posts)  Bio
Date Thu 23 Sep 2010 04:22 PM (UTC)
Message
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 :)
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #1 on Thu 23 Sep 2010 05:05 PM (UTC)
Message
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.
Top

Posted by Ogomez92   (42 posts)  Bio
Date Reply #2 on Thu 23 Sep 2010 05:36 PM (UTC)
Message
Lua tables, good point. I shall investigate into that. Thanks.
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #3 on Thu 23 Sep 2010 07:20 PM (UTC)
Message
Make sure to check out the different topics in the Lua section. There's a fair few topics dedicated to ways one can use and abuse tables.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #4 on Fri 24 Sep 2010 12:49 AM (UTC)

Amended on Fri 24 Sep 2010 12:50 AM (UTC) by Nick Gammon

Message
SQLite3 isn't that bad. See this page:

http://www.gammon.com.au/forum/?id=9241

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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


19,044 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.