<p>XML, granted, is very useful, but can be quite verbose. What alternatives are there and are they specialised for any particular purpose? Library support to interrogate the contents easily is a big plus point.</p>

[{'answer_id': 44210, 'author': 'spoulson', 'author_id': 3347, 'author_profile': 'https://Stackoverflow.com/users/3347', 'pm_score': 4, 'selected': False, 'text': '<p>There seems to be a lot of multi-platform support for <a href="http://www.json.org/" rel="noreferrer">JSON</a>.</p>\n'}, {'answer_id': 44213, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 2, 'selected': False, 'text': "<p>S-Expressions work great if you don't need to apply attributes to elements. Another alternative is YAML.</p>\n"}, {'answer_id': 44214, 'author': 'Mark Biek', 'author_id': 305, 'author_profile': 'https://Stackoverflow.com/users/305', 'pm_score': 3, 'selected': False, 'text': '<p>Don\'t forget about <a href="http://www.yaml.org/" rel="nofollow noreferrer">YAML</a>!</p>\n\n<p>JSON seems to have better support though.  For example, the <a href="http://www.prototypejs.org/" rel="nofollow noreferrer">Prototype JS</a> library has excellent built-in JSON functions.</p>\n'}, {'answer_id': 44239, 'author': 'harpo', 'author_id': 4525, 'author_profile': 'https://Stackoverflow.com/users/4525', 'pm_score': 4, 'selected': False, 'text': '<p>Jeff\'s article on <a href="http://www.codinghorror.com/blog/archives/001114.html" rel="nofollow noreferrer">The Angle Bracket Tax</a> summarizes a number of alternatives (well, mainly YAML), and led me to the <a href="http://en.wikipedia.org/wiki/Lightweight_markup_language" rel="nofollow noreferrer">wiki article on lightweight markup languages</a>.</p>\n\n<p><strong>Update:</strong> Although YAML is a possible "alternative to XML" for some applications, the two are not, as I first thought, isomorphic.</p>\n\n<p>Indeed, it "ain\'t markup language."</p>\n\n<p>Furthermore, YAML ain\'t as "lightweight" as it appears.  For documents that can be represented in plain XML (such as Jeff\'s example), YAML is clearly less verbose.  But YAML offers many other specialized structures, enlisting many more characters and sequences than are reserved by XML.</p>\n\n<p>Bottom line, if you\'re looking for XML-without-angle-brackets, YAML ain\'t it.</p>\n'}, {'answer_id': 44242, 'author': 'Thomas Owens', 'author_id': 572, 'author_profile': 'https://Stackoverflow.com/users/572', 'pm_score': 3, 'selected': False, 'text': "<p>I wouldn't dismiss plain text, like CSV or tab-delimited.</p>\n"}, {'answer_id': 44246, 'author': 'Aranazo', 'author_id': 4532, 'author_profile': 'https://Stackoverflow.com/users/4532', 'pm_score': 1, 'selected': False, 'text': '<p>For the sake of completeness I will mention <a href="http://en.wikipedia.org/wiki/EDIFACT" rel="nofollow noreferrer">Edifact</a> for which I wrote an interface a long time ago.</p>\n'}, {'answer_id': 44465, 'author': 'Adam Lassek', 'author_id': 1249, 'author_profile': 'https://Stackoverflow.com/users/1249', 'pm_score': 1, 'selected': False, 'text': '<p><a href="https://web.archive.org/web/20090722021941/http://redhanded.hobix.com/inspect/yamlIsJson.html" rel="nofollow noreferrer">JSON is valid YAML</a> which could be very useful. Two for one!</p>\n'}, {'answer_id': 44528, 'author': 'Simon Steele', 'author_id': 4591, 'author_profile': 'https://Stackoverflow.com/users/4591', 'pm_score': 2, 'selected': False, 'text': '<p>XML is often used for configuration, and in this case there are some other simple storage formats that are often used (less document oriented):</p>\n\n<ol>\n<li><a href="http://en.wikipedia.org/wiki/.properties" rel="nofollow noreferrer">.property files</a></li>\n<li><a href="http://en.wikipedia.org/wiki/INI_file" rel="nofollow noreferrer">INI files</a></li>\n</ol>\n\n<p>There\'s various ways for reading and writing both, depending on platform and language.</p>\n'}, {'answer_id': 44591, 'author': 'Justin R.', 'author_id': 4593, 'author_profile': 'https://Stackoverflow.com/users/4593', 'pm_score': 2, 'selected': False, 'text': '<p>What do you want to do with the data? Store it? Pass it around? Display it? These questions should drive your search for an appropriate technology. Simply asking how you should format your data is like asking what language you should program in, without specifying what you want to accomplish. </p>\n\n<p>For most data tasks, well Dr. Codd has the cure: <a href="http://en.wikipedia.org/wiki/Edgar_F._Codd" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Edgar_F._Codd</a>. Databases should be able to do just about anything you have in mind.</p>\n\n<p>If you\'re passing it around, I advocate plain text. When you roll your own binary format your data goes away when your parser goes away. </p>\n\n<p>With plain text, the deeper question is where to put the metadata. Should it be external to the data file, or internal ("self-describing"). </p>\n\n<p>For example, XML is plain text, but so is source code. With a source file, there is a specification that goes in to great detail as to the syntax and semantics, while XML is <em>supposed</em> to be self-describing. The problem is that it isn\'t. Furthermore it evolved right out of document presentation and markup, but is now being abused for all sorts of data serialization, transfer, and storage.</p>\n'}, {'answer_id': 44751, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p>If you\'re asking in the perspective of a DSL, <a href="http://www.gnu.org/software/guile/guile.html" rel="nofollow noreferrer">Guile Scheme</a> could help, as already suggested with the S-expressions.</p>\n\n<p>Personally I also use JSON for AJAX transactions.</p>\n'}, {'answer_id': 52545, 'author': 'Timothy Carter', 'author_id': 4660, 'author_profile': 'https://Stackoverflow.com/users/4660', 'pm_score': 2, 'selected': False, 'text': '<p><a href="http://www.hdfgroup.com/" rel="nofollow noreferrer">HDF5</a> is a very compact data format with some characteristics that are similar to xml.  The .net libraries leave a lot to be desired, but the format scales very well both in terms of size and performance.</p>\n'}, {'answer_id': 53689, 'author': 'Nick', 'author_id': 3233, 'author_profile': 'https://Stackoverflow.com/users/3233', 'pm_score': 1, 'selected': False, 'text': '<blockquote>\n  <p>I wouldn\'t dismiss plain text, like CSV or tab-delimited.</p>\n</blockquote>\n\n<p>I\'m really looking for alternatives that have a defined structure and (cross platform, multi language) library support. I\'m interested in looking at different designs and their pros and cons. I like the idea of formats that can have a text and "binary" (compact, "compiled", fast I/O, smaller footprint) format. The advantage of having libraries is that they perform the parsing and perhaps extra data manipulation/validation for you.</p>\n\n<p>Although having said that, there is definitely a use for simple formats like .ini, .plist and CSV etc. You shouldn\'t always have to use a hammer to crack a nut.</p>\n'}, {'answer_id': 280407, 'author': 'annakata', 'author_id': 13018, 'author_profile': 'https://Stackoverflow.com/users/13018', 'pm_score': 1, 'selected': False, 'text': "<p>But at what cost?</p>\n\n<p>I'm all for JSON in many situations, especially where weight or client-side work is a concern, but moving away from XML loses readability (so important in those config files) and the power of tomorrow's problem solutions like XSLT and XPath. Be really sure why and when you move away: it's a de facto standard for a reason.</p>\n\n<p>(aside: my habit is to use XML internally, and transform that to JSON where that's the desired output)</p>\n"}, {'answer_id': 281251, 'author': 'ChuckB', 'author_id': 28605, 'author_profile': 'https://Stackoverflow.com/users/28605', 'pm_score': 2, 'selected': False, 'text': "<p>My work with XML is almost exclusively with document-centric XML, which must model long sequences of arbitrarily nested structures.  I haven't used JSON yet, but my impression is that it is cumbersome to use with document-like data, but well-adapted and even elegant for use with record-like data.  Consider the shape of your data when making your decision.</p>\n"}, {'answer_id': 281331, 'author': 'Robert Gould', 'author_id': 15124, 'author_profile': 'https://Stackoverflow.com/users/15124', 'pm_score': 1, 'selected': False, 'text': '<p>Heresy! XML is king of data.\nSay no to the usurpers, off with their heads!\nLong live XML!</p>\n\n<p>But seriously if just need data use Json, for support and elegance, but if you need formating ,xpath like queries, additional metadata, etc... Stick with XML</p>\n\n<p>Note: I use Xml for configs system building code generation and similar tasks, but Json for Rpc,Sql for queries and persistency, and finally Yaml here and there for logging and quick tasks, in other words choose the appriopiate format for the need.</p>\n'}, {'answer_id': 288622, 'author': 'paperhorse', 'author_id': 4498, 'author_profile': 'https://Stackoverflow.com/users/4498', 'pm_score': 2, 'selected': False, 'text': '<p>You could try google\'s <a href="http://code.google.com/p/protobuf/" rel="nofollow noreferrer">protobufs</a>. It\'s much faster than XML. There are libraries for it in C, C++, C#, Java and Python (there are alpha versons for ruby and perl). But it is binary.</p>\n'}, {'answer_id': 4361828, 'author': 'Eduardo', 'author_id': 229414, 'author_profile': 'https://Stackoverflow.com/users/229414', 'pm_score': 0, 'selected': False, 'text': '<p>XML is OK for text markup, but for general structures serialization is a quite bad option, where JSON is much more suited.</p>\n'}, {'answer_id': 4750646, 'author': 'David Gelhar', 'author_id': 275737, 'author_profile': 'https://Stackoverflow.com/users/275737', 'pm_score': 0, 'selected': False, 'text': "<p>Anything you like, as long as it's not ASN.1</p>\n"}, {'answer_id': 5643385, 'author': 'Todd Stout', 'author_id': 59768, 'author_profile': 'https://Stackoverflow.com/users/59768', 'pm_score': 1, 'selected': False, 'text': '<p><a href="http://sdl.ikayzo.org/display/SDL/Home" rel="nofollow">Simple Declarative Language</a> is a nice alternative to XML for common tasks such as serialization and configuration.  It provides a C# and Java parser library.  I think it excels at specifying all kinds of metadata without the XML verbosity. </p>\n'}, {'answer_id': 10359535, 'author': 'Davek804', 'author_id': 1231943, 'author_profile': 'https://Stackoverflow.com/users/1231943', 'pm_score': 0, 'selected': False, 'text': "<p>JSON can be used in many ways, but it is particularly well suited to use with MySQL tables I find. It works very well with Android as well (GSON library or JSON). Beyond that, it's effective at transmitting small bits of data individually or as arrays.</p>\n"}, {'answer_id': 20363397, 'author': 'Qwertie', 'author_id': 22820, 'author_profile': 'https://Stackoverflow.com/users/22820', 'pm_score': 0, 'selected': False, 'text': '<p>For storing code-like data, <a href="http://sourceforge.net/apps/mediawiki/loyc/index.php?title=LES" rel="nofollow">LES</a> (Loyc Expression Syntax) is a budding alternative. I\'ve noticed a lot of people use XML for code-like constructs, such as build systems which support conditionals, command invocations, sometimes even loops. These sorts of things look natural in LES:</p>\n\n<pre><code>// LES code has no built-in meaning. This just shows what it looks like.\n[DelayedWrite] // an "attribute"\nOutput(\n    if version &gt; 4.0 {\n        $ProjectDir/Src/Foo;\n    } else {\n        $ProjectDir/Foo;\n    }\n);\n</code></pre>\n\n<p>It doesn\'t have great tool support yet, though; currently the only LES library is for C#. Currently only one app is known to use LES: <a href="http://www.codeproject.com/Articles/664785/A-New-Parser-Generator-for-Csharp" rel="nofollow">LLLPG</a>.</p>\n\n<p>In theory you could use LES for data or markup, but there are no standards for how to do that:</p>\n\n<pre><code>body {\n    \'\'\'Click here to use the World\'s \'\'\'\n    a href="http://google.com" {\n        strong "most popular"; " search engine!"\n    };\n};\n\npoint = (2, -3);\ntasteMap = { "lemon" -&gt; sour; "sugar" -&gt; sweet; "grape" -&gt; yummy };\n</code></pre>\n'}, {'answer_id': 22239825, 'author': 'B Robster', 'author_id': 652693, 'author_profile': 'https://Stackoverflow.com/users/652693', 'pm_score': 2, 'selected': False, 'text': '<p><a href="https://github.com/mojombo/toml" rel="nofollow">TOML</a> is the new big thing. It has the niceness of YAML without the big spec. It extends a common and familiar configuration file format. It is directly analogous to (and translatable to) JSON. Has support in all the big languages.  Created by Github co-founder/president Tom and narcissistically named. Its awesome. Give it a shot!</p>\n\n<p>Sample TOML:</p>\n\n<pre><code># This is a TOML document. Boom.\n\ntitle = "TOML Example"\n\n[owner]\nname = "Tom Preston-Werner"\norganization = "GitHub"\nbio = "GitHub Cofounder &amp; CEO\\nLikes tater tots and beer."\ndob = 1979-05-27T07:32:00Z # First class dates? Why not?\n\n[database]\nserver = "192.168.1.1"\nports = [ 8001, 8001, 8002 ]\nconnection_max = 5000\nenabled = true\n\n[servers]\n\n  # You can indent as you please. Tabs or spaces. TOML don\'t care.\n  [servers.alpha]\n  ip = "10.0.0.1"\n  dc = "eqdc10"\n\n  [servers.beta]\n  ip = "10.0.0.2"\n  dc = "eqdc10"\n\n[clients]\ndata = [ ["gamma", "delta"], [1, 2] ]\n\n# Line breaks are OK when inside arrays\nhosts = [\n  "alpha",\n  "omega"\n]\n</code></pre>\n'}, {'answer_id': 27487206, 'author': 'igagis', 'author_id': 1221106, 'author_profile': 'https://Stackoverflow.com/users/1221106', 'pm_score': 0, 'selected': False, 'text': '<p>For the sake of mentioning... have a look at my proposal:</p>\n\n<p><a href="http://igagis.github.io/stob/" rel="nofollow noreferrer">http://igagis.github.io/stob/</a></p>\n\n<p>It is very simple and is not overloadad with variety of special symbols, just {} and "" basically.</p>\n\n<p>Supports C++ style comments.</p>\n\n<p>There are C++, C# and Java libraries.</p>\n\n<p>Example:</p>\n\n<pre><code>"String object"\nAnotherStringObject\n"String with children"{\n    "child 1"\n    Child2\n    "child three"{\n        SubChild1\n        "Subchild two"\n\n        Property1 {Value1}\n        "Property two" {"Value 2"}\n        //comment\n\n        /* multi-line\n           comment */\n\n        "multi-line\n         string"\n\n        "Escape sequences \\" \\n \\r \\t \\\\"\n    }\n}\n</code></pre>\n'}, {'answer_id': 29946862, 'author': 'intellimath', 'author_id': 4743644, 'author_profile': 'https://Stackoverflow.com/users/4743644', 'pm_score': 2, 'selected': False, 'text': '<p>If someone looking up less verbose alternative to XML, which is more or less isomorphic to XML, then there is <a href="http://intellimath.bitbucket.org/axon" rel="nofollow">AXON</a>. In order to explain consider examples of equivalent representations in both XML and AXON. There is also python library <a href="http://pypi.python.org/pypi/pyaxon" rel="nofollow">pyaxon</a> that support AXON format.</p>\n\n<p>XML</p>\n\n<pre><code>&lt;person&gt;\n   &lt;name&gt;Alex&lt;/name&gt;\n   &lt;age&gt;34&lt;/age&gt;\n   &lt;email&gt;mail@example.com&lt;/email&gt;\n&lt;/person&gt;\n</code></pre>\n\n<p>AXON</p>\n\n<pre><code>person {\n  name {"Alex"}\n  age {34}\n  email {"mail@example.com"}}\n</code></pre>\n\n<p>XML</p>\n\n<pre><code>&lt;memo date="2008-02-14"&gt;\n&lt;from&gt;\n&lt;name&gt;The Whole World&lt;/name&gt;&lt;email&gt;us@world.org&lt;/email&gt;\n&lt;/from&gt;\n&lt;to&gt;\n&lt;name&gt;Dawg&lt;/name&gt;&lt;email&gt;dawg158@aol.com&lt;/email&gt;\n&lt;/to&gt;\n&lt;message&gt;\nDear sir, you won the internet. http://is.gd/fh0\n&lt;/message&gt;\n&lt;/memo&gt;\n</code></pre>\n\n<p>AXON</p>\n\n<pre><code>memo {\n  date:2008-02-14\n  from {\n    name{"The Whole World"} email{"us@world.org"}}\n  to {\n    name{"Dawg"} email{"dawg158@aol.com"}}\n  message {"Dear sir, you won the internet. http://is.gd/fh0"}\n}\n</code></pre>\n\n<p>XML</p>\n\n<pre><code>&lt;club&gt;\n  &lt;players&gt;\n    &lt;player id="kramnik"\n       name="Vladimir Kramnik"\n       rating="2700"\n       status="GM" /&gt;\n    &lt;player id="fritz"\n       name="Deep Fritz"\n       rating="2700"\n       status="Computer" /&gt;\n    &lt;player id="mertz"\n      name="David Mertz"\n      rating="1400"\n      status="Amateur" /&gt;\n  &lt;/players&gt;\n  &lt;matches&gt;\n    &lt;match&gt;\n      &lt;Date&gt;2002-10-04&lt;/Date&gt;\n      &lt;White refid="fritz" /&gt;\n      &lt;Black refid="kramnik" /&gt;\n      &lt;Result&gt;Draw&lt;/Result&gt;\n    &lt;/match&gt;\n    &lt;match&gt;\n      &lt;Date&gt;2002-10-06&lt;/Date&gt;\n      &lt;White refid="kramnik" /&gt;\n      &lt;Black refid="fritz" /&gt;\n      &lt;Result&gt;White&lt;/Result&gt;\n    &lt;/match&gt;\n  &lt;/matches&gt;\n&lt;/club&gt;\n</code></pre>\n\n<p>AXON</p>\n\n<pre><code>club {\n  players {\n    player {\n      id:"kramnik"\n      name:"Vladimir Kramnik"\n      rating:2700\n      status:"GM"}\n    player {\n      id:"fritz"\n      name:"Deep Fritz"\n      rating:2700\n      status:"Computer"}\n    player {\n      id:"mertz"\n      name:"David Mertz"\n      rating:1400 \n      status:"Amateur"}}\n  matches {\n    match {\n     Date{2002-10-04}\n     White{refid:"fritz"}\n     Black{refid:"kramnik"}\n     Result{"Draw"}}\n    match {\n      Date{2002-10-06}\n      White{refid:"kramnik"}\n      Black{refid:"fritz"}\n      Result{"White"}}}}\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/44207', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3233/']