Example usage for javax.xml.soap SOAPElement hasChildNodes

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

Introduction

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

Prototype

public boolean hasChildNodes();

Source Link

Document

Returns whether this node has any children.

Usage

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 w  w  w.j a v  a  2 s.  c om*/
        item.setAttribute("value", parameterValue);
        Engine.logBeans.debug("   Adding requestable variable '" + parameterName + "' = '"
                + Visibility.maskValue(parameterValue) + "'");
    }
    transactionVariablesElement.appendChild(item);
}

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  w  w.  ja  v  a  2  s.  com*/
    // 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);
    }
}