Re: [xmljs-users] Encoding/Unencoding issues
Brought to you by:
djoham,
witchhunter
From: David J. <dj...@ya...> - 2004-03-11 01:32:44
|
Hi Robert, Couple of questions... 1) Are you talking about the __escapeString and __unescapeString functions in the SAX file? Those use regular expressions and as far as I can see are one pass. The classic dom is multi-pass primarily because you can't count on regular expression support in all the browsers the classic dom is supposed to work with. 2) > 1) original: "put an < in the sentence" > 2) encode(&): "put an &lt; in the sentence" > 3) unencode(&): "put an < in the sentence" > unencode(<): put an < in the sentence That would be the behavior I would expect if (assuming the SAX/W3CDOM parser is used) encode == __escapeString and unencode == __unescapeString I'm missing something I'm sure. Can you give a code example that'll help me? > Also, code needs to be added to handle &#hex; and &numeric; > syntax. There are a host of other entities to be recognized, but they may > be HTML specific (like '). > That would totally rock. I thought ' was actually XML specific though and not an actual HTML entity. Moz and Konq support it in HTML, but IE doesn't IIRC. I remember this due to a vague memory of once saying "wow, something that IE is more compliant to the spec in than Mozilla. Wow! A flying pig!" :) > If someone is working on this or has some could that was started please let > me know, otherwise I will try to write it and submit it to the project. > Thanks. Again, this would totally rock. No one is working on this that I know of and I agree the escaping is due for a redesign. If you would like to do this, I would really appreciate it and I will happily include it in version 3.2 (or 3.1 if you're really quick). I would suggest the following: * Unless you *really* want to go back and test with old browsers, I would leave the classic DOM code as it is now. * Put your new code in xmlEscape.js and just point all of the DOM and SAX escape functions to this code. This will require that people include xmlEscape.js when using the W3C Parser and the SAX parser, but I'm OK with this since your code will provide significant functionality - even outside of XML for <SCRIPT> * If you would like to turn the existing functions in xmlEscape.js into single pass (presumably using regular expressions) that would be nice as well. If you do, I'll probably take the existing file and call it xmlEscape4xBrowsers.js just so folks who have to support older browsers can keep using the two functions is already provides without worrying about incompatibilities. * A test suite and some documentation about what entities we will officially support would be very nice! Thanks again! David __________________________________ Do you Yahoo!? Yahoo! Search - Find what youre looking for faster http://search.yahoo.com |