W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2002

createTextNode and special characters

From: Immanuel Normann <normann@dfki.de>
Date: Fri, 24 May 2002 06:36:47 -0400 (EDT)
Message-Id: <200205241035.MAA22779@corp-200.dfki.uni-sb.de>
To: www-dom@w3.org

the question how to handle special characters within createTextNode() seems to 
be sufficiently discussed in this thread. Nevertheless, I didn't understand 
the solutions of the problem. Therefore I want to state the problem again as 
simple as possible. Consider the following sample code and focus on 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<script type="text/javascript">
function showForall() {
 var t = document.createTextNode('&forall;');
  <body onload='showForall()'>

What I want to see after load is the respective 'forall' Symbol.
But what I actually get is '&forall;' as a (8 character long) text.

Also so 
doesn't yield the 'forall' Symbol. And 
is an javaScript error: "Object cannot be created in this context"

I didn't understand the following hints:
>>I'm German, so I use a lot of special characters like &auml; in my
>>pages. Are all these characters single nodes in the DOM?
>This depends on whether you've asked your parser to retain Entity Reference
>nodes or not.
How do I ask my parser to retain Entity Reference?

>If you've told the DOM generator (parser or other code) to "expand" the
>entity references, then the Text node would appear...
How do I tell the DOM generator to "expand" entity references?

Perhaps I should mention some additional information for an appropriate 
1) I am not an DOM-expert. So an answer with simple sample code would help me 
2) I am using Mozilla (more precisley: Mozilla/5.0 (X11; U; Linux i686; en-US; 
rv:1.0rc2) Gecko/20020510)

Thanks for any help!

Received on Tuesday, 28 May 2002 14:33:45 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:10 UTC