Example usage for org.w3c.dom Comment setNodeValue

List of usage examples for org.w3c.dom Comment setNodeValue

Introduction

In this page you can find the example usage for org.w3c.dom Comment setNodeValue.

Prototype

public void setNodeValue(String nodeValue) throws DOMException;

Source Link

Document

The value of this node, depending on its type; see the table above.

Usage

From source file:com.wfreitas.camelsoap.SoapClient.java

private Element getClonePoint(Element element) {
    Comment comment;

    // Is it this element...
    comment = getCommentBefore(element);
    if (comment != null && comment.getNodeValue().endsWith(SOAPUI_CLONE_COMMENT)) {
        comment.setNodeValue(comment.getNodeValue() + CLONED_POSTFIX);
        return element;
    }//w  w  w .j a  va  2  s.com

    // Is it the first child element of this element...
    Element firstChildElement = getFirstChildElement(element);
    if (firstChildElement != null) {
        comment = getCommentBefore(firstChildElement);
        if (comment != null && comment.getNodeValue().endsWith(SOAPUI_CLONE_COMMENT)) {
            comment.setNodeValue(comment.getNodeValue() + CLONED_POSTFIX);
            return firstChildElement;
        }
    }

    return null;
}

From source file:com.wfreitas.camelsoap.SoapClient.java

private void resetClonePoint(Element clonePoint) {
    Comment comment = getCommentBefore(clonePoint);

    if (comment == null) {
        throw new IllegalStateException("Call to reset a 'clonePoint' that doesn't have a comment before it.");
    }/* ww  w.  j  av a2s  .co m*/

    String commentText = comment.getNodeValue();
    if (!commentText.endsWith(CLONED_POSTFIX)) {
        throw new IllegalStateException(
                "Call to reset a 'clonePoint' that doesn't have a proper clone comment before it.");
    }

    comment.setNodeValue(commentText.substring(0, commentText.length() - CLONED_POSTFIX.length()));
}