A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
XML and Related Technologies
Replacing the content of a node with a text string
Joined: Oct 08, 2006
Nov 03, 2006 03:03:00
I need to replace a couple of nodes that contain childnodes etc with just a text node. Does anybody know a quick way of doing this?
Is the best way to create a node with the same name etc but just with the text node that I want to insert and the use the replaceChild method of the Node interface? or is there a simpler way?
[ November 03, 2006: Message edited by: Miguel Capo ]
Author and all-around good cowpoke
Joined: Mar 22, 2000
Nov 05, 2006 08:29:00
class there is the
replaceNode(Node newChild, Node oldChild)
method. See the JavaDocs for details.
Java Resources at
Joined: Jan 23, 2002
Nov 05, 2006 11:24:00
I'm in the habit of checking out the
Java Developer's Almanac
when I need to do something new with the DOM API. You might want to check it out, too (or bookmark it for later).
Effective Unit Testing
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
subject: Replacing the content of a node with a text string
SAX:Why content handler's characters() method is called and print multiple space string.
getting Document fragment as String
How to checked CheckBox in JTree only when user click on CheckBox?
XSLT and embedded tags in text.
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013