use of org.w3c.dom.Text in project webservices-axiom by apache.
the class TestLookupNamespaceURIWithoutParent method runTest.
protected void runTest() throws Throwable {
Document document = dbf.newDocumentBuilder().newDocument();
Text text = document.createTextNode("test");
assertNull(text.lookupNamespaceURI("ns"));
}
use of org.w3c.dom.Text in project webservices-axiom by apache.
the class TestReplaceDataAppend method runTest.
protected void runTest() throws Throwable {
Document doc = dbf.newDocumentBuilder().newDocument();
Text text = doc.createTextNode("AB");
text.replaceData(2, 0, "CD");
assertThat(text.getData()).isEqualTo("ABCD");
}
use of org.w3c.dom.Text in project webservices-axiom by apache.
the class TestSplitTextWithoutParent method runTest.
@Override
protected void runTest() throws Throwable {
Document document = dbf.newDocumentBuilder().newDocument();
Text text = document.createTextNode("ABCD");
Text newText = text.splitText(2);
assertThat(text.getData()).isEqualTo("AB");
assertThat(newText.getData()).isEqualTo("CD");
assertThat(newText.getOwnerDocument()).isSameAs(document);
}
use of org.w3c.dom.Text in project webservices-axiom by apache.
the class TestSplitText method runTest.
protected void runTest() throws Throwable {
String textValue = "temp text value";
Document doc = dbf.newDocumentBuilder().newDocument();
Element element = doc.createElement("test");
Text txt = doc.createTextNode(textValue);
element.appendChild(txt);
txt.splitText(3);
assertNotNull("Text value missing in the original Text node", txt.getNodeValue());
assertNotNull("Sibling missing after split", txt.getNextSibling());
assertNotNull("Text value missing in the new split Text node", txt.getNextSibling().getNodeValue());
assertEquals("Incorrect split point", textValue.substring(0, 3), txt.getNodeValue());
assertEquals("Incorrect split point", textValue.substring(3, textValue.length()), txt.getNextSibling().getNodeValue());
}
use of org.w3c.dom.Text in project webservices-axiom by apache.
the class TestReplaceChildNotFound method runTest.
protected void runTest() throws Throwable {
Document document = dbf.newDocumentBuilder().newDocument();
Element root = document.createElementNS(null, "root");
root.appendChild(document.createElementNS(null, "child"));
Text node1 = document.createTextNode("test1");
Text node2 = document.createTextNode("test2");
try {
root.replaceChild(node2, node1);
fail("Expected DOMException");
} catch (DOMException ex) {
assertEquals(DOMException.NOT_FOUND_ERR, ex.code);
}
}
Aggregations