JsonML


From Docunext Technology Wiki

Jump to: navigation, search

Based on the simple fact that javascript files can be cached on the browser's client and lazily referenced across http states, the embedding of data into JSON makes perfect sense.

JsonML makes the idea more palatable to me by aligning a subset of JSON in a one-to-one relationship with XML.

Imagine this - each page of a website contains a lot of information which does not change. Why not cache that data on the client? The only way I can think of doing this is in a javascript as a data object. As the JsonML folks explain, storing x/html in javascript is awkward to say the least.


Contents

Hand Crafting a DOM

var text = "<div/>";
var parser=new DOMParser();
xmlDoc=parser.parseFromString(text,"text/xml");
newel=xmlDoc.createElement("span");
newtext=xmlDoc.createTextNode("first");
newel.appendChild(newtext);

Escaping Multiline XML

Its not too bad, but its not very efficient. Strings are not the best data type in my humble opinion.


E4X

I can't believe I've never heard of this before. Its awesome! Too bad MSIE doesn't support it.


Problem

The template system requires an ASP compiler. Doh!

The Code

Related Stuff

External Links

Personal tools