<parameter>
<name>ApplicationName</name>
<value>WhizBang</value>
</parameter>
...
So that they could pass schema validation and still have some hope of extensibility. <parameter>
<name>ApplicationName</name>
<value>WhizBang</value>
</parameter>
...
So that they could pass schema validation and still have some hope of extensibility.In the same way, if we receive a data transfer in XML and there is a schema, simple validation catches a lot of problems quickly. You'd be surprised how many times a company gives you a schema and then sends you xml which doesn't validate. In JSON, you have to write a program to get even basic validation.
Don't get me wrong: XML has problems, some inherited from html/sgml (entities!), and even more after serious abuse by consultants, archicture astronauts and enterprise vendors (SOAP! namespace overuse! 10 XML parsers in 1 app!). But it was also miles better than what came before and I feel the XML hatred pendulum has swung too far.
Today, JSON is in vogue, and I've seen enough IT to not swim against the tide. It is a reasonable solution for problems caused by XML abuse. Besides, there is value in going with the majority,even if it only fixes 80% of your problem. But I can only weep for the miserable date, numeric and comment support, and their endless stream of incompatible workarounds.
For your parameter example: You can't both strictly validate and have full freedom at the same time. Something has to give a bit. Some less horrible alternatives I've seen:
<parameter name="X" value="Y"/>
<subsystem name1="value1" name2=value2 ... /> , add newline for each attribute
<name>value</name>Edit: XML is just a proper subset of SGML by definition, hence it didn't introduce a single thing that wasn't there before. It only introduced XML-style empty elements and DTD-less markup, and SGML was extended in lockstep with XML to support these as well
XML is more than the part inherited from SGML, it's also the XML culture surrounding it. Namespaces are an example of something that created an XML dialect. And of course SOAP, which actually needs the WS-I standard to explain what parts of the WS-* standards to use or ignore, and how to interprete them. And even then 2 WS-I stacks will rarely interop without trouble. Lets not blame SGML for that monstrosity
<a:log /><b:log /><c:log />
can mean a math function, a text file that records what's happening, and a cut-off trunk of a tree and there will be no confusion whatsoever.(I really don't get how SOAP is relevant here.)
<element name="addressBook">
<zeroOrMore>
<element name="card">
<attribute name="name">
<text/>
</attribute>
<attribute name="email">
<text/>
</attribute>
</element>
</zeroOrMore>
</element>
http://www.relaxng.org/tutorial-20011203.htmlPlus there's a non-XML "compressed" version as well:
element addressBook {
element card {
element name { text },
element email { text }
}+
}
But I agree that XML like you posted is nasty, it's no harder to write <parameter name="ApplicationName">WhizBang</parameter>
instead if you need generic parameters, or <ApplicationName>WhizBang</ApplicationName>
if not.<parameter name="ApplicationName" value="WhizBang"/> ?
Your option is better, but XML is very (maybe too) flexible and is bound to be made a mess of.
ApplicationName=WhizBang