public Node replaceChild(Node arg0, Node arg1) throws DOMException { return delegate.replaceChild(arg0, arg1); }
elem2.setAttribute("title", "new element"); appendedChild = docFrag.appendChild(elem2); replaced = (Element) docFrag.replaceChild(elem, elem2); title = replaced.getAttribute("title"); assertEquals("nodereplacechild15", "new element", title);
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; DocumentFragment docFrag; EntityReference entRef; Element elem; Element replaced; String nodeName; Node appendedChild; doc = (Document) load("hc_staff", true); docFrag = doc.createDocumentFragment(); elem = doc.createElementNS("http://www.w3.org/1999/xhtml", "dom3:p"); entRef = doc.createEntityReference("alpha"); appendedChild = elem.appendChild(entRef); appendedChild = docFrag.appendChild(elem); replaced = (Element) docFrag.replaceChild(entRef, elem); nodeName = replaced.getNodeName(); assertEquals("nodereplacechild19", "dom3:p", nodeName); } /**
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; DocumentFragment docFrag; Element elem; Text txt; Element replaced; String nodeName; Node appendedChild; doc = (Document) load("hc_staff", true); elem = doc.createElementNS("http://www.w3.org/1999/xhtml", "dom3:p"); docFrag = doc.createDocumentFragment(); txt = doc.createTextNode("Comment"); appendedChild = docFrag.appendChild(txt); appendedChild = docFrag.appendChild(elem); replaced = (Element) docFrag.replaceChild(txt, elem); nodeName = replaced.getNodeName(); assertEquals("nodereplacechild16", "dom3:p", nodeName); } /**
@Override public Node replaceChild(Node newChild, Node oldChild) throws DOMException { Node node = soapDocument.importNode(newChild, true); return soapDocument.findIfPresent(documentFragment.replaceChild(getDomNode(node), getDomNode(oldChild))); } @Override
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; DocumentFragment docFrag; Attr attr; Element elem; Element replaced; String nodeName; Node appendedChild; doc = (Document) load("hc_staff", true); docFrag = doc.createDocumentFragment(); elem = doc.createElementNS("http://www.w3.org/1999/xhtml", "dom3:p"); attr = doc.createAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:lang"); appendedChild = docFrag.appendChild(elem); { boolean success = false; try { replaced = (Element) docFrag.replaceChild(attr, elem); } catch (DOMException ex) { success = (ex.code == DOMException.HIERARCHY_REQUEST_ERR); } assertTrue("throw_HIERARCHY_REQUEST_ERR", success); } } /**
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; DocumentFragment docFrag; ProcessingInstruction pi; Comment cmt; Comment replacedCmt; ProcessingInstruction replacedPi; String data; String target; Node appendedChild; doc = (Document) load("hc_staff", true); docFrag = doc.createDocumentFragment(); cmt = doc.createComment("Comment"); pi = doc.createProcessingInstruction("target", "Comment"); appendedChild = docFrag.appendChild(pi); appendedChild = docFrag.appendChild(cmt); replacedCmt = (Comment) docFrag.replaceChild(pi, cmt); data = replacedCmt.getData(); assertEquals("nodereplacechild17_1", "Comment", data); replacedPi = (ProcessingInstruction) docFrag.replaceChild(cmt, pi); target = replacedPi.getTarget(); assertEquals("nodereplacechild17_2", "target", target); } /**
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; DocumentFragment docFrag; EntityReference entRef; CDATASection cdata; CDATASection replacedCData; EntityReference replacedEref; String cdataName; String erefName; Node appendedChild; doc = (Document) load("hc_staff", true); docFrag = doc.createDocumentFragment(); cdata = doc.createCDATASection("CDATASection"); entRef = doc.createEntityReference("alpha"); appendedChild = docFrag.appendChild(entRef); appendedChild = docFrag.appendChild(cdata); replacedCData = (CDATASection) docFrag.replaceChild(entRef, cdata); cdataName = replacedCData.getNodeValue(); assertEquals("nodereplacechild18_1", "CDATASection", cdataName); replacedEref = (EntityReference) docFrag.replaceChild(cdata, entRef); erefName = replacedEref.getNodeName(); assertEquals("nodereplacechild18_2", "alpha", erefName); } /**