|
I use XML as a data transport format, but I don't serialize objects. I parse the data I want to transport into XML and parse it back on the other end.
|
|
|
|
|
XML can be great, but there is more to know about it than most people realize (namespaces for instance). There is a reason why .NET Core switched back from JSON to XML for projects descriptions...
When done well I think it can be close to the sweet spot between human and machine readability (if you need that). It has comments, and can natively handle many data types that JSON cannot (like dates). If bandwidth is you primary concern then perhaps you should consider binary serialization?
When done bad you get almost any of the OGC Standards[^]...
The best thing about JSON is its tight integration with Javascript, which is a nice feature (and why it "won" the web).
Mathieu Cartoixa
|
|
|
|
|
I have used both XML and JSON over the years.
XML has full and proper support for XSD and great XSL. It also allows really tight security for messaging. Not had the same tightly secure messaging experience with JSON can not completely judge this! Is the a standard for doing it - I don't know.
XML appears to me to be much better able to be validated.
JSON is very quick JSON Schema seem to be quite good but not as tight as XML.
In the world where I used XML with the full security packages around the payloads (of XML) there was signing and encryption - the way to work was to peel the layers of the onion away slowly gaining greater trust as you proceeded into the payload. This works very well for confidential business messaging.
I do enjoy the simplicity of JSON but is it too simple?
|
|
|
|
|
Comma delimited data is just so much easier without all the fuss. It is also more efficient...
Steve Naidamast
Sr. Software Engineer
Black Falcon Software, Inc.
blackfalconsoftware@outlook.com
|
|
|
|
|
For some kinds of very simple data, some dialect of CSV may be ok. But in 3 decades of software development I've rarely found it it be an adequate solution, much less the optimal one.
|
|
|
|
|
I retired after 4 decades in software engineering in 2014.
Though I used XML extensively during my career, I found it more of a nuisance than anything else. XML and JSON merely serve to add layers of software to handle the formats, making them both rather inefficient. And both are text-based.
Similarly comma-delimited data is text based as well without all of the extra meta-data and when encrypted would produce smaller files or data-packets for transmission.
For most situations, one can use comma-delimited data in the same ways as XML with a little ingenuity and without all the extra meta-data.
Steve Naidamast
Sr. Software Engineer
Black Falcon Software, Inc.
blackfalconsoftware@outlook.com
|
|
|
|
|
Well, the metadata is something I find incredibly useful, and this is also why I tend to prefer XML over JSON as well when I need a robust way to transfer data of more than trivial complexity.
|
|
|
|
|
I use it all the time, but I also always describe my message formats in XSD. That is the easiest way to get the code generators on all platforms to properly parse one’s messages.
|
|
|
|
|
Chris Maunder wrote: as something that is not seen or edited by humans
I could've sworn when I first started reading about XML, it was being sold based on the idea that it was trivially easy for people to read and write.
|
|
|
|
|
Ah, marketing...
cheers
Chris Maunder
|
|
|
|
|
Chris Maunder wrote: Ah AAARGH! marketing...
FTFY.
|
|
|
|
|
My favorite part is when the schema doesn't work.
XML - Another solution in search of a problem.
|
|
|
|
|
My professor said that XML exists because Microsoft was afraid of being sued because JSON was to much like Java. Kid of like the same reason that C# exists. I think he was being sarcastic but am not totally sure. He did show that history of the two and which came first is debatable. Both have roots that run back a long, long time ago.
So many years of programming I have forgotten more languages than I know.
|
|
|
|
|
Every big company is afraid of being sued, but I doubt that's the reason. Microsoft would more likely choose a competing solution in order to lock out a competitor. The story doesn't seem "right" but who knows.
The Microsoft of today is a very, very different company than the Microsoft of 2000. (and it makes them better and worse)
cheers
Chris Maunder
|
|
|
|
|
michaelbarb wrote: My professor said that XML exists because Microsoft was afraid of being sued because JSON was to much like Java
This doesn't hold up, even if only because it seems backwards. If Wikipedia's accurate, work on XML started in 1996, and became a "W3C recommendation" in 1998, while JSON only started showing up in the "early 2000s" (granted, with some references to work starting in 1999 - but it was still very early in its design by then).
And how is JSON in any way "like Java"? One's a data storage file format. The other's a full-blown programming language.
|
|
|
|
|
As one of our exercises working in Java we were to take a Json file and convert it to routine that could be compiled in the program. It was to contain data that the program loaded. As I remember from the early 20's it was quite easy.
So many years of programming I have forgotten more languages than I know.
|
|
|
|
|
michaelbarb wrote: My professor said that XML exists because Microsoft was afraid of being sued because JSON was to much like Java. Then your professor, by "XML exists", presumably meant "XML did not die" rather than "XML was created".
XML predates the first JSON RFC by ten years. And, XML was in use for several years before it was formally standardized.
I really do not see how Microsoft gets into this. MS certainly neither defined XML nor JSON. I never saw Microsoft as a very active promoter of XML. C# was created by MS. I am not (yet) able to find on the net any documentation of the MS/Sun controversy, but twenty years ago "everybody knew" that C# was a response to Sun not allowing MS to use Java as it wanted. (If my memory is correct, MS wanted to add language features that Sun did not approve of.) So C# is a very different story from XML/Json.
XML syntax borrows a lot from far older formats: Typesetting systems of the late 70s (maybe even older) used the same style bracketed keywords, e.g. to delimit paragraphs and specify paragraph formatting. You can see a selection of such tags e.g. in the 1982 Historical Manuals: Guide to Typesetting at the UKCC[^], at page 14-15.
In the typesetting systems I ever touched, the brackets were displayed as common brackets, but had a different internal representation, and distinct keys on the dedicated terminals. So there was no need for escaping or other special handling of the common brackets (or math smaller/greater than).
|
|
|
|
|
I always hated working with XML. JSON is a god send. I had to serialize from JSON to XML for a file upload. It was mandated that way.. not my choice. Anyway I now have an XML Serializer that is stupid simple to use.
Keep It Simple, keep it moving.
|
|
|
|
|
Xml wasn't originally written for web service data transfer or serialization/deserialization. It was written by the W3c to replace Html but still be Html-like. Xml is a Mark-up language, hence it has mark-up. Mark-up makes it good for readability by humans but also a standard readable by machines. Xml was then hi-jacked to be used by SOAP web services with serialization/deserialization. Then someone realized that json was better for serialization/deserialization, especially since readability by both humans and machines wasn't necessary, it only needs to be read by machines. JSON also has room for improvement in verbosity and as soon as a good replacement exists, people will say the same things: why json when new-thing is better.
|
|
|
|
|
That brought back XHTML nightmares...
cheers
Chris Maunder
|
|
|
|
|
I've had to generate a file from a database, but the built-in methods didn't work for me, so I also just constructed it all by adding to a string.
|
|
|
|
|
Hungary's National Tax and Customs Agency requires real-time XML invoice reporting[^] , so we do it.
It requires the schema designer to know his/her art, because xsd.exe[^] can choke on
<thing> and
<otherthing>
<thing> type brainless design.
Other pain was that while the XML standard is happy with a default namespace, XPath requires a prefix[^].
|
|
|
|
|
Do you remember what we had before XML? Talk about misery!
When I joined here, I was working at an Ace Hardware, and trying to get our in house system to integrate with the Ace Corporate online ordering system (no Internet then, direct dialup connection) required the patience of Job, along with a love of self abuse. I'm still grateful for XML!
Will Rogers never met me.
|
|
|
|
|
Roger Wright wrote: Do you remember what we had before XML? Well ... What if I do?
I was studying ASN.1 in the very early 1980s. The scheme is mandatory; the legal constructions are always specified. Great!
It is abstract: ASN.1 specifies the logical structure of files/documents, with no concern for a specific representation or format. Great!
An ASN.1 document/file may be represented in a handful well specified, clearly identified concrete encodings - functionally 100% identical; you may read in one encoding and write back in another encoding, with no loss of information. Great!
You must have access to the scheme, which ensures a proper interpretation with no guesswork. You know what you get. Great!
A data stream not adhering to the scheme is like a transmission ruined by noise: It is worth nothing. Any non-ruined document honors the ADN.1 scheme. Unconditionally. Great!
The 'Tag' part is binary. You display it to the user e.g. by mapping it to local language terms (Since you must have access to the scheme, you have an opportunity to set up a meaningful mapping) - I worked with a handful applications providing mappings of tags to several different languages. Great!
The representation essentially being binary required the use of an ASN.1 data editor - vi wouldn't suffice. As a result, you never forgot to add the closing tag (there was no closing tag). Great!
You never misspelled a tag name, but selected from those allowed by the scheme. Great!
You never got the length wrong - that was handled by the ASN.1 editor and concrete coder. Great!
The format was space efficient (although dependent on the encoding), BER excessively so, according to some critics. (Some other concrete encodings, such as the XML encoding, could be quite wasteful, though.) Great!
The 'Value' part was completely unrestricted, a binary blob, with no need for escapes, quoting or anything resembling 'character entities'. (Or Base64, QP, AtoB/BtoA, BinHex, UUencode, or whathaveyou.) Great!
If you wanted to edit an ASN.1 document, you had to use an ASN.1 editor that made sure that the scheme was honored; the document couldn't be arbitrarily tampered with outside scheme control. Great!
I sure miss both the abstract ASN.1 side, and the BER encoding.
|
|
|
|
|
IDKW people are bad-mouthing XML OR barking that JSON is the magic carpet of serialization. XML was an attempt by some fairly smart people (smarter than me) to make a standardized, text-based, human-readable serialize standard. Is it 'easily' human-readable? Most but not all the time, still useful. Can you just open it in a text editor and read it? Yes, didn't say you'd enjoy the experience but you could, can, and do. Is it a good standard? Well, people are still using it, today, it works, and 'works' gives programmers and interested parties (those with the money) this warm fuzzy feeling inside.
And consider this, you can make some REALLY simple XML, read, serialize, transmit it, and you can make some seriously complex XML, read, serialize, and transmit that. Things you couldn't imagine serializing in JSON. That's what the X stands for Extensible. Nevertheless, just like someone else said on this post, EVERYONE IS USING XML EVERY DAY, it's called the internet, it's called HTML which, really deep down, is XML that transmits some of the greatest amounts of information around the world billions and billions of times over, and it just works, not perfect, but it does.
|
|
|
|
|