3 ms·
There is an existing alternative syntax for XML data [1] that represents it as a list of key-value pairs where the keys are XPath-like paths. In this syntax
by networked 11y ago
There is an existing alternative syntax for XML data [1] that represents it as a list of key-value pairs where the keys are XPath-like paths. In this syntax
<foo bar="zot">quux</foo>
would be represented as
/foo/@bar=zot
/foo=quux
I think data serialization formats of this particular kind are underused. They are dead simple to parse while still being reasonably human-friendly (more so than XML, I'd say). Get rid of the attributes and introduce the convention that nodes with children named "0", "1", ... , "$N" are arrays and you can represent JSON.
[1] http://www.ofb.net/~egnor/xml2/ http://www.ofb.net/~egnor/xml2/
- smrtinsert 11y agoI like this, I had an instinct about making a file format similar to this, except pushing the path onto a stack. <foo bar="zot"><baz>quux</baz></foo> [foo] @bar="zoot" [baz] "quux" [] [] I figured you would save a little in the serialization. In practice I rarely need such a thing, and just serialize a structure to whatever I'm working with (s expressions, or in java xstream etc since those xml files are read somewhere...)