XML as a basic data storage format?

Like perhaps /home’s and /warp’s, where its only 3-5 types of information being stored for a large amount of really simple data(x, y, z)?

Forgive me if im wrong, but this seems a bit easier to open in notepad and not be consumed by ugly HOCON.

TS;DR Is XML as a storage format acceptable?

If it’s for data storage, use whatever is easiest for you personally and or efficient to compute depending on the situation.

However if it’s for configuration, which admins/users are expected to edit themselves, please try to stick to what the users are already familiar with. It’s up to you to decide what that is, and Sponge won’t force any choice upon you.

That said, I don’t think many users of the Minecraft community would be familiar with XML outside of simple HTML editing, if that.

YAML would be appropriate for a plugin being ported or that had a previous version, otherwise it’s planned for HOCON to be a standard for Sponge plugins.

3 Likes

But what if its not meant to be changed? What if its just mass storage of key value pairs?

Then you’re probably fine to use whatever you want.

1 Like

First sentence that I replied to you.

1 Like

What is so ugly about HOCON?

3 Likes

I think it’s more of a not being used to the format kind of thing.

I will show you what you see if you open a .conf in textpad. It’s pretty gnarly. You have to skim through every line because there’s no formatting besides alphabetical sorting. I’m looking to use both, hocon as an options platform and xml/something else as a storage platform. What other languages are good at this sort of thing? Does this make sense?

In certain cases you might want to check if the data structure is not damaged/missing. And json has no such thing as dtd/xsd. Also for me xml if simpler to read than json.

So it could be good as a data storage format, yes?

yes.

1 Like

I feel like YAML would be a good way of storing data as well, i guess im asking which one is more efficient?

That would depend on your parser implementation.

If you’re considering yaml and it’s really just data nobody’s supposed to edit by hand, you might want to consider using something like sqlite for large amounts of the same datastructure or json. But as @LordLambda pointed out, performance is a matter of the parser you’re using.

1 Like

This plugin could have a web component of sorts. Would that make a service like mySQL a valid option as well? That works offline as well, yes?

Is SnakeYAML any good?

MySQL typically won’t be available to people using Minecraft hosting companys. If you want to store that same data structure many times (like an inventory, stats, etc…) using a database makes sense. Note that you should probably have an option to use SQLite for those who can’t run a MySQL server for whatever reason. There are some nice abstraction layers for this around. For web applicatons, MySQL support is usually a good idea.

(Also, if you’re dealing with huge amounts of that data, MySQL will be significantly faster than some file you serialize stuff to.)

It works. Idk how it compares to other parsers performance-wise.

1 Like

If you go with xml since jdk 1.5 there is JAXB in java you can use

1 Like

For reference, SnakeYAML is what Bukkit used in its configuration API.

Speed depends on implementation not used technology.

2 Likes