⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 parseevent.java

📁 一个即时消息系统的源码(J2ME编程部分)。
💻 JAVA
字号:
package org.kxml.parser;import java.util.*;import java.io.IOException;import org.kxml.*;/** Abstract superclass for all pull parser events.  In order to avoid    some typecasts, this class already provides most of the content    access methods filled in the specialized subclasses.  */ public abstract class ParseEvent {    int lineNumber = -1;     /** returns the line number of the event */    public int getLineNumber () {	return lineNumber;    }    /** returns the event type integer constant assigned to this        event.  Possible event types are Xml.START_TAG, Xml.END_TAG,        Xml.TEXT, Xml.PROCESSING_INSTRUCTION, Xml.COMMENT,        Xml.DOCTYPE, and Xml.END_DOCUMENT */	    public abstract int getType ();        /** returns true if the event is the matching endtag, false if the	event is an empty(!) text event, a comment or a processing	instruction.  Throws an exception if the event is not	ignoreable. Useful in the default handler of a case construct	when all relevant events are already picked out */    public abstract boolean endCheck (StartTag start);         /** sets the line number of the event. Used by the parser only. */    public void setLineNumber (int lineNumber) {	this.lineNumber = lineNumber;    }   /** In the event type is START_TAG, this method returns the attribute        at the given index position. For all other event       types, or if the index is out of range, an exception is thrown. */    public Attribute getAttribute (int index) {	throw new RuntimeException ("Only start tag events can have attributes.");    }            /** convenience method for getAttribute (null, name). */    public Attribute getAttribute (String name) {	return null;    }    /** If the event type is START_TAG, the local attribute with the	given namespace and name is returned.  For all other event	types, the return value is null. */    public Attribute getAttribute (String namespace, String name) {	return null;    }    /** If the event type is START_TAG, the number of attributes is	returned. For all other event types, the return value is null */    public int getAttributeCount () {	return 0;    }    /** returns the attribute vector. Returns null if not         instance of startTag */    public Vector getAttributes () {	return null;    }    /** returns the (local) name of the element started if        instance of StartTag, null otherwise. */    public String getName () {	return null;    }    /** returns namespace if instance of StartTag, null        otherwise. */     public String getNamespace () {	return null;    }    /** Returns the value of the attribute with the given name.	Throws an exception if not instanceof StartTag or if not	existing. In order to get a null value for not existing	attributes, please call getValueDefault (attrName, null)	instead. */    public String getValue (String attrname) {	throw new RuntimeException ("Only start tags events can have attributes");    }    /** Returns the value of the given attribute or the given	default value, if the attribute is not existing. */    public String getValueDefault (String attrName, String dflt) {	return dflt;    }    /** If the event type is TEXT, PROCESSING_INSTRUCTION,	or DOCTYPE, the corresponding string is returned. For	all othe event types, null is returned. */    public String getText () {	return null;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -