While you can always delete existing nodes and insert new nodes, it’s simpler to just replace nodes if that’s what you want. Scripts 11.9 (the HTML) and 11.10 show how you can replace one node with another. Figure 11.7 shows the replacement process.
Figure 11.7. Here, we’ve replaced the third paragraph (left) with new text (right).
Script 11.9. Adding the Replace node radio button to the HTML rounds out our node manipulation examples.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> ...