aspose file tools*
The moose likes XML and Related Technologies and the fly likes   in text Node Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "  in text Node" Watch "  in text Node" New topic
Author

  in text Node

Abhijit Das
Ranch Hand

Joined: Sep 25, 2007
Posts: 156
Hi,
I want to place the text node as   in a element as <label> in a XHTML file by using DOM APIs.
e.g.
document.createTextNode(" );


The '&' is replaced by '& amp;'. (ignore the space ) so I am not able get the whilte space in the browser.
i.e.
I want to create elments as (ignore space)
<label class="" > & nbsp; </label>
or
<label class="" > & #160; </label>


thanks


Abhijit Das
SCJP 5.0 | SCWCD 1.5
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Isn't this code works?


Also this question is more suitable for the HTML-JavaScript section.


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42608
    
  65
Are CDATA sections permissible in XHTML? Anything you put in one of those should go through unchanged.


Ping & DNS - my free Android networking tools app
Abhijit Das
Ranch Hand

Joined: Sep 25, 2007
Posts: 156
Hi,


is works, but code is not interpreting properly in the browser. because, the label is in
td
of table . So, only i want to place the line as shown in the last post.

And,
Hi Ulf Dittmer, can you explain how to write wiht CDATA to ignore. please send syntex for that.

thanks.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Can you write the whole "td" instead of "label",
like


JS:
Abhijit Das
Ranch Hand

Joined: Sep 25, 2007
Posts: 156
Hi,
Actually, I am generating the XHTML file uisng DOM object of Java. In the XHTML, I want that format. so that while opening the file in browser, I will get a empty cell of a table .
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

I don't know how your're creating XHTML using Java, the code snippet for the same will help.
Meanwhile, take a look at how CDATA is defined for any tag, for your need, it goes like this:
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: &nbsp; in text Node