1218
AI's take on XML (lemmy.world)
submitted 10 months ago by renzev@lemmy.world to c/programmerhumor@lemmy.ml
top 50 comments
sorted by: hot top controversial new old
[-] AVincentInSpace@pawb.social 174 points 10 months ago

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@lemmy.ml 48 points 10 months ago

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@lemmy.world 8 points 10 months ago

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.

[-] jimitsoni18@lemmy.zip 9 points 10 months ago

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.

load more comments (5 replies)
[-] annoyed_onion@lemmy.world 137 points 10 months ago
[-] Serinus@lemmy.world 20 points 10 months ago

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.

load more comments (1 replies)
[-] toothpaste_sandwich@feddit.nl 85 points 10 months ago

Wow, that's a very passive aggressive reaction. I enjoyed a lot.

[-] SkyNTP@lemmy.ml 44 points 10 months ago

This is what happens when stack overflow is used for training.

[-] Agent641@lemmy.world 19 points 10 months ago

Not long before AI just tells me to google it, or read the manual.

load more comments (1 replies)
load more comments (1 replies)
[-] Batman@lemmy.world 56 points 10 months ago
[-] renzev@lemmy.world 58 points 10 months ago* (last edited 10 months ago)
[-] clb92@feddit.dk 26 points 10 months ago

Lots or file formats are just zipped XML.

I was ~~reverse engineering~~ fucking 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.

[-] SzethFriendOfNimi@lemmy.world 11 points 10 months ago* (last edited 10 months ago)

Sounds like it’s actually using XSLT or some kind of content validation. Which to be honest sounds like a good practice.

[-] clb92@feddit.dk 9 points 10 months ago* (last edited 10 months ago)

Here's an example of a text object taken from the XML, if you're curious: https://clips.clb92.xyz/2024-09-08_22-27-04_gfxTWDQt13RMnTIS.png

EDIT: And with more complicated strings (like ones havingnumbers or symbols - just regular-ass ASCII symbols, mind you) there will be tens of , because apparently numbers and letters don't even work the same. Even line breaks have their own . And if the number of these and their charLen don't match what's actually in pt:data, it won't open the file.

load more comments (3 replies)
load more comments (1 replies)
[-] LittleWizard@feddit.org 40 points 10 months ago

I hate writing xml with a passion

[-] Knock_Knock_Lemmy_In@lemmy.world 29 points 10 months ago

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

load more comments (1 replies)
[-] smeenz@lemmy.nz 7 points 10 months ago

What about writing in xml without any passion ?

load more comments (1 replies)
[-] SzethFriendOfNimi@lemmy.world 37 points 10 months ago* (last edited 10 months ago)

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.

[-] leisesprecher@feddit.org 11 points 10 months ago

Had to work with a fixed string format years ago. Absolute hell.

Something like 200 variables, all encoded in fixed length strings concatenated together. The output was the same.

...and some genius before me used + instead of stringbuilders or anything dignified, so it ran about as good as lt. Dan.

load more comments (2 replies)
[-] Dirk@lemmy.ml 32 points 10 months ago
[-] Aceticon@lemmy.world 28 points 10 months ago

I'm starting to like this AI thing...

[-] lord_ryvan@ttrpg.network 22 points 10 months ago

I'm sorry which LLM is this? What are its settings? How'd you get that out of it?

And how did it give sources?

[-] renzev@lemmy.world 56 points 10 months ago

I’m sorry which LLM is this?

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.

How’d you get that out of it?

The screenshot is fake. I used Inspect Element.

[-] lord_ryvan@ttrpg.network 18 points 10 months ago

perplexity.ai

Like DuckDuckGo's AI's, but with sources? Sounds cool, thanks!

fake

Ah... Too bad (:

[-] renzev@lemmy.world 8 points 10 months ago

Never knew that ddg had an LLM, will check it out. Thanks!

[-] lord_ryvan@ttrpg.network 12 points 10 months ago

It's a proxy for a number of LLMs of choice, prompts anonymised before they're sent. A bit like how their search engine is anonymised Bing, or how their maps are anonymised Apple Maps. I'm happy with the service!

load more comments (1 replies)
[-] AeonFelis@lemmy.world 18 points 10 months ago

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

load more comments (2 replies)
[-] BlackEco@lemmy.blackeco.com 16 points 10 months ago

RSS/ATOM has to be the best thing to come out of XML

[-] Tomkoid@lemmy.ml 15 points 10 months ago

BASED. What is the name of this AI? I want to use this.

load more comments (1 replies)
[-] it_depends_man@lemmy.world 14 points 10 months ago

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@lemmy.world 22 points 10 months ago

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.

load more comments (1 replies)
[-] CanadaPlus@lemmy.sdf.org 9 points 10 months ago

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:

<address>
    <street_address>21 2nd Street</street_address>
    <city>New York</city> 
    <state>NY</state>
    <postal_code>10021-3100</postal_code>
</address>

Is pretty much the same as this:

  "address": {
    "street_address": "21 2nd Street",
    "city": "New York",
    "state": "NY",
    "postal_code": "10021-3100"
  },

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

load more comments (5 replies)
load more comments (4 replies)
[-] flashgnash@lemm.ee 13 points 10 months ago

Listen we all know deep down the solution is to try to parse it with regex

[-] expatriado@lemmy.world 11 points 10 months ago

stuff like this is how reddit found out their users comments were being used 😂

[-] renzev@lemmy.world 25 points 10 months ago
[-] AnnaFrankfurter@lemmy.ml 7 points 10 months ago* (last edited 10 months ago)

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

load more comments
view more: next ›
this post was submitted on 08 Sep 2024
1218 points (100.0% liked)

Programmer Humor

37046 readers
216 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS