/** * createComment method * * @return org.w3c.dom.Comment * @param data * java.lang.String */ public Comment createComment(String data) { CommentImpl comment = new CommentImpl(); comment.setOwnerDocument(this); if (data != null) comment.setData(data); return comment; }
/** * getData method * * @return java.lang.String */ public String getData() throws DOMException { String data = getCharacterData(); if (data == null) { data = getData(getStructuredDocumentRegion()); if (data == null) data = new String(); } return data; }
/** */ public boolean isClosed() { IStructuredDocumentRegion flatNode = getStructuredDocumentRegion(); if (flatNode == null) return true; // will be generated String regionType = StructuredDocumentRegionUtil.getLastRegionType(flatNode); return (regionType == DOMRegionContext.XML_COMMENT_CLOSE || isNestedCommentClose(regionType)); }
/** * cloneNode method * * @return org.w3c.dom.Node * @param deep * boolean */ public Node cloneNode(boolean deep) { CommentImpl cloned = new CommentImpl(this); notifyUserDataHandlers(UserDataHandler.NODE_CLONED, cloned); return cloned; }
/** * setJSPTag method * * @param isJSPTag * boolean */ public void setJSPTag(boolean isJSPTag) { if (isJSPTag == this.isJSPTag) return; if (!isDataEditable()) { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); } DocumentImpl document = (DocumentImpl) getOwnerDocument(); if (isJSPTag) { if (document == null || !document.isJSPType()) return; } this.isJSPTag = isJSPTag; if (getContainerDocument() != null) { // already in the tree, update IStructuredDocument setData(getData()); // calls notifyValueChanged(); } } }
protected void setOwnerDocument(Document ownerDocument) { super.setOwnerDocument(ownerDocument); }
/** * generateComment method * * @return java.lang.String * @param comment * org.w3c.dom.Comment */ public String generateComment(Comment comment) { if (comment == null) return null; String data = comment.getData(); int length = (data != null ? data.length() : 0); StringBuffer buffer = new StringBuffer(length + 8); CommentImpl impl = (CommentImpl) comment; if (!impl.isJSPTag()) buffer.append(COMMENT_OPEN); else buffer.append(JSPTag.COMMENT_OPEN); if (data != null) buffer.append(data); if (!impl.isJSPTag()) buffer.append(COMMENT_CLOSE); else buffer.append(JSPTag.COMMENT_CLOSE); return buffer.toString(); }
if (comment.isJSPTag()) return JSPTag.COMMENT_CLOSE; return COMMENT_CLOSE;