Link to home
Start Free TrialLog in
Avatar of royalcyber
royalcyber

asked on

Replacement for setTextContent() method (org.w3c.dom.Node) in java 1.4.2

Hello experts,
I was using Java 1.5 in my appl. M writing a program to programatically create an xml file. To add data to the contents of a node i used the setTextContent() method (org.w3c.dom.Node). Now i hve a necessity to migrate to Java 1.4.2 which does not support the following method. Can anybody suggest a replacement method used earlier to add data to the node.

thank you..
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

You can use setNodeValue if it's a text node
Avatar of royalcyber
royalcyber

ASKER

I tried that.. but m getting not getting the specefied value inside the node. The contents r blank.
Try

node.appendChild(doc.createTextNode("This is my content"));
well... ok. That gives me the value of the node, the contents.. But the element tag is missing. Th eone i prev created by using doc.createElement("name"); which resulted in the  <name> tag. So, how do i create the tag and specefy the data of the tag?
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
CEHJ to the rescue again ;-) thank you..
:-)