KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > $packageName$ > XMLScanner


1 package $packageName$;
2
3 import org.eclipse.jface.text.rules.*;
4 import org.eclipse.jface.text.*;
5
6 public class XMLScanner extends RuleBasedScanner {
7
8     public XMLScanner(ColorManager manager) {
9         IToken procInstr =
10             new Token(
11                 new TextAttribute(
12                     manager.getColor(IXMLColorConstants.PROC_INSTR)));
13
14         IRule[] rules = new IRule[2];
15         //Add rule for processing instructions
16
rules[0] = new SingleLineRule("<?", "?>", procInstr);
17         // Add generic whitespace rule.
18
rules[1] = new WhitespaceRule(new XMLWhitespaceDetector());
19
20         setRules(rules);
21     }
22 }
23
Popular Tags