Example usage for javax.xml.soap SOAPElement getChildNodes

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

Introduction

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

Prototype

public NodeList getChildNodes();

Source Link

Document

A NodeList that contains all children of this node.

Usage

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

@Validated
@Test/*from   ww  w  .j  av 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());
}

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

@Validated
@Test//from   w w  w . j a  v a2s.  co m
public void testGetValueTwoTextChildren() throws Exception {
    SOAPElement element = saajUtil.createSOAPElement(null, "test", null);
    element.addTextNode("foo");
    element.addTextNode("bar");
    assertEquals(2, element.getChildNodes().getLength());
    assertEquals("foobar", element.getValue());
}

From source file:com.twinsoft.convertigo.engine.translators.WebServiceTranslator.java

private void handleSimpleVariable(Document inputDocument, SOAPElement parameter, String parameterName,
        String parameterValue, Element transactionVariablesElement) {
    Element item = inputDocument.createElement("variable");
    item.setAttribute("name", parameterName);

    // Structured value?
    if (parameter.hasChildNodes() && (parameter.getChildNodes().getLength() > 1
            || parameter.getFirstChild().getNodeType() == Node.ELEMENT_NODE)) {
        appendNodes(parameter.getChildNodes(), item);
        Engine.logBeans.debug("   Adding structured requestable variable '" + parameterName + "'");
    } else {//from  ww w. j av a 2s. com
        item.setAttribute("value", parameterValue);
        Engine.logBeans.debug("   Adding requestable variable '" + parameterName + "' = '"
                + Visibility.maskValue(parameterValue) + "'");
    }
    transactionVariablesElement.appendChild(item);
}

From source file:org.apache.axis.message.NodeImpl.java

/**
 * The node immediately preceding this node. If there is no such node,
 * this returns <code>null</code>.
 *///from ww  w  .j a va2  s  . co m
public Node getPreviousSibling() {
    SOAPElement parent = getParentElement();
    if (parent == null) {
        return null;
    }
    NodeList nl = parent.getChildNodes();
    int len = nl.getLength();
    int i = 0;
    Node previousSibling = null;
    while (i < len) {
        if (nl.item(i) == this) {
            return previousSibling;
        }
        previousSibling = nl.item(i);
        i++;
    }
    return previousSibling; // should be null.
}