use of org.eclipse.wst.xml.core.internal.parser.XMLLineTokenizer in project webtools.sourceediting by eclipse.
the class StreamingMarkupValidator method validateFile.
/**
* Validates the given file. It will stream the contents of the file without creating a model for the file; it will only
* use existing
* @param file the file to validate
* @param reporter the reporter
*/
private void validateFile(IFile file, IReporter reporter) {
Message message = new LocalizedMessage(IMessage.LOW_SEVERITY, file.getFullPath().toString().substring(1));
reporter.displaySubtask(StreamingMarkupValidator.this, message);
XMLLineTokenizer tokenizer = null;
try {
tagStack = new Stack();
model = StructuredModelManager.getModelManager().getExistingModelForRead(file);
try {
if (model == null) {
tokenizer = new XMLLineTokenizer(new BufferedReader(new InputStreamReader(file.getContents(true), getCharset(file))));
} else {
tokenizer = new XMLLineTokenizer(new BufferedReader(new DocumentReader(model.getStructuredDocument())));
}
checkTokens(tokenizer, reporter);
} finally {
if (model != null) {
model.releaseFromRead();
model = null;
}
}
} catch (UnsupportedEncodingException e) {
} catch (CoreException e) {
} catch (IOException e) {
}
}
Aggregations