Re: The future of XML related technologies in Mozilla

Ian Hickson <[email protected]> Wed, 1 Nov 2006 01:15:13 +0000 (UTC)
Newsgroups gmane.comp.mozilla.devel.xml
Message-ID <[email protected]>
On Fri, 27 Oct 2006, Boris Zbarsky wrote:
> 
> DOM3 Load/Save is even more slanted towards server-side things than 
> Core. It's not a very usable API -- it makes the edge cases hard and the 
> common cases hard.  We ideally need something that makes the common 
> cases easy and the edge cases possible.  Something more akin to our 
> DOMParser and DOMSerializer, perhaps.

HTML5 has document.innerHTML, which allows you to serialise any document 
and parse any string:

   var d = document.implementation.createDocument(null, null, null);
   d.innerHTML = "...XML...";

...or:

   var d = document.implementation.createDocument(null, null, null);
   d.open(); // switch document to HTML mode
   d.innerHTML = "...HTML...";

...or, for that matter:

   var d = document.implementation.createDocument(null, null, null);
   d.open();
   d.write("...HTML...");
   d.write("...HTML...");
   d.write("...HTML...");
   d.close();

...if you're getting the data one bit at a time. (There's no bit-by-bit 
equivalent for XML in the current proposal.)

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'