Example usage for javax.xml.soap SOAPElement getTextContent

List of usage examples for javax.xml.soap SOAPElement getTextContent

Introduction

In this page you can find the example usage for javax.xml.soap SOAPElement getTextContent.

Prototype

public String getTextContent() throws DOMException;

Source Link

Document

This attribute returns the text content of this node and its descendants.

Usage

From source file:com.googlecode.ddom.frontend.saaj.SOAPElementTest.java

/**
 * Checks the behavior of {@link SOAPElement#addTextNode(String)} when called with a string that
 * contains a character that is invalid according to the XML specification. The reference
 * implementation doesn't check for invalid characters.
 * /*from w w  w  .  j ava  2s. c om*/
 * @throws Exception
 */
@Validated
@Test
public void testAddTextNodeWithInvalidChar() throws Exception {
    SOAPElement element = saajUtil.createSOAPElement(null, "test", null);
    String testString = String.valueOf((char) 24);
    element.addTextNode(testString);
    assertEquals(testString, element.getTextContent());
}

From source file:com.googlecode.ddom.frontend.saaj.SOAPElementTest.java

@Validated
@Test//from w ww  .jav  a  2  s.  c om
public void testAddTextNode() throws Exception {
    SOAPElement element = saajUtil.createSOAPElement(null, "test", null);
    SOAPElement returnValue = element.addTextNode("text");
    assertSame(element, returnValue);
    assertEquals("text", element.getTextContent());
}

From source file:com.googlecode.ddom.frontend.saaj.SOAPElementTest.java

@Validated
@Test/*from ww  w  .  ja  v  a 2 s  .c o  m*/
public void testAddTextNode2() throws Exception {
    SOAPElement element = saajUtil.createSOAPElement(null, "test", null);
    element.addTextNode("ABC");
    element.addTextNode("DEF");
    assertEquals(2, element.getChildNodes().getLength());
    assertEquals("ABCDEF", element.getTextContent());
}