package org.kxml.parser; import java.io.IOException; import org.kxml.*; /** A class for events indicating character data like "normal" text or ignorable whitespace. */ public class TextEvent extends ParseEvent { int type; String text; public TextEvent (int type, String text) { this.type = type; this.text = text; } /** returns the actual character data as String. */ public String getText () { return text; } /** returns Xml.TEXT_EVENT */ public int getType () { return type; } public boolean endCheck (StartTag start) { if (type != Xml.WHITESPACE) throw new RuntimeException ("unexpected text: '"+text+"'"); return false; } public String toString () { return text; } }