[squeak-dev] XMLElement vs XMLString printString

gettimothy gettimothy at zoho.com
Thu Aug 26 08:23:35 UTC 2021


Hi folks,



No biggie, just a quirk.



tl;dr



I am using the "monty" version of XML that I understand is larger than the standard shipped XML...



on an XMLElement printString outputs unescaped output

while XMLString printString outputs escaped output





longer stream of consciousness at 3 a.m. version follows....


In my XTReams parsing project, I frequently get a mixture of XMLElements and XMLStrings as objects during the parsing callbacks.



I just noticed this oddity.



I have an XMLElement on a <span> tag. I inspect it and..



self printString -->  '<span style="font-weight: bold">Commanders</span>'


which, for readability reasons during development, I want,  as it is unescaped tags.



Later in the parse, I have an XMLString that includes the contents of that XMLElement as above

inspecting it its "self" is escaped xHTML ,which I would expect as it has to live with itself in xml universe.



&nbsp;<span style="font-weight: bold">Commanders</span><br>




its string is what I want for readability.





' <span style="font-weight: bold">Commanders</span><br>'


however...and as I type this, it is making sense that this behavior is correct, but since I have typed this long, I will keep typing...



however, when, like the XMLElement, I do a printString on it...





self printString -> '&nbsp;<span style="font-weight: bold">Commanders</span><br>'




To summarize...

on an XMLElement printString outputs unescaped output

while XMLString printString outputs escaped output
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20210826/ee8b9a01/attachment.html>


More information about the Squeak-dev mailing list