Re: Unable to round-trip tab character using XMLHttpRequest and XMLSerializer

Boris Zbarsky <[email protected]> Sun, 30 Sep 2007 09:04:15 -0500
Newsgroups gmane.comp.mozilla.devel.xml
Message-ID <[email protected]>
Mark A. Ziesemer wrote:
> Verified that the saved XML contains 13 characters, including 
> [space,tab,space].

Parsing that should give a 3-letter attr value in Gecko.  As a simple test:

   data:text/xml,<root%20attr="%20%09%20"/>

   javascript:alert(document.documentElement.getAttribute("attr").length)

> http://www.w3.org/TR/2000/REC-xml-20001006#sec-white-space

I don't believe we perform such normalization.

Is there a testcase somewhere that shows your problem?  You should be able to 
use XMLHttpRequest in a web page just as well as in an extension to construct 
such a testcase...

> This should be expected, but the 
> question remains: How can a character entity be written using 
> XMLSerializer?

It can't.  The point of XMLSerializer is to expose a very simple easy to use 
serialization model.  Trusted callers who need something more complicated can 
use nsIDocumentEncoder with all its complexity directly (though I'm not sure 
even that will let you entity-encode tabs, necessarily).

-Boris