TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

ECMAScript for XML - Direct XML Syntax in ECMAScript

38 pointsby crazypythonabout 4 years ago

10 comments

codeulikeabout 4 years ago
I&#x27;ve been using XML here and there for about 20 years now. It does have its uses. But I still don&#x27;t have any idea what all that xmlns stuff is about, especially all the variations of it that involve colons. Like I know its something to do with namespaces or whatever. But to this day I open an XML file and in the first few lines there&#x27;s a few xmlns pointing to some random complicated old urls and it just has this air of &#x27;ignorable old overspecified thing because someone got too excited twenty years ago&#x27;<p>(except sometimes its not ignorable and then things get messy)<p>edit: yes I know what namespaces are for, and some of the simple uses are simple, but to try and understand xml namespaces and schemas in full is really complicated. 95% of the time this stuff just seems like fussy cruft.
评论 #27367050 未加载
评论 #27366639 未加载
评论 #27367396 未加载
评论 #27366549 未加载
评论 #27366636 未加载
trzeciabout 4 years ago
ActionScript 3.0 was a great example of implementing E4X.<p>I miss that language a lot. It has quite a few great concepts: XML, intuitive implementation of objects, where key can be anything. Statically typed. Prototypes. Typed vectors. for..each loop. Dictionary with weak keys (oh that I loved so much, it was so powerful to implement better memory management on top of this).<p>I spent like 10 years developing in it, now it&#x27;s my 6 year since I&#x27;ve touched it last time : (
评论 #27368292 未加载
bokchoiabout 4 years ago
Hey, I worked on the specification for this as a fresh out of school test engineer! Ah, the memories. It didn&#x27;t take over the world, and in hindsight it should have worked a little differently, but I still think it&#x27;s pretty neat. I haven&#x27;t used it in a few years now but it is really easy to transform or extract data from an xml doc using Rhino and E4X.
jchwabout 4 years ago
Good ol’ E4X. It actually worked in Firefox, but I only ever used it in ActionScript. It was a little strange, but quite useful in some regards. There’s a bit more than just literals going on there.
评论 #27366852 未加载
naranhaabout 4 years ago
Interesting how the embedded XML syntax resembles today&#x27;s JSX, I wonder if it took inspiration from it.
评论 #27366290 未加载
评论 #27366460 未加载
评论 #27367312 未加载
flakinessabout 4 years ago
Martin Odersky once mentioned that he added XML literal to Scala because it was 2000s (citation needed). Although it&#x27;s hard to refrain from ridiculing these, it&#x27;s probably not fair to do it. 2000s had its own collective craziness and this was one of them. We&#x27;ll have such ones for 2020s but we can only spot it years later.<p>(Don&#x27;t name it to show your smartness. Pointing a few is not hard, but pinpointing all is not possible unless you&#x27;re a pure naysayer.)
评论 #27366301 未加载
评论 #27366593 未加载
paulirwinabout 4 years ago
Another example of language support for XML is VB.NET. I loved this feature when I last used it (over 10 years ago), especially the LINQ syntax for generating tags.<p><a href="https:&#x2F;&#x2F;docs.microsoft.com&#x2F;en-us&#x2F;dotnet&#x2F;visual-basic&#x2F;programming-guide&#x2F;language-features&#x2F;xml&#x2F;xml-literals-overview" rel="nofollow">https:&#x2F;&#x2F;docs.microsoft.com&#x2F;en-us&#x2F;dotnet&#x2F;visual-basic&#x2F;program...</a>
benibelaabout 4 years ago
I liked this syntax so much I now use XQuery for everything
评论 #27366857 未加载
Marazanabout 4 years ago
I loved E4X in Actionscript.
olliejabout 4 years ago
Fun fact: e4x is part of why JS has for(of) instead of something more sensible
评论 #27375667 未加载