Live data from Hacker News

You probably misunderstand XML

lemire.me

21–30 of 31 posts

Re: You probably misunderstand XML

#21
post #20

Earlier quoted context omitted.

xslt is beyond tedious, it is infuriating. There are few use cases for xslt that would not be better served with a procedural technique, eg. python and a parser. also the whole "using xml to define a transformation on some other xml" thing is so overly meta as to induce a massive brain hemorrhage out of my nose and all over my desk.

Fortunately you can now use XPath for simple queries and XQuery beyond that.

Forgot about them. Both XPath and XQuery are excellent technologies and a probably the best thing about XML in my experience with it. I highly recommend everyone concerned with XML check them out if they havent already. I never seem to see much mention of them around XML discussions.

http://www.w3schools.com/xquery/xquery_intro.asp

Re: You probably misunderstand XML

#22
post #9

Earlier quoted context omitted.

The only good point for XML is there are existing tools that do things via XML. There are tools that generate ATOM and RSS for you. And there are tools that consume ATOM and RSS. So if XML is already a well defined and followed standard for what you want do, use XML. In all other situations use something else.

Then help me translate this into JSON please How about that way: {tag: "p", class: "content", text: ["Then help me translate this into ", {tag: "span", class: "highlight", text: "JSON"}, " please"]} And that's just a small example where you can see all the start and end tags on one screen. Now change the example to insert a hyperlink, say, around the word "help". How easy is it to change?

Who said anything about JSON? XML is just shit. It requires documents be well formed which sucks when you want a secretary to deal with the documents. It's just a poor combination strict and loose.

Re: You probably misunderstand XML

#23
post #22

Earlier quoted context omitted.

Then help me translate this into JSON please How about that way: {tag: "p", class: "content", text: ["Then help me translate this into ", {tag: "span", class: "highlight", text: "JSON"}, " please"]} And that's just a small example where you can see all the start and end tags on one screen. Now change the example to insert a hyperlink, say, around the word "help". How easy is it to change?

Who said anything about JSON? XML is just shit. It requires documents be well formed which sucks when you want a secretary to deal with the documents. It's just a poor combination strict and loose.

The difference between a format that adheres to some deterministically parsable syntax and one that doesn't is not something that I would characterise as "shit" or "not shit".

Re: You probably misunderstand XML

#24
post #12

My biggest issue with XML is "XML misunderstands Unix philosophy". You can't easily use cut, awk and grep with XML without having a million of edge case to handle. There are some tools like XMLStarlet, xsltproc or xalan. But you can't safely extract content from XML files with standards tools even if you use the XML extension for gawk. You could argue that XML documents are complex and cannot be described using simpl…

Actually, the problem is XML demonstrates the limits of the "UNIX philosophy". Plain text simply isn't the be-all, end-all of formats. You can't easily use cut, awk, or grep on JSON, either. The "UNIX philosophy" does poorly with trees and graphs (in the computer science sense).

That's not a bad thing. The UNIX philosophy encourages you to avoid those things if you don't need them. It's very powerful. But when you actually, factually need them, you're not going to get very far with UNIX tools. That's OK; it is neither an indictment of UNIX nor of the data. Different tools are called for.

Re: You probably misunderstand XML

#25
post #20

Earlier quoted context omitted.

Fortunately you can now use XPath for simple queries and XQuery beyond that.

Forgot about them. Both XPath and XQuery are excellent technologies and a probably the best thing about XML in my experience with it. I highly recommend everyone concerned with XML check them out if they havent already. I never seem to see much mention of them around XML discussions. http://www.w3schools.com/xquery/xquery_intro.asp

Ironically probably the most popular application of XPath in the real world is jQuery selectors! Although I don't know whether that weakens or strengthens the case for JSON...

Re: You probably misunderstand XML

#26
post #13

It is the author of this article who, despite claiming to have taught a course on XML, seems to misunderstand XML. I think one of the persons who best understood XML was Erik Naggum, or at least few have explained it so eloquently: http://harmful.cat-v.org/software/xml/s-exp_vs_XML

That Naggum email was beautiful, informative, funny and wildly digressive. Mind blown.

Re: You probably misunderstand XML

#27
post #5

Thumbs down. He taught an entire course on XML, which he calls a "great meta-example on how to deal with semi-structured data"? And his only defense of XML over JSON is... it's worked ok for some file formats? The only point in this whole article is that XML is not well-suited for RPCs, though he fails to argue that it's well-suited for anything else. One argument is that XML is better than JSON for use cases like XH…

If you believe his best point is that XML is not well-suited for RPCs then you've missed the point.

XML is good for exactly what it stands for: an extensible markup language. It's good for dealing with semi-structured data, especially when you have to deal with data from multiple domains.

Have you ever used SGML (other than HTML)? If so, then you'd likely agree that XML is a superior standard. But I'm guessing that you have not, because for some reason you believe that XML was created for data serialization.

DTDs and XSLT _are_ useful aspects of XML and I doubt the author in unaware of them. Rather the author assumed too much of the readers in understanding the history of XML and the nature of semi-structured data.

Re: You probably misunderstand XML

#28
post #5

Thumbs down. He taught an entire course on XML, which he calls a "great meta-example on how to deal with semi-structured data"? And his only defense of XML over JSON is... it's worked ok for some file formats? The only point in this whole article is that XML is not well-suited for RPCs, though he fails to argue that it's well-suited for anything else. One argument is that XML is better than JSON for use cases like XH…

"One argument is that XML is better than JSON for use cases like XHTML, where you heavily mix tags and content."

Yes, this is true. The point of using XML is when you have data where you know the structure of some parts, but not others. This is true of most things that begin life as prose, and then have some structure added to them later. It is a point between "bag of words" information retrieval, and SQL queries, that requires a different approach.

"I get the feeling XML wasn't really made for this case, though, it was made for the JSON-like case."

No, this is false. XML is awful for the JSON like case. What would make you think that XML was created for it?

Re: You probably misunderstand XML

#29
post #5

Thumbs down. He taught an entire course on XML, which he calls a "great meta-example on how to deal with semi-structured data"? And his only defense of XML over JSON is... it's worked ok for some file formats? The only point in this whole article is that XML is not well-suited for RPCs, though he fails to argue that it's well-suited for anything else. One argument is that XML is better than JSON for use cases like XH…

"I get the feeling XML wasn't really made for this case, though, it was made for the JSON-like case." Back in 1997, XML was "SGML for the Web." It was a way to pass around structured, plain-text, human-readable documents that did not require expensive, buggy, incomplete parsers. It then got misapplied as an RPC transport encoding, and tools vendors were more than happy to start pushing specs, such as W3C Schemas, tha…

I guess the reason why this happened was because we didn't have JSON then, so XML looked like the best available option to many people at the time (except for those few who knew about s-expressions).

Now that we have JSON, there is no longer any excuse.

Re: You probably misunderstand XML

#30
post #20

Earlier quoted context omitted.

Fortunately you can now use XPath for simple queries and XQuery beyond that.

Forgot about them. Both XPath and XQuery are excellent technologies and a probably the best thing about XML in my experience with it. I highly recommend everyone concerned with XML check them out if they havent already. I never seem to see much mention of them around XML discussions. http://www.w3schools.com/xquery/xquery_intro.asp

> I never seem to see much mention of them around XML discussions.

Which is a shame since I've been banging my head against a particular set of problems for a while with XML, and XQuery nicely resolves that, and I think it's easier to use than SQL for the most part.

Post reply on HN