There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

programmerhumor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

toastal , in AI's take on XML

Balisage Paper: Fat Markup: Trimming the Fat Markup Myth one calorie at a time

www.balisage.net/…/BalisageVol10-Lee01.html

XML is a fine format in comparison to JSON.

Takumidesh ,

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)

toastal , (edited )

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.

LittleWizard , in AI's take on XML

I hate writing xml with a passion

Knock_Knock_Lemmy_In ,

If you are writing it then you are doing it wrong.

MoogleMaestro ,

I hate writing a serialized format

I mean, that’s why it’s serialized. It’s not supposed to be written by hand, that’s why you have a deserializer. 🤦

smeenz ,

What about writing in xml without any passion ?

Dirk ,
@Dirk@lemmy.ml avatar

This is fine.

it_depends_man , in AI's take on XML

It is very cool, specifically as a human readable mark down / data format.

The fact that you can make anything a tag and it’s going to be valid and you can nest stuff, is amazing.

But with a niche use case.

Clearly the tags waste space if you’re actually saving them all the time.

Good format to compress though…

ByteJunk ,
@ByteJunk@lemmy.world avatar

I disagree, with a passion.

It is soooo cluttered, so much useless redundant tags everywhere. Just give JSON or YAML or anything really but XML…

But to each their own i guess.

it_depends_man ,

YAML

To each their own indeed.

;)

Gremour ,

YAML for human-written files, JSON for back-to-front and protobuf for back-to-back. XML is an abomination.

renzev OP ,

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

it_depends_man ,

Having an easy on the eyes markdown that is also easy to parse would be cool.

But YAML does these things:

ruudvanasseldonk.com/…/the-yaml-document-from-hel…

which are not excusable, for any reason.

olafurp ,

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

CanadaPlus ,

I think we did a thread about XML before, but I have more questions. What exactly do you mean by “anything can be a tag”?

It seems to me that this:


<span style="color:#323232;"><address>
</span><span style="color:#323232;">    <street_address>21 2nd Street</street_address>
</span><span style="color:#323232;">    <city>New York</city> 
</span><span style="color:#323232;">    <state>NY</state>
</span><span style="color:#323232;">    <postal_code>10021-3100</postal_code>
</span><span style="color:#323232;"></address>
</span>

Is pretty much the same as this:


<span style="color:#323232;">  "address": {
</span><span style="color:#323232;">    "street_address": "21 2nd Street",
</span><span style="color:#323232;">    "city": "New York",
</span><span style="color:#323232;">    "state": "NY",
</span><span style="color:#323232;">    "postal_code": "10021-3100"
</span><span style="color:#323232;">  },
</span>

If it branches really quickly the XML style is easier to mentally scope than brackets, though, I’ll give it that.

ClassifiedPancake , (edited )

Since XML can have attributes and children, it’s not as easy to convert to JSON.

Your JSON example is more akin to:


<span style="color:#323232;"><</span><span style="color:#63a35c;">address </span><span style="color:#795da3;">street_address</span><span style="color:#323232;">=</span><span style="color:#183691;">"21 2nd Street" </span><span style="color:#795da3;">city</span><span style="color:#323232;">=</span><span style="color:#183691;">"New York"</span><span style="color:#323232;"> ...></</span><span style="color:#63a35c;">address</span><span style="color:#323232;">>
</span>
CanadaPlus , (edited )

Hmm, so in tree terms, each node has two distinct types of children, only one of which can have their own children. That sounds more ambiguity-introducing than helpful to me, but that’s just a matter of taste. Can you do lists in XML as well?

ClassifiedPancake ,

No arrays are not allowed. Attributes can only be strings. But the children are kind of an array.

it_depends_man , (edited )

I’m not sure now that I think about it, but I find this more explicit and somehow more free than json. Which can’t be true, since you can just


<span style="color:#323232;">{"anything you want":{...}}
</span>

But still, this:


<span style="color:#323232;"><my_custom_tag>
</span><span style="color:#323232;"><this> 
</span><span style="color:#323232;"><that>
</span><span style="color:#323232;"><roflmao>
</span><span style="color:#323232;">...
</span>

is all valid.

You can more closely approximate the logical structure of whatever you’re doing without leaving the internal logic of the… syntax?


<span style="color:#323232;"><car>
</span><span style="color:#323232;"><tyre> air, <valve>closed</valve>  </tyre>
</span><span style="color:#323232;"><tyre> air, <valve>closed</valve>  </tyre>
</span><span style="color:#323232;"><tyre>      <valve>open</valve>  </tyre>
</span><span style="color:#323232;"><tyre> air, <valve>closed</valve>  </tyre>
</span><span style="color:#323232;"></car>
</span>

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:


<span style="color:#323232;">myinput = {"1":"Hello",1:"Hello"}
</span><span style="color:#323232;">tempjson = json.dumps(myinput)
</span><span style="color:#323232;">output = json.loads(tempjson)
</span><span style="color:#323232;">print(output)
</span><span style="color:#323232;">>>>{'1': 'Hello'}
</span>

in python.

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.

developer.mozilla.org/en-US/docs/Web/SVG/…/Paths#…

It works, but I consider that truly ugly. And also I don’t understand because it would have been trivial to do something like this:


<span style="color:#323232;"><path><element>data</element><element>data</element></path>
</span>
CanadaPlus , (edited )

Maybe I just like the idea of a closing tag being very specific about what it is that is being closed (?).

That’s kind of what I was getting at with the mental scoping.

My peeve with json is that… it doesn’t properly distinguish between strings that happen to be a number and “numbers"

Is that implementation-specific, or did they bake JavaScript type awfulness into the standard? Or are numbers even supported - it’s all binary at the machine level, so I could see an argument that every (tree) node value should be a string, and actual types should be left to higher levels of abstraction.

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 agree. The latter isn’t even a matter of taste, they’re just implementing their own homebrew syntax inside an attribute, circumventing the actual format, WTF.

ZILtoid1991 , in AI's take on XML

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.).

umbrella , in AI's take on XML
@umbrella@lemmy.ml avatar

finally accurate ai

RunningInRVA ,

Except for obvious typos

whoisearth ,
@whoisearth@lemmy.ca avatar

XML is fine. Namespaces have a special place in hell though

Quetzalcutlass , in Ahh... hearing programmer audiobooks before sleep feels relaxing

I’ve seen code with binary data (such as icons) baked into constants. I can’t wait for the three hour narration of base64 encoded pngs.

AVincentInSpace , in AI's take on XML

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.

Ephera ,

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.

Treczoks ,

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.

interdimensionalmeme ,

Strong competition from yaml and json on this point however

AVincentInSpace ,

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!

Redex68 ,

I don’t know much apart from the basics of YAML, what makes it complicated for computers to parse?

mynameisigglepiggle ,

Sometimes it’s a space, sometimes its a tab, and sometimes it’s two spaces which might also be a tab but sometimes it’s 4 spaces which means 2 spaces are just whack And sometimes we want two and four spaces because people can’t agree.

But do we want quotes or is it actually a variable? Equals or colon? Porque no los dos?

lime ,

the spec is 10 chapters. everything is unquoted by default, so parsers must be able to guess the data type of every value, and will silently convert them if_they are, but leave them alone otherwise. there are 63 possible combinations of string type. “no” and “on” are both valid booleans. it supports sexagesimal numbers for some reason, using the colon as a separator just like for objects. other things of this nature.

daddy32 ,

Yes, the classic “no” problem of YAML. But the addition of the comments is very nice.

Flipper ,

We’re we are going we don’t need any comments.

vrighter ,

it is anything but easy to read if your entire file does not fit on a single screen.

Johanno ,

Why?

virku ,

What data format is easy to read if it fills more than the entire screen?

AVincentInSpace ,

what kind of config file is short enough to fit on a single screen with line breaks?

Dirk ,
@Dirk@lemmy.ml avatar

Those formats are not for humans to read or write. Those are for parsers to interpret.

interdimensionalmeme ,

My biggest gripe is that human eyes cannot in fact see invisible coding characters such as tabs and spaces. I cannot abide by python for the same reason.

ReCursing ,

You can set those things to be visible in many editors. Its ugly tho

rolling_resistance ,

Until you’re doing an online course in a simplistic web editor. Don’t ask me how I know 🥲

ReCursing ,

How do you… Oh sorry

But yeah that sounds unpleasant

interdimensionalmeme ,

The language should just let me specify which character I want for that. I would use “>”.

ReCursing ,

That’d be an editor thing rather than a language thing, I would have thought. It’s probably configurable in some

interdimensionalmeme ,

It would be a compiler directive, I think. Or let me type “end if” and just disregard the coding indentation

ClassifiedPancake ,

JSON not supporting comments is a human rights violation

frezik ,

IIRC, the original reason was to avoid people making custom parsing directives using comments. Then people did shit like “foo”: “[!-- number=5 --]” instead.

CodexArcanum ,

I’ve written Go code; they were right to fear.

phoenixz ,

Wouldn’t go that far, but it’s an annoyance for sure.

CodexArcanum ,

I wrote a powershell script to parse some json config to drive it’s automation. I was delighted to discover the built-in powershell ConvertFrom-Json command accepts json with // comments as .jsonc files. So my config files get to be commented.

I hope the programmer(s) who thought to include that find cash laying in the streets everyday and that they never lose socks in the dryer.

ClassifiedPancake ,

There is actually an extension to JSON: json5.org

Unfortunately only very few tools support that.

racemaniac ,

There are people who find XML hard to read?

CompostMaterial ,

Depends on how countries are complex it is. Ever see the XML behind SharePoint? 🤮

racemaniac ,

But is that the fault of XML, or is the data itself just complex, or did they structure the data badly?

Would another human readable format make the data easier to read?

actually ,

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

chunkystyles ,

I see you’ve never worked with SOAP services that have half a dozen or more namespaces.

jimitsoni18 ,

Just a while ago, I read somewhere: XML is like violence. If it doesn’t solve your problem, maybe you are not using it enough.

InternetCitizen2 , in Psychopath Dev

Normal day in America.

Dirk , in AI's take on XML
@Dirk@lemmy.ml avatar

wate

Aceticon , in AI's take on XML

I’m starting to like this AI thing…

Fontasia , in AI's take on XML

OH HEY EVERYONE, EVERYONE, THIS GUY LIKES JSON

Fuck you and your unstructured garbage.

AnnaFrankfurter , in AI's take on XML

Is this a tactic used by skynet to lure all humans together and then…BANG!!!

SsxChaos , in Ahh... hearing programmer audiobooks before sleep feels relaxing
@SsxChaos@lemmy.ml avatar

Use YouTube as a storage

Flyberius , in npm install
@Flyberius@hexbear.net avatar

It do be like that

yogthos OP ,
@yogthos@lemmy.ml avatar

and like 4 of them aren’t birds but venomous spiders trying to disguise themselves and murder you

AeonFelis , in AI's take on XML

XML is good for markup. The problem is that people too often confuse “markup” and “serialization”.

bss03 ,

Too redundant, just use S-exprs.

(Mostly joking, but in some cases…)

drbluefall ,
@drbluefall@toast.ooo avatar

Unironically.

Given the choice between S-expressions and XML, I will choose S-expressions.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines