XML Parser, interleaving text and elements

ar sstnjpm02 at sneakemail.com
Fri Sep 5 08:43:47 UTC 2003


On Fri, 05 Sep 2003 09:18:42 +0200, Michael Rueger wrote:

> sstnjpm02 at sneakemail.com wrote:
> 
>> Is this correct or a bug? I assumed it's legal to interleave text and
>> elements like this in XML and expect the structure to be preserved. 
> 
> This is actually a bug. I actually had noticed it a while ago and then 
> completely forgot about it. I will look into it.

As a hack, I changed XMLDOMParser >> characters: to do addElement
instead of addContent.

No doubt this causes some design problems as well as actual bugs
since elements was not intended to hold XMLStringNodes, but it seems to me
that there is no avoiding storing the elements and strings together.


On a separate note, I am trying to get my xhtml containing javascript to
parse properly. My immediate problem is that in the script tag, crs and
tabs are changed to 
  &#9, etc.

As a huge hack, just to get my html to work, I subclassed XMLStringNode
and overrode printXMLOn: then patch in my <script> tags after the
parse. 

Inline javascript inside xhtml is problematic at best (eg see
http://devedge.netscape.com/viewsource/2003/xhtml-style-script/ )
 but I wonder if anyone has attacked this in squeak. 



More information about the Squeak-dev mailing list