* @throws Exception
*/
public void process(InputStream in, AbstractSAXTransformer sax, int spacesPerTab)
throws Exception
{
XmlHighlighter highlighter = new XmlHighlighter();
Reader isr = new InputStreamReader(in);
BufferedReader r = new BufferedReader(isr);
String line;
String token;
int length;
int style;
String css_class;
String previous_class = null;
int previous_style = 0;
// Read source line by line and apply styles
while ((line = r.readLine()) != null)
{
line += "\n";
line = StringUtils.convertTabsToSpaces(line, spacesPerTab);
Reader lineReader = new StringReader(line);
highlighter.setReader(lineReader);
int index = 0;
while (index < line.length())
{
style = highlighter.getNextToken();
length = highlighter.getTokenLength();
token = line.substring(index, index + length);
if (style != previous_style)
{
css_class = getCssClass(style);