3 ms·
XML gets a bad rap because of how much prettier JSON is, but there are a lot of cool tools associated with it. XPath is pretty awesome, I had to write a XPath
by habosa 13y ago
XML gets a bad rap because of how much prettier JSON is, but there are a lot of cool tools associated with it. XPath is pretty awesome, I had to write a XPath parser/executor once (for a class) and it made me appreciate the value and simplicity.
Then there was XSLT, which was a pretty sweet way to turn a data format into a variety of "print" or "display" formats. Definitely been replaced by bigger and better things but it's a pretty awesome technology that does one thing really well.
- nightwolf 13y agoJust curious: what are the "bigger and better things" that have replaced XSLT? From what I can tell, it's still being used quite a lot, especially in the world of structured documentation. For something like transforming massive amounts of XML with a great amount of structural variety to another format, XSLT would certainly be my first choice.
- habosa 13y agoI'd say a comparable new piece of technology is AngularJS + HTML + CSS with JSON as the data format. In the end you're still transforming an easily-exchanged data format to a visual display, but with all of the new things that come with Web 2.0 and the thick client model. It still can't turn a pile of XML into a pile of PDFs though, so XSLT is definitely king in some arenas.
- skrebbel 13y agoXSLT is a turing-complete programming language. Really, the moment your source XML has a slightly different structure from the target output, XSLT files become monsters. Programming in XML is never a good idea. It isn't in XSLT, it isn't in Spring, it isn't in Maven. Anything that's XML and has elements or attributes with names like "if", "else" or "while", something went horribly, horribly wrong somewhere. It's horribly verbose, you can't reasonably debug it, and there's virtually no engineering best practices, which results in near-impossible maintenance tasks. Any modern programming language with a good, consice, XML parsing library is a more effective tool to transform XML into something else than XSLT. Don't code in XML.
- ygra 13y agoWould you say »Programming in S-expressions is never a good idea« as well?
- skrebbel 13y agoNo. Why?
- ygra 13y agoThen where do you draw the line between XML as data vs. XML as code (which seems to be bad) and sexpr as data vs. sexpr as code (which seems to be good)? Just curious; it's just syntax, after all, and I think that XSLT really has an advantage in transforming XML to other XML (or text) compared to a program in other languages.
- habosa 13y agoI was just saying XML and XSLT is really cool, which it is. It's a tool that does one job, which at a time was a very common job.