5 ms·
XPath is fantastic, although not everything is relevant to non-XML docs. But in general, JSON, XML, S-expressions, yaml, HTML, and many data interchange progra
by cowardlydragon 10y ago
XPath is fantastic, although not everything is relevant to non-XML docs.
But in general, JSON, XML, S-expressions, yaml, HTML, and many data interchange programs are all 95% the same hierarchical data structure.
I wanted to make a cross-dataformat XPath subset that would work on all of them, and even allow a format that mixed the formats as needed in a MIME-esque document format, but the parser... oh god the parser.
This guy's project was like the initial steps of mine: use whatever XML tools exist, but that kills streaming processing and doesn't pass cursory smell tests...
I like this though, it is food for thought.
- zeveb 10y ago> But in general, JSON, XML, S-expressions, yaml, HTML, and many data interchange programs are all 95% the same hierarchical data structure. S-expressions can also represent graphs. I have a vague recollection that YAML can as well. An S-expression example: (nodes #1=(a #2=(b #1# #3=(c #2# #3#)) #3#) #2# #3#)
- junke 10y agoWorth noting that you can both read and print such forms.
- zeveb 10y ago> Worth noting that you can both read and print such forms. That's actually how I checked that I had the syntax right: I wrote: (let ((*print-circle* t) (*print-case* :downcase) (print '(nodes #1=(a #2=(b #1# #3=(c #2# #3#)) #3#) #2# #3#)) nil) Thus proving that reading & printing work well. Seriously, Lisp is an awesome language.
- mmastrac 10y agoFirefox's Spidermonkey used to support a similar notation for JS objects. I can't remember when it was removed, but it was pretty obscure: http://blog.notdot.net/2006/9/Serializing-JavaScript-objects-with-circular-references http://blog.notdot.net/2006/9/Serializing-JavaScript-objects... http://philogb.github.io/blog/2009/03/24/sharp-variables/ http://philogb.github.io/blog/2009/03/24/sharp-variables/ https://developer.mozilla.org/en-US/docs/Archive/Web/Sharp_variables_in_JavaScript https://developer.mozilla.org/en-US/docs/Archive/Web/Sharp_v...