public RegionParser newInstance() { XMLSourceParser newInstance = new XMLSourceParser(); newInstance.setTokenizer(getTokenizer().newInstance()); return newInstance; }
/** * Return the full list of known regions. Typically getNodes should be * used instead of this method. */ public List getRegions() { IStructuredDocumentRegion headNode = null; if (!getTokenizer().isEOF()) { headNode = getDocumentRegions(); // throw new IllegalStateException("parsing has not finished"); } // for memory recovery, we assume if someone // requests all regions, we can reset our big // memory consuming objects // but the new "getRegions" method is then more expensive. // I don't think its used much, though. List localRegionsList = getRegions(headNode); primReset(); return localRegionsList; }
/** * Resets the input. */ public void reset(java.io.Reader reader) { reset(reader, 0); }
/** * Resets the input. */ public void reset(java.io.FileInputStream instream) { primReset(); // fInput = instream; getTokenizer().reset(instream); }
String type = null; while ((region = getNextRegion()) != null) { type = region.getType(); fireNodeParsed(currentNode); currentNode = createStructuredDocumentRegion(type); if (lastNode != null) { lastNode.setNext(currentNode); fireNodeParsed(currentNode); currentNode = createStructuredDocumentRegion(type); if (lastNode != null) { lastNode.setNext(currentNode); currentNode = createStructuredDocumentRegion(type); currentNode.setStart(region.getStart()); fireNodeParsed(currentNode); currentNode.setPrevious(lastNode); primReset(); return headNode;
public RegionParser getParser() { return new XMLSourceParser(); }
protected void primReset() { // fNodes = null; // fRegions = null; // fInput = null; fStringInput = null; fCharSequenceSource = null; fDocumentInput = null; fOffset = 0; // fCurrentNode = null; // DMW: also reset tokenizer so it doesn't hold on // to large arrays getTokenizer().reset(new char[0]); }
@Override public IStructuredDocumentRegion getDocumentRegions() { return super.getDocumentRegions(); }
/** * Convenience method to add tag names using BlockMarker object */ protected void addHTMLishTag(XMLSourceParser parser, String tagname) { BlockMarker bm = new BlockMarker(tagname, null, DOMRegionContext.BLOCK_TEXT, false); parser.addBlockMarker(bm); }
/** */ protected boolean isCDATAContainer() { // use BlockMaker instead of CMElementDeclaration // because <style> and <script> in XHTML is not CDATA content type IDOMModel model = getModel(); if (model == null) return false; // error IStructuredDocument structuredDocument = model.getStructuredDocument(); if (structuredDocument == null) return false; // eror RegionParser parser = structuredDocument.getParser(); if (parser == null || !(parser instanceof XMLSourceParser)) return false; return (((XMLSourceParser) parser).getBlockMarker(this.tagName) != null); /* * CMElementDeclaration decl = getDeclaration(); if (decl == null) * return false; if (decl instanceof CMNodeWrapper) { decl = * (CMElementDeclaration)((CMNodeWrapper)decl).getOriginNode(); if * (decl == null) return false; } if (decl instanceof * TLDElementDeclaration) { String content = * ((TLDElementDeclaration)decl).getBodycontent(); if (content == * null) return false; return * content.equals(JSP11TLDNames.CONTENT_TAGDEPENDENT); } if * (!isGlobalTag()) return false; return (decl.getContentType() == * CMElementDeclaration.CDATA); */ }
public RegionParser getParser() { XMLSourceParser parser = new XMLSourceParser(); // for the "static HTML" case, we need to initialize // Blocktags here. addHTMLishTag(parser, "script"); //$NON-NLS-1$ addHTMLishTag(parser, "style"); //$NON-NLS-1$ return parser; }
/** * Resets the input. */ public void reset(java.io.Reader reader, int position) { primReset(); fOffset = position; getTokenizer().reset(reader, position); if (reader instanceof DocumentReader) { IDocument doc = ((DocumentReader) reader).getDocument(); if (doc instanceof CharSequence) { fCharSequenceSource = (CharSequence) doc; } else { // old fashioned IDocument fDocumentInput = ((DocumentReader) reader).getDocument(); } } else if (reader instanceof CharSequenceReader) { fCharSequenceSource = ((CharSequenceReader) reader).getOriginalSource(); } }
public void addBlockMarker(BlockMarker marker) { getTokenizer().addBlockMarker(marker); }
/** * Convenience method to add tag names using BlockMarker object */ protected void addHTMLishTag(XMLSourceParser parser, String tagname) { BlockMarker bm = new BlockMarker(tagname, null, DOMRegionContext.BLOCK_TEXT, false); parser.addBlockMarker(bm); }
@Override public void reset(Reader reader, int position) { super.reset(reader, position); }
public void beginBlockScan(String newTagName) { getTokenizer().beginBlockTagScan(newTagName); }
/** * Resets the input. Use this version to allow text to be retrieved * <em>during</em> parsing, such as by the * StructuredDocumentRegionHandler. */ public void reset(String sourceString) { reset(new StringReader(sourceString)); fStringInput = sourceString; }
public List getBlockMarkers() { return getTokenizer().getBlockMarkers(); }
/** * Resets the input. Use this version to allow text to be retrieved * <em>during</em> parsing, such as by the * StructuredDocumentRegionHandler. */ public void reset(String sourceString, int position) { StringReader reader = new StringReader(sourceString); reset(reader, position); fStringInput = sourceString; }
public void removeBlockMarker(BlockMarker marker) { getTokenizer().removeBlockMarker(marker); }