Example usage for javax.xml.soap Text getValue

List of usage examples for javax.xml.soap Text getValue

Introduction

In this page you can find the example usage for javax.xml.soap Text getValue.

Prototype

public String getValue();

Source Link

Document

Returns the value of this node if this is a Text node or the value of the immediate child of this node otherwise.

Usage

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

@Validated
@Test/*w  w  w  .j  a va 2  s . c o m*/
public void testSetValueSingleTextChild() throws Exception {
    SOAPElement element = saajUtil.createSOAPElement(null, "test", null);
    element.addTextNode("initial content");
    Text text = (Text) element.getFirstChild();
    String value = "new value";
    element.setValue(value);
    assertEquals(value, text.getValue());
}

From source file:org.jbpm.bpel.integration.soap.SoapUtil.java

public static void copyChildNodes(Element target, SOAPElement source) {
    // easy way out: no child nodes to copy
    if (!source.hasChildNodes())
        return;//w ww.  j av a  2s. co  m
    // traverse child nodes
    Iterator childIt = source.getChildElements();
    while (childIt.hasNext()) {
        Object child = childIt.next();
        if (child instanceof SOAPElement) {
            copyChildElement(target, (SOAPElement) child);
        } else if (child instanceof Text) {
            Text childText = (Text) child;
            String value = childText.getValue();
            target.appendChild(target.getOwnerDocument().createTextNode(value));
            if (traceEnabled)
                log.trace("appended text: " + value);
        } else
            log.debug("discarding child: " + child);
    }
}