Demos and Usage of org.w3c.dom.Node.replaceChild(Node newChild,Node oldChild)


   1: {
   2:     public static void map (Node elm, String str) {
   3:     NodeList nodes = elm.getChildNodes();
   4:         ...
   5:     for (int i = 0 ; i < nodes.getLength(); i++) {
   6:         Node node = nodes.item(i);
   7:         if (node instanceof Text) {
   8:         ...
   9:         Text text = elm.getOwnerDocument().createTextNode(str);
  10:         elm.replaceChild(text, node);
  11:         break;

View Full Code Here
   1: import org.w3c.dom.Element;
   2: import org.w3c.dom.Node;
   3: import org.w3c.dom.NodeList;
   4:         ...
   5: 
   6:     protected static void applyImports(Document doc, Node imported)
   7:             throws Exception {
   8:         ...
   9:                 } else {
  10:                     imported.replaceChild(converted, element);
  11:                 }
  12:         ...
  13: 
  14:     public static Node draw(Document doc, String content) {

View Full Code Here
   1: import org.w3c.dom.Element;
   2: import org.w3c.dom.Node;
   3: import org.w3c.dom.NodeList;
   4:         ...
   5:     {
   6:         Node    html;
   7:         ...
   8:         Node    child;
   9:         Node    next;
  10:         ...
  11:                                 else
  12:                                     html.replaceChild( newBody, body );

View Full Code Here
   1: import org.w3c.dom.NamedNodeMap;
   2: import org.w3c.dom.Node;
   3: import org.xml.sax.SAXException;
   4:         ...
   5:         Element d = (Element) i.next();
   6:         Node parent = d.getParentNode();
   7:         parent.removeChild(d);
   8:         ...
   9:         Element element = (Element) i.next();
  10:         Node parent = element.getParentNode();
  11:         if (!reachableDefines.contains(parent))
  12:         ...
  13:                   .importNode(element, true);
  14:                 parent.replaceChild(element, externalRef);

View Full Code Here