/** * createCDATASection method * * @return org.w3c.dom.CDATASection * @param data * java.lang.String */ public CDATASection createCDATASection(String data) throws DOMException { // allow CDATA section // if (!isXMLType()) { // throw new DOMException(DOMException.NOT_SUPPORTED_ERR, new // String()); // } CDATASectionImpl cdata = new CDATASectionImpl(); cdata.setOwnerDocument(this); if (data != null) cdata.setData(data); return cdata; }
/** * getData method * * @return java.lang.String */ public String getData() throws DOMException { // instead of super(TextImpl).getData(), call getCharacterData() String data = getCharacterData(); if (data == null) { data = getData(getStructuredDocumentRegion()); if (data == null) data = new String(); } return data; }
/** * cloneNode method * * @return org.w3c.dom.Node * @param deep * boolean */ public Node cloneNode(boolean deep) { CDATASectionImpl cloned = new CDATASectionImpl(this); notifyUserDataHandlers(UserDataHandler.NODE_CLONED, cloned); return cloned; }
/** */ public boolean isClosed() { IStructuredDocumentRegion flatNode = getStructuredDocumentRegion(); if (flatNode == null) return true; // will be generated String regionType = StructuredDocumentRegionUtil.getLastRegionType(flatNode); return (regionType == DOMRegionContext.XML_CDATA_CLOSE); } }
/** * insertCDATASection method * */ private void insertCDATASection(IStructuredDocumentRegion flatNode) { ITextRegionList regions = flatNode.getRegions(); if (regions == null) return; CDATASectionImpl cdata = null; try { cdata = (CDATASectionImpl) this.model.getDocument().createCDATASection(null); } catch (DOMException ex) { } if (cdata == null) { // CDATA section might not be supported insertInvalidDecl(flatNode); // regard as invalid decl return; } cdata.setStructuredDocumentRegion(flatNode); insertNode(cdata); }