A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
OCA Java SE 8 Programmer I Study Guide
this week in the
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
In the org.w3c.dom.Node class there is the
replaceNode(Node newChild, Node oldChild)
method. See the JavaDocs for details.
Joined: Jan 23, 2002
Nov 05, 2006 11:24:00
I'm in the habit of checking out the
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
I agree. Here's the link:
subject: Replacing the content of a node with a text string
XSLT and embedded tags in text.
getting Document fragment as String
SAX:Why content handler's characters() method is called and print multiple space string.
How to checked CheckBox in JTree only when user click on CheckBox?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015