KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > xml > stream > events > XMLEvent


1 package javax.xml.stream.events;
2
3 import java.io.Writer JavaDoc;
4 import javax.xml.namespace.QName JavaDoc;
5 /**
6  * This is the base event interface for handling markup events.
7  * Events are value objects that are used to communicate the
8  * XML 1.0 InfoSet to the Application. Events may be cached
9  * and referenced after the parse has completed.
10  *
11  * @version 1.0
12  * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
13  * @see javax.xml.stream.XMLEventReader
14  * @see Characters
15  * @see ProcessingInstruction
16  * @see StartElement
17  * @see EndElement
18  * @see StartDocument
19  * @see EndDocument
20  * @see EntityReference
21  * @see EntityDeclaration
22  * @see NotationDeclaration
23  * @since 1.6
24  */

25 public interface XMLEvent extends javax.xml.stream.XMLStreamConstants {
26  
27   /**
28    * Returns an integer code for this event.
29    * @see #START_ELEMENT
30    * @see #END_ELEMENT
31    * @see #CHARACTERS
32    * @see #ATTRIBUTE
33    * @see #NAMESPACE
34    * @see #PROCESSING_INSTRUCTION
35    * @see #COMMENT
36    * @see #START_DOCUMENT
37    * @see #END_DOCUMENT
38    * @see #DTD
39    */

40   public int getEventType();
41
42   /**
43    * Return the location of this event. The Location
44    * returned from this method is non-volatile and
45    * will retain its information.
46    * @see javax.xml.stream.Location
47    */

48   javax.xml.stream.Location getLocation();
49
50   /**
51    * A utility function to check if this event is a StartElement.
52    * @see StartElement
53    */

54   public boolean isStartElement();
55
56   /**
57    * A utility function to check if this event is an Attribute.
58    * @see Attribute
59    */

60   public boolean isAttribute();
61
62   /**
63    * A utility function to check if this event is a Namespace.
64    * @see Namespace
65    */

66   public boolean isNamespace();
67
68
69   /**
70    * A utility function to check if this event is a EndElement.
71    * @see EndElement
72    */

73   public boolean isEndElement();
74
75   /**
76    * A utility function to check if this event is an EntityReference.
77    * @see EntityReference
78    */

79   public boolean isEntityReference();
80
81   /**
82    * A utility function to check if this event is a ProcessingInstruction.
83    * @see ProcessingInstruction
84    */

85   public boolean isProcessingInstruction();
86
87   /**
88    * A utility function to check if this event is Characters.
89    * @see Characters
90    */

91   public boolean isCharacters();
92
93   /**
94    * A utility function to check if this event is a StartDocument.
95    * @see StartDocument
96    */

97   public boolean isStartDocument();
98
99   /**
100    * A utility function to check if this event is an EndDocument.
101    * @see EndDocument
102    */

103   public boolean isEndDocument();
104
105   /**
106    * Returns this event as a start element event, may result in
107    * a class cast exception if this event is not a start element.
108    */

109   public StartElement asStartElement();
110
111   /**
112    * Returns this event as an end element event, may result in
113    * a class cast exception if this event is not a end element.
114    */

115   public EndElement asEndElement();
116
117   /**
118    * Returns this event as Characters, may result in
119    * a class cast exception if this event is not Characters.
120    */

121   public Characters asCharacters();
122
123   /**
124    * This method is provided for implementations to provide
125    * optional type information about the associated event.
126    * It is optional and will return null if no information
127    * is available.
128    */

129   public QName JavaDoc getSchemaType();
130
131   /**
132    * This method will write the XMLEvent as per the XML 1.0 specification as Unicode characters.
133    * No indentation or whitespace should be outputted.
134    *
135    * Any user defined event type SHALL have this method
136    * called when being written to on an output stream.
137    * Built in Event types MUST implement this method,
138    * but implementations MAY choose not call these methods
139    * for optimizations reasons when writing out built in
140    * Events to an output stream.
141    * The output generated MUST be equivalent in terms of the
142    * infoset expressed.
143    *
144    * @param writer The writer that will output the data
145    * @throws XMLStreamException if there is a fatal error writing the event
146    */

147   public void writeAsEncodedUnicode(Writer JavaDoc writer)
148     throws javax.xml.stream.XMLStreamException;
149
150 }
151
152
Popular Tags