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..
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..
You can use setNodeValue if it's a text node
ASKER
I tried that.. but m getting not getting the specefied value inside the node. The contents r blank.
Try
node.appendChild(doc.creat eTextNode( "This is my content"));
node.appendChild(doc.creat
ASKER
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
CEHJ to the rescue again ;-) thank you..
:-)