[squeak-dev] existing methods to unescape XML escaped characters.

gettimothy gettimothy at zoho.com
Sun Nov 15 18:52:15 UTC 2020

Hi Folks,

I am storing parsed content from XTreams parsing in the XMLElement that Xtreams parsing uses....(could be different from stock Squeak XML package per recent discussion here.)

The XMLElements escape certain characters:  https://www.ibm.com/support/knowledgecenter/SSEQTP_liberty/com.ibm.websphere.wlp.doc/ae/rwlp_xml_escape.html

To get my content to display properly on Chrome, I have to unescape the escaped XML escaped characters.

I wrote a quick and dirty method to git-r-done....

unEscapeXMLEscapeCharaters: aString
    xmls := aString copyReplaceAll:'>' with:'>' asTokens:false.
    xmls := xmls copyReplaceAll:'<' with:'<' asTokens:false.            
    xmls := xmls copyReplaceAll:'"e;' with:'"' asTokens:false.                            
    xmls := xmls copyReplaceAll:''' with:'''' asTokens:false.                            
    xmls := xmls copyReplaceAll:'&' with:'&' asTokens:false.

However, I have a nagging suspicion I have re-invented the wheel; although I did spend significant time hunting for one.

If anything obvious jumps out, please respond.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20201115/dd34d257/attachment.html>

More information about the Squeak-dev mailing list