Admittedly, XML isn't the most pleasant syntax to interact with by hand.
The main idea, however, was wonderful. An information exchange format (xml itself), a way to define schemas (xsd), a transformation language (xslt), and stylesheets (xsl?). I kind of miss it.
XSLT and XPath each went on to great solo careers, XSL-FO kind of fizzled when XML+XSL failed to displace HTML+CSS.
There's also XQuery for transformations and XSD/RelaxNG for schemas, the whole combination of XML database, WYSIWYG (via XSLT) XML editor and output transformations is very powerful, every journal we published and every site we ran at the British Medical Journal was generated that way.
A lot of really stupid JavaScript could be done fairly easily with XSLT natively inside a browser engine. An XML document can point to its own XSL(s) so get rendered to the appropriate delivery format or just used directly as data.
No, I'm pretty sure that if they have only used XML syntax as a data rep and not XML-associated tooling like XSD, they are quite aware that when thet say they hate XML they are talking about syntax.
OTOH. I am surprised at the number of people that seem to thing “has a schema language that can be used to specify structure beyond just the basic raw language” distinguishes XML from other data representation languages.
Or, more generally, the way that “if you don’t like XML, maybe your problem is you aren’t using enough of it” has become an edgy contrarian position rather than steretypical establishment enterprise consultant thing it was 15 or so years ago.
JSON has .avro, I thought.
It's all data. Validation logic is sold separately.
JSON, like XML, has several schema languages, which have widely-available libraries for generating host language typings, validation, etc.
> Typing in XML is far richer than in JSON. There’s even a date type!
JSON Type Definition has timestamp, JSON Schema has date, date-time, time, and duration.
{
"$schema": "#/$theSchema",
"$theSchema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "MySchema",
"type": "object",
"properties": {
"productId": {
"description": "The unique identifier for a product",
"type": "integer"
},
"productName": {
"description": "Name of the product",
"type": "string"
},
"price": {
"description": "The price of the product",
"type": "number",
"exclusiveMinimum": 0
}
}
},
"productId": 1,
"productName": "An ice sculpture",
"price": 12.50
}I've seen JSON schemas describe things like date types and plenty more. If you are including schema metadata alongside XML, then for a fair fight you can include JSON schemas, too.
A particularly unusual take is to ignore the difference and allow either attributes or child elements as different ways to do the same thing. This is what XAML does; e.g. this:
<Button Content="Foo" />
is identical to: <Button>
<Button.Content>Foo</Button.Content>
</Button>If data should be presented to the user by a user agent that doesn't understand extensions to the markup, it should be using text nodes.
If it is a modification to a subset of a block of text, such as emphasizing a word, it should be a new element.
If it is a block of semantic metadata, you would structure that as a hierarchy of elements with attributes.
Otherwise, it is usually an attribute on an existing element.
SVG is a bit of a zany format in XML because so much of the content is points or encoded data, which get stuffed in some truly epic attributes.
XML wasn't really made for pure data formats, even though shoehorning that in was the majority of the market's effort.
Using plain tags is so obvious that just about anyone can get it, and in my experience there's no real advantage to using attributes.
At least that's my experience at work, where we use XML as our primary integration format for others that want to deliver data to our system. When going through with a new customer, the few attributes we have almost always cause some kind of issue or misunderstanding.
In the text markup role tags are like functions and the attributes are parameters to the functions. but in the data encoding role the attributes are another redundant key value store and you end up with a confusing mix where some of your kv's are in the tag and some are in the attributes and it is a bit of a mess.
There is a star tag(presumably a list of star tags) each of which contains a single position tag. The star tag is is full of attributes, and the position tag is full of attributes, now you have a complicated(not that complicated, hyperbola is for arguments sake) access method where you need to do different things based on what data you want out of the structure. Why was the position tag not an attribute? What happens when you want to encode the rightAscension, and declination, they will get their own tag, in fact they probably just should have tagged everything in the first place and avoided attributes.
So then:
<star
bayerName="Beta Pictoris"
spectralType="A6V"
mass="1.75"
luminosity="8.7"
rightAscension="05h 47m 17.1s"
declination="−51°03′59″"
distance="63.4ly"
minAge="20My"
maxAge="24My"/>
We are, of course, playing into the article’s second footnote here.(Also: I’m curious why you turned the original document’s ″ (U+2033 DOUBLE PRIME) into " (", U+0022 QUOTATION MARK).)
The tag-content ratio of XML is only as bad as you make it.