tags:

views:

809

answers:

8

For me usable means that:

  • it's being used in real-wold
  • it has tools support. (at least some simple editor)
  • it has human readable syntax (no angle brackets please)

Also I want it to be as close to XML as possible, i.e. there must be support for attributes as well as for properties. So, no YAML please. Currently, only one matching language comes to my mind - JSON. Do you know any other alternatives?

+11  A: 

JSON is a very good alternative, and there are tools for it in multiple languages. And it's really easy to use in web clients, as it is native javascript.

Staale
I already mentioned JASON, do you know some alternative to it ?
aku
+3  A: 

I would recommend JSON ... but since you already mentioned it maybe you should take a look at Google protocol buffers.

Edit: Protocol buffers are made to be used programatically (there are bindings for c++, java, python ...) so they may not be suited for your purpose.

Pat
I've heard about Google protocol buffers but never bother to take a look at them. Did you have any experience with that Google stuff?
aku
No practical experience. We use JSON at work but I had read the docs of Google's protocol buffers a bit and thought they might be worth it whenever JSON won't be suited enough.
Pat
+1  A: 

I think Clearsilver is a very good alternative. They even have a comparison page here and a list of projects that use it

epatel
looks interesting, thanks
aku
+3  A: 

Jeff wrote about this here and here. That should help you get started.

Giovanni Galbo
+1  A: 

You're demands are a bit impossible.. You want something close to XML, but reject probably the closest equivalent that doesn't have angle-bracket (YAML).

As much as I dislike it, why not just use XML? You shouldn't ever have to actually read XML (aside from debugging, I suppose), there are an absurd amount of tools about for it.

Pretty much anything that isn't XML isn't going to be as widely used, thus there will be less tool support.

JSON is probably about equivalent, but it's pretty much equally unreadable.. but again, you shouldn't ever have to actually read it (load it into whatever language you are using, and it should be transformed into native arrays/dicts/variables/whatever).

Oh, I do find JSON far nicer to parse than XML: I've used it in Javascript, and the simplejson Python module - about one command and it's nicely transformed into a native Python dict, or a Javascript object (thus the name!)

dbr
Please read my question carefully. YAML doesn't support attribute at all.
aku
AFAIK, nor does JSON, but your question says that JSON is a valid alternative for your use.
rjmunro
A: 

If you're allergic to angle brackets, then JSON, HDF (ClearSilver), and OGDL are the only ones I know offhand.

After a bit of googling, I also found a list of alternatives here:
http://web.archive.org/web/20060325012720/www.pault.com/xmlalternatives.html

David Crow
A: 

AFAIK, JSON and YAML are exactly equivalent in data structure terms. YAML just has less brackets and quotes and stuff. So I don't see how you are rejecting one and keeping the other.

Also, I don't see how XML's angle brackets are less "human readable" than JSON's square brackets, curly brackets and quotes.

rjmunro
As a person who wrote tons of those brackets, I can say there is a HUGE difference. You you don't know how YAML is different from XML, please read wikipedia articles linked in the question text.
aku
I know how YAML and XML are different. What I don't know is how YAML and JSON are different, except that the former is more human readable, but you reject it, and the latter has square brackets, curly brackets and quotes, and you said it was OK.
rjmunro
+1  A: 

YAML is a 100% superset of JSON, so it doesn't make sense to reject YAML and then consider JSON instead. YAML does everything JSON does, but YAML gives so much more too (like references).

I can't think of anything XML can do that YAML can't, except to validate a document with a DTD, which in my experience has never been worth the overhead. But YAML is so much faster and easier to type and read than XML.

As for attributes or properties, if you think about it, they don't truly "add" anything... it's just a notational shortcut to write something as an attribute of the node instead of putting it in its own child node. But if you like that convenience, you can often emulate it with YAML's inline lists/hashes. Eg:

YAML

Director: name: Spielberg Movies: - Movie: {title: E.T., year: 1975} - Movie: {title: Jaws, year: 1982}

For me, the luxury of not having to write each node tag twice, combined with the freedom from all the angle-bracket litter makes YAML a preferred choice. I also actually like the lack of formal tag attributes, as that always seemed to me like a gray area of XML that needlessly introduced two sets of syntax (both when writing and traversing) for essentially the same concept. YAML does away with that confusion altogether.

Ari