Re: Unable to round-trip tab character using XMLHttpRequest and XMLSerializer
Boris Zbarsky <[email protected]> Sun, 30 Sep 2007 18:04:56 -0500
| Newsgroups | gmane.comp.mozilla.devel.xml |
|---|---|
| Message-ID | <[email protected]> |
Mark A. Ziesemer wrote: > I'm fine with "very simple" and "easy to use", but then it should work > by default - even for the not-so-common but within-spec cases. Without > any options to set, it seems impossible to call it a configuration/usage > issue. The fact that it uses some character entities (e.g. "&") but > not others seems to be a little bit of an issue. You have to use & to get well-formed XML out, basically. The default serialization mode is to use as few entities as possible while still producing a correct and valid serialization of the DOM. If this process is lossy for the tab character in XML because the XML parser normalizes away literal tabs, then a bug should be filed on changing how it's handled. > I'm open to using an alternate serialization method For what you're doing, why not just serialize directly into a text file? It doesn't sound like you're starting with XML, right? So why try to shoehorn your data into XML, with its funny whitespace rules? Alternately, you could base64-encode your data to eliminate any possibly-problematic characters. > Unfortunately, your suggestion to use nsIDocumentEncoder seems much > easier said than done. Searching for "nsIDocumentEncoder" or even > "DocumentEncoder" on the MDC Wiki currently yields 0 results. You can't use it from script in Firefox 2 anyway. I keep forgetting that not everyone is working against the trunk... -Boris