Statistics
| Revision:

root / branches / Mobile1.0 / org.gvsig.gpe.xml / src / org / gvsig / gpe / xml / stream / IXmlStreamReader.java @ 79

History | View | Annotate | Download (6.18 KB)

1
package org.gvsig.gpe.xml.stream;
2

    
3
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
4
 *
5
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
6
 *
7
 * This program is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU General Public License
9
 * as published by the Free Software Foundation; either version 2
10
 * of the License, or (at your option) any later version.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU General Public License
18
 * along with this program; if not, write to the Free Software
19
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
20
 *
21
 * For more information, contact:
22
 *
23
 *  Generalitat Valenciana
24
 *   Conselleria d'Infraestructures i Transport
25
 *   Av. Blasco Ib??ez, 50
26
 *   46010 VALENCIA
27
 *   SPAIN
28
 *
29
 *      +34 963862235
30
 *   gvsig@gva.es
31
 *      www.gvsig.gva.es
32
 *
33
 *    or
34
 *
35
 *   IVER T.I. S.A
36
 *   Salamanca 50
37
 *   46005 Valencia
38
 *   Spain
39
 *
40
 *   +34 963163400
41
 *   dac@iver.es
42
 */
43
/* CVS MESSAGES:
44
 *
45
 * $Id: IXmlStreamReader.java 19593 2008-03-12 17:23:30Z groldan $
46
 * $Log$
47
 */
48

    
49
import javax.xml.namespace.QName;
50

    
51
import org.gvsig.gpe.parser.IGPEContentHandler;
52

    
53
/**
54
 * Represents an abstraction layer over a concrete XML parsing technology.
55
 * <p>
56
 * This interface provides a pull like approach to parsing xml formatted documents for the libGPE
57
 * library, yet allowing to interchange implementations which can be based, for example, in XML SAX,
58
 * XML Pull, Binary XML, etc.
59
 * </p>
60
 * <p>
61
 * Note at this time this interface contract is made just of the methods from XmlPullParser that
62
 * where already used so far in the libGPE-GML and libGPE-KML modules. The intention is to first
63
 * introduce this abstraction layer and then evolve it as needed to support an intermediate level of
64
 * abstraction between actual xml parsing and {@link IGPEContentHandler}, while keeping the unit
65
 * tests passing all the time. So this is work in progress and expected to change dramatically,
66
 * though ensuring no functional breackages in any time.
67
 * </p>
68
 * 
69
 * @author Gabriel Roldan (TOPP)
70
 * @version $Id: IXmlStreamReader.java 19593 2008-03-12 17:23:30Z groldan $
71
 */
72
public interface IXmlStreamReader {
73

    
74
    /**
75
     * Indicates an event is a start element
76
     * 
77
     * @see javax.xml.stream.events.StartElement
78
     */
79
    public static final int START_ELEMENT = 1;
80
    /**
81
     * Indicates an event is an end element
82
     * 
83
     * @see javax.xml.stream.events.EndElement
84
     */
85
    public static final int END_ELEMENT = 2;
86
    /**
87
     * Indicates an event is a processing instruction
88
     * 
89
     * @see javax.xml.stream.events.ProcessingInstruction
90
     */
91
    public static final int PROCESSING_INSTRUCTION = 3;
92

    
93
    /**
94
     * Indicates an event is characters
95
     * 
96
     * @see javax.xml.stream.events.Characters
97
     */
98
    public static final int CHARACTERS = 4;
99

    
100
    /**
101
     * Indicates an event is a comment
102
     * 
103
     * @see javax.xml.stream.events.Comment
104
     */
105
    public static final int COMMENT = 5;
106

    
107
    /**
108
     * The characters are white space (see [XML], 2.10 "White Space Handling"). Events are only
109
     * reported as SPACE if they are ignorable white space. Otherwise they are reported as
110
     * CHARACTERS.
111
     * 
112
     * @see javax.xml.stream.events.Characters
113
     */
114
    public static final int SPACE = 6;
115

    
116
    /**
117
     * Indicates an event is a start document
118
     * 
119
     * @see javax.xml.stream.events.StartDocument
120
     */
121
    public static final int START_DOCUMENT = 7;
122

    
123
    /**
124
     * Indicates an event is an end document
125
     * 
126
     * @see javax.xml.stream.events.EndDocument
127
     */
128
    public static final int END_DOCUMENT = 8;
129

    
130
    /**
131
     * Indicates an event is an entity reference
132
     * 
133
     * @see javax.xml.stream.events.EntityReference
134
     */
135
    public static final int ENTITY_REFERENCE = 9;
136

    
137
    /**
138
     * Indicates an event is an attribute
139
     * 
140
     * @see javax.xml.stream.events.Attribute
141
     */
142
    //public static final int ATTRIBUTE = 10;
143

    
144
    /**
145
     * Indicates an event is a DTD
146
     * 
147
     * @see javax.xml.stream.events.DTD
148
     */
149
    public static final int DTD = 11;
150

    
151
    /**
152
     * Indicates an event is a CDATA section
153
     * 
154
     * @see javax.xml.stream.events.Characters
155
     */
156
    public static final int CDATA = 12;
157

    
158
    /**
159
     * Indicates the event is a namespace declaration
160
     * 
161
     * @see javax.xml.stream.events.Namespace
162
     */
163
    public static final int NAMESPACE = 13;
164

    
165
    /**
166
     * Indicates a Notation
167
     * 
168
     * @see javax.xml.stream.events.NotationDeclaration
169
     */
170
    public static final int NOTATION_DECLARATION = 14;
171

    
172
    /**
173
     * Indicates a Entity Declaration
174
     * 
175
     * @see javax.xml.stream.events.NotationDeclaration
176
     */
177
    public static final int ENTITY_DECLARATION = 15;
178

    
179
    /**
180
     * @return
181
     * @throws IllegalStateException
182
     */
183
    int getAttributeCount() throws XmlStreamException;
184

    
185
    QName getAttributeName(int i) throws XmlStreamException;
186

    
187
    /**
188
     * Returns the complete (coalesced) value for the attribute at index {@code i}
189
     * @param i
190
     * @return
191
     * @throws XmlStreamException
192
     */
193
    String getAttributeValue(int i) throws XmlStreamException;
194

    
195
    /**
196
     * Returns the qualified name (with prefix if applicable) for the current element.
197
     * 
198
     * @return the qualified name for the current START_ELEMENT or END_ELEMENT event, or
199
     *         <code>null</code> if the current event is not a START_ELEMENT or END_ELEMENT.
200
     * @throws XmlStreamException
201
     */
202
    QName getName() throws XmlStreamException;
203

    
204
    int getEventType() throws XmlStreamException;
205

    
206
    String getText() throws XmlStreamException;
207

    
208
    int next() throws XmlStreamException;
209

    
210
    int nextTag() throws XmlStreamException;
211

    
212
    boolean isWhitespace() throws XmlStreamException;
213
}