Some data formats are easy for humans to read but difficult for computers to efficiently parse. Others, like packed binary data, are dead simple for computers to parse but borderline impossible for a human to read.
XML bucks this trend and bravely proves that data formats do not have to be one or the other by somehow managing to be bad at both.
The thing is, it was never really intended as a storage format for plain data. It's a markup language, so you're supposed to use it for describing complex documents, like it's used in HTML for example. It was just readily available as a library in many programming languages when not much else was, so it got abused for data storage a lot.
That's why professionals use XML or JSON for this kind of projects and SQL for that kind of projects. And sometimes even both. It simply depends on the kind of problem to solve.
Alright, the YAML spec is a dang mess, that I'll grant you, but it seems pretty easy for my human eyes to read and write. As for JSON -- seriously? That's probably the easiest to parse human-readable structured data format there is!
Over time I have matured as a programmer and realize xml is very good to use sometimes, even superior. But I still want layers between me and it. I do output as yaml when I have to see what’s in there
Disagree. I prefer XML for config files where the efficiency of disk size doesn't matter at all. Layers of XML are much easier to read than layers of Json. Json is generally better where efficiency matters.
I was reverse engineeringfucking around with the LBX file format for our Brother label printer's software at work, because I wanted to generate labels programmatically, and they're zipped XML too. Terrible format, LBX, really annoying to work with. The parser in Brother P-Touch Editor is really picky too. A string is 1 character longer or shorter than the length you defined in an attribute earlier in the XML? "I've never seen this file format in my life," says P-Touch Editor.
It’s not a waste of time… it’s a waste of space. But it does allow you to “enforce” some schema. Which, very few people use that way and so, as a data store using JSON works better.
Or… we could go back to old school records where you store structs with certain defined lengths in a file.
You know what? XML isn’t looking so bad now.
If you want to break the AI ask instead what regex you should use to parse HTML.
We slowly need to interface with an app at work that uses fixed-width too. It does not sound that bad if you hear it but it sucks to figure out where you are missing whitespace when most fields are not used and therefore all whitespace. Oh, and of course there are a lot of fields, also are aligned/formatted differently based on their type and has thin/no/wrong documentation. And I have yet to find a simple but decent "debugger".
It's perplexity.ai. I like it because it doesn't require an account and because it can search the internet. It's like microsoft's bing but slightly less cringe.
The answer is not real. The tool, on the other hand, is called Perplexity. It "understands" your question, searches the web, and gives you a summary, citing all the relevant sources.
Maybe I just like the idea of a closing tag being very specific about what it is that is being closed (?). I guess I'm really not sure, but it does feel nicer to my brain to have starting and closing tags and distinguishing between what is structure, what is data, what is inside where.
My peeve with json is that... it doesn't properly distinguish between strings that happen to be a number and "numbers" resulting in:
I actually don't like the attributes in xml, I think it would be better if it was mandatory that they were also just more tagged elements inside the others, and that the "validity" of a piece of xml being a certain object would depend entirely on parsing correctly or not.
I particularly hate the idea of attributes in svg, and even more particularly the way they defined paths.
I don't mind xml as long as I don't have to read or write it. The only real thing I hate about xml is that an array of one object can mistaken for a property of the parent instead of a list
YAML is good for files that have a very flexible structure or need to define a series of steps. Like github workflows or docker-compose files. For traditional config files with a more or less fixed structure, TOML is better I think
XML has its strengths as a markdown format. My own formatted text format ETML is based on XML, as I could recycle old HTML conventions (still has stylesheet as an option), and I can store multiple text blocks in an XML file. It's not something my main choice of human readable format SDL excels at, which itself has its own issues (I'm writing my own extensions/refinements for it by the name XDL, with hexadecimal numbers, ISO dates, etc.).
I hate writing and reading xml compared to json, I don't really care if one is slightly leaner than the other. If your concern is the size or speed you should probably be rethinking how you serialize the data anyway (orotobuff/DB)
I mean we have a generation that thinks XML is bloated & JSON is superior but those two formats are about the same on performance & compressed size--which was the point. The non-plaintext-readable formats are superior along a lot of metrics but harder to debug & ultimately less common.