Package org.w3c.dom

Examples of org.w3c.dom.Comment


        // It's a collection, but nothing in this message for it collection...
        return -1;
    }

    private Element getClonePoint(Element element) {
        Comment comment;

        // Is it this element...
        comment = YADOMUtil.getCommentBefore(element);
        if(comment != null && comment.getTextContent().endsWith(OGNLUtils.SOAPUI_CLONE_COMMENT)) {
            comment.setTextContent(comment.getTextContent() + OGNLUtils.CLONED_POSTFIX);
            return element;
        }

        // Is it the first child element of this element...
        Element firstChildElement = YADOMUtil.getFirstChildElement(element);
        if(firstChildElement != null) {
            Element lastChildElement = YADOMUtil.getLastChildElement(element);
            comment = YADOMUtil.getCommentBefore(firstChildElement);
            if(comment != null && comment.getTextContent().endsWith(OGNLUtils.SOAPUI_CLONE_COMMENT)
                && lastChildElement != null && firstChildElement.getTagName().equals(lastChildElement.getTagName())) {
                comment.setTextContent(comment.getTextContent() + OGNLUtils.CLONED_POSTFIX);
                return firstChildElement;
            }
        }

        return null;
View Full Code Here


        return null;
    }

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

        if(comment == null) {
            throw new IllegalStateException("Call to reset a 'clonePoint' that doesn't have a comment before it.");
        }

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

        comment.setTextContent(commentText.substring(0, commentText.length() - OGNLUtils.CLONED_POSTFIX.length()));
    }
View Full Code Here

                            element.getOwnerDocument().getDocumentElement().setAttributeNS(XMLNS_URI, XMLNS_XSI, XMLSCHEMA_INSTANCE_URI);
                            element.setAttributeNS(XMLSCHEMA_INSTANCE_URI, XSI_NIL, "true");
                            //Remove the soapUI's '?' text
                            element.removeChild(node);
                        } else {
                            Comment comment = YADOMUtil.getCommentBefore(element);
                            if(comment != null && comment.getTextContent().endsWith(SOAPUI_OPTIONAL_COMMENT)) {
                                //If it is optional do not generate the element
                                parent.removeChild(comment);
                                Comment clone = (Comment) comment.cloneNode(true);
                                clone.setTextContent(comment.getTextContent() + REMOVE_POSTFIX);
                                parent.insertBefore(clone, element);
                            } else {
                                //If it is required generate empty element
                                //Remove the soapUI's '?' text
                                element.removeChild(node);
                            }
                        }
                    } else {
                        element.removeChild(node);
                        element.appendChild(element.getOwnerDocument().createTextNode(param.toString()));
                    }
                }
            } else if (node != null && node.getNodeType() == Node.ELEMENT_NODE) {
                NamedNodeMap attributes = node.getAttributes();
                injectAttributeParameters(params, soapNs, node, attributes);
                injectParameters((Element) node, params, soapNs, nils);
                Comment comment = YADOMUtil.getCommentBefore((Element) node);
                if(comment != null && comment.getTextContent().endsWith(SOAPUI_OPTIONAL_COMMENT + REMOVE_POSTFIX)) {
                    Node parent = node.getParentNode();
                    parent.removeChild(node);
                    parent.removeChild(comment);
                    childCount -= 2;
                    i -= 2;
View Full Code Here

     */
    private static boolean assertIsCollection(Element element) {
        Node parent = element.getParentNode();
        if (parent != null && parent.getNodeType() == Node.ELEMENT_NODE) {
            Element firstSibling = YADOMUtil.getFirstChildElementByName((Element) parent, element.getTagName());
            Comment commentBefore = YADOMUtil.getCommentBefore(firstSibling);

            if(commentBefore != null
                && (commentBefore.getTextContent().endsWith(SOAPUI_CLONE_COMMENT)
                    || commentBefore.getTextContent().endsWith(SOAPUI_CLONE_COMMENT + CLONED_POSTFIX))) {
                return true;
            }
        }

        return false;
View Full Code Here

            if(pelement.getAttributeNS(JBOSSESB_SOAP_NS, IS_COLLECTION_ATTRIB).equals("true")) {
                // It's already been attributed... no need to check for the soapui comment...
                return true;
            }

            Comment comment = (Comment)YADOMUtil.getFirstChildByType(pelement, Node.COMMENT_NODE);
            if (comment != null
                && comment.getTextContent().endsWith(SOAPUI_CLONE_COMMENT)) {
                //possible array
                Element first = YADOMUtil.getFirstChildElement(pelement);
                Element last = YADOMUtil.getLastChildElement(pelement);
                if (first != null && last != null && first.getTagName().equals(last.getTagName())) {
                    //The children are of same tag so it is an array
View Full Code Here

                    Element propertyElem = UtilXml.addChildElement(resourceElem, "property", resourceDocument);
                    propertyElem.setAttribute("key", StringUtil.fromHtmlToSpecialChars(labelInfo.getLabelKey(), true, true, false));

                    if (UtilValidate.isNotEmpty(labelInfo.getLabelKeyComment())) {
                        Comment labelKeyComment = resourceDocument.createComment(StringUtil.fromHtmlToSpecialChars(labelInfo.getLabelKeyComment(), true, true, false));
                        Node parent = propertyElem.getParentNode();
                        parent.insertBefore(labelKeyComment, propertyElem);
                    }

                    for (String localeFound : localesFound) {
                        LabelValue labelValue = labelInfo.getLabelValue(localeFound);
                        String valueString = null;
                        if (labelValue != null) {
                            valueString = labelValue.getLabelValue();
                        }
                        if (UtilValidate.isNotEmpty(valueString)) {
                            valueString = StringUtil.fromHtmlToSpecialChars(valueString, true, true, true);
                            Element valueElem = UtilXml.addChildElementValue(propertyElem, "value", valueString, resourceDocument);;
                            valueElem.setAttribute("xml:lang", localeFound);
                            if (valueString.trim().length() == 0) {
                                valueElem.setAttribute("xml:space", "preserve");
                            }
                            if (UtilValidate.isNotEmpty(labelValue.getLabelComment())) {
                                Comment labelComment = resourceDocument.createComment(StringUtil.fromHtmlToSpecialChars(labelValue.getLabelComment(), true, true, false));
                                Node parent = valueElem.getParentNode();
                                parent.insertBefore(labelComment, valueElem);
                            }
                        }
                    }
View Full Code Here

    //


    public void comment( char[] ch, int start, int length ) throws SAXException {
       
        Comment commentNode = this.domFactory.createComment(new String(ch, start, length));

        if (debug) {
            System.out.println(this.getClass().getName() + ": comment(...)");
        }
       
View Full Code Here

                fDeferredDocumentImpl.appendChild(fCurrentNodeIndex, comment);
            }

            // full node expansion
            else {
                Comment comment = fDocument.createComment(fStringPool.orphanString(dataIndex));
                fCurrentElementNode.appendChild(comment);
            }
        }

    } // comment(int)
View Full Code Here

            fDeferredDocumentImpl.appendChild(fCurrentNodeIndex, comment);
        }

        // full node expansion
        else {
            Comment comment = fDocument.createComment(fStringPool.orphanString(dataIndex));
            fCurrentElementNode.appendChild(comment);
        }

    } // comment(int)
View Full Code Here

    /**
     * Lexical Handler method to create comment node in DOM tree.
     */
    public void comment(char[] ch, int start, int length) {
        final Node last = nodeStk.peek();
        Comment comment = document.createComment(new String(ch, start, length));
        if (comment != null) {
            if (last == root && nextSibling != null) {
                last.insertBefore(comment, nextSibling);
            } else {
                last.appendChild(comment);
View Full Code Here

TOP

Related Classes of org.w3c.dom.Comment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.