KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > xml > stream > XMLStreamReader


1 package javax.xml.stream;
2
3 import java.io.Reader JavaDoc;
4 import javax.xml.namespace.NamespaceContext JavaDoc;
5 import javax.xml.namespace.QName JavaDoc;
6
7 /**
8  * The XMLStreamReader interface allows forward, read-only access to XML.
9  * It is designed to be the lowest level and most efficient way to
10  * read XML data.
11  *
12  * <p> The XMLStreamReader is designed to iterate over XML using
13  * next() and hasNext(). The data can be accessed using methods such as getEventType(),
14  * getNamespaceURI(), getLocalName() and getText();
15  *
16  * <p> The <a HREF="#next()">next()</a> method causes the reader to read the next parse event.
17  * The next() method returns an integer which identifies the type of event just read.
18  * <p> The event type can be determined using <a HREF="#getEventType()">getEventType()</a>.
19  * <p> Parsing events are defined as the XML Declaration, a DTD,
20  * start tag, character data, white space, end tag, comment,
21  * or processing instruction. An attribute or namespace event may be encountered
22  * at the root level of a document as the result of a query operation.
23  *
24  * <p>For XML 1.0 compliance an XML processor must pass the
25  * identifiers of declared unparsed entities, notation declarations and their
26  * associated identifiers to the application. This information is
27  * provided through the property API on this interface.
28  * The following two properties allow access to this information:
29  * javax.xml.stream.notations and javax.xml.stream.entities.
30  * When the current event is a DTD the following call will return a
31  * list of Notations
32  * <code>List l = (List) getProperty("javax.xml.stream.notations");</code>
33  * The following call will return a list of entity declarations:
34  * <code>List l = (List) getProperty("javax.xml.stream.entities");</code>
35  * These properties can only be accessed during a DTD event and
36  * are defined to return null if the information is not available.
37  *
38  * <p>The following table describes which methods are valid in what state.
39  * If a method is called in an invalid state the method will throw a
40  * java.lang.IllegalStateException.
41  *
42  * <table border="2" rules="all" cellpadding="4">
43  * <thead>
44  * <tr>
45  * <th align="center" colspan="2">
46  * Valid methods for each state
47  * </th>
48  * </tr>
49  * </thead>
50  * <tbody>
51  * <tr>
52  * <th>Event Type</th>
53  * <th>Valid Methods</th>
54  * </tr>
55  * <tr>
56  * <td> All States </td>
57  * <td> getProperty(), hasNext(), require(), close(),
58  * getNamespaceURI(), isStartElement(),
59  * isEndElement(), isCharacters(), isWhiteSpace(),
60  * getNamespaceContext(), getEventType(),getLocation(),
61  * hasText(), hasName()
62  * </td>
63  * </tr>
64  * <tr>
65  * <td> START_ELEMENT </td>
66  * <td> next(), getName(), getLocalName(), hasName(), getPrefix(),
67  * getAttributeXXX(), isAttributeSpecified(),
68  * getNamespaceXXX(),
69  * getElementText(), nextTag()
70  * </td>
71  * </tr>
72  * <td> ATTRIBUTE </td>
73  * <td> next(), nextTag()
74  * getAttributeXXX(), isAttributeSpecified(),
75  * </td>
76  * </tr>
77  * </tr>
78  * <td> NAMESPACE </td>
79  * <td> next(), nextTag()
80  * getNamespaceXXX()
81  * </td>
82  * </tr>
83  * <tr>
84  * <td> END_ELEMENT </td>
85  * <td> next(), getName(), getLocalName(), hasName(), getPrefix(),
86  * getNamespaceXXX(), nextTag()
87  * </td>
88  * </tr>
89  * <tr>
90  * <td> CHARACTERS </td>
91  * <td> next(), getTextXXX(), nextTag() </td>
92  * </tr>
93  * <tr>
94  * <td> CDATA </td>
95  * <td> next(), getTextXXX(), nextTag() </td>
96  * </tr>
97  * <tr>
98  * <td> COMMENT </td>
99  * <td> next(), getTextXXX(), nextTag() </td>
100  * </tr>
101  * <tr>
102  * <td> SPACE </td>
103  * <td> next(), getTextXXX(), nextTag() </td>
104  * </tr>
105  * <tr>
106  * <td> START_DOCUMENT </td>
107  * <td> next(), getEncoding(), getVersion(), isStandalone(), standaloneSet(),
108  * getCharacterEncodingScheme(), nextTag()</td>
109  * </tr>
110  * <tr>
111  * <td> END_DOCUMENT </td>
112  * <td> close()</td>
113  * </tr>
114  * <tr>
115  * <td> PROCESSING_INSTRUCTION </td>
116  * <td> next(), getPITarget(), getPIData(), nextTag() </td>
117  * </tr>
118  * <tr>
119  * <td> ENTITY_REFERENCE </td>
120  * <td> next(), getLocalName(), getText(), nextTag() </td>
121  * </tr>
122  * <tr>
123  * <td> DTD </td>
124  * <td> next(), getText(), nextTag() </td>
125  * </tr>
126  * </tbody>
127  * </table>
128  *
129  * @version 1.0
130  * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
131  * @see javax.xml.stream.events.XMLEvent
132  * @see XMLInputFactory
133  * @see XMLStreamWriter
134  * @since 1.6
135  */

136 public interface XMLStreamReader extends XMLStreamConstants {
137   /**
138    * Get the value of a feature/property from the underlying implementation
139    * @param name The name of the property, may not be null
140    * @return The value of the property
141    * @throws IllegalArgumentException if name is null
142    */

143   public Object JavaDoc getProperty(java.lang.String JavaDoc name) throws java.lang.IllegalArgumentException JavaDoc;
144
145   /**
146    * Get next parsing event - a processor may return all contiguous
147    * character data in a single chunk, or it may split it into several chunks.
148    * If the property javax.xml.stream.isCoalescing is set to true
149    * element content must be coalesced and only one CHARACTERS event
150    * must be returned for contiguous element content or
151    * CDATA Sections.
152    *
153    * By default entity references must be
154    * expanded and reported transparently to the application.
155    * An exception will be thrown if an entity reference cannot be expanded.
156    * If element content is empty (i.e. content is "") then no CHARACTERS event will be reported.
157    *
158    * <p>Given the following XML:<br>
159    * &lt;foo>&lt;!--description-->content text&lt;![CDATA[&lt;greeting>Hello&lt;/greeting>]]>other content&lt;/foo><br>
160    * The behavior of calling next() when being on foo will be:<br>
161    * 1- the comment (COMMENT)<br>
162    * 2- then the characters section (CHARACTERS)<br>
163    * 3- then the CDATA section (another CHARACTERS)<br>
164    * 4- then the next characters section (another CHARACTERS)<br>
165    * 5- then the END_ELEMENT<br>
166    *
167    * <p><b>NOTE:</b> empty element (such as &lt;tag/>) will be reported
168    * with two separate events: START_ELEMENT, END_ELEMENT - This preserves
169    * parsing equivalency of empty element to &lt;tag>&lt;/tag>.
170    *
171    * This method will throw an IllegalStateException if it is called after hasNext() returns false.
172    * @see javax.xml.stream.events.XMLEvent
173    * @return the integer code corresponding to the current parse event
174    * @throws NoSuchElementException if this is called when hasNext() returns false
175    * @throws XMLStreamException if there is an error processing the underlying XML source
176    */

177   public int next() throws XMLStreamException;
178
179   /**
180    * Test if the current event is of the given type and if the namespace and name match the current
181    * namespace and name of the current event. If the namespaceURI is null it is not checked for equality,
182    * if the localName is null it is not checked for equality.
183    * @param type the event type
184    * @param namespaceURI the uri of the event, may be null
185    * @param localName the localName of the event, may be null
186    * @throws XMLStreamException if the required values are not matched.
187    */

188   public void require(int type, String JavaDoc namespaceURI, String JavaDoc localName) throws XMLStreamException;
189
190   /**
191    * Reads the content of a text-only element, an exception is thrown if this is
192    * not a text-only element.
193    * Regardless of value of javax.xml.stream.isCoalescing this method always returns coalesced content.
194    * <br /> Precondition: the current event is START_ELEMENT.
195    * <br /> Postcondition: the current event is the corresponding END_ELEMENT.
196    *
197    * <br />The method does the following (implementations are free to optimized
198    * but must do equivalent processing):
199    * <pre>
200    * if(getEventType() != XMLStreamConstants.START_ELEMENT) {
201    * throw new XMLStreamException(
202    * "parser must be on START_ELEMENT to read next text", getLocation());
203    * }
204    * int eventType = next();
205    * StringBuffer content = new StringBuffer();
206    * while(eventType != XMLStreamConstants.END_ELEMENT ) {
207    * if(eventType == XMLStreamConstants.CHARACTERS
208    * || eventType == XMLStreamConstants.CDATA
209    * || eventType == XMLStreamConstants.SPACE
210    * || eventType == XMLStreamConstants.ENTITY_REFERENCE) {
211    * buf.append(getText());
212    * } else if(eventType == XMLStreamConstants.PROCESSING_INSTRUCTION
213    * || eventType == XMLStreamConstants.COMMENT) {
214    * // skipping
215    * } else if(eventType == XMLStreamConstants.END_DOCUMENT) {
216    * throw new XMLStreamException(
217    * "unexpected end of document when reading element text content", this);
218    * } else if(eventType == XMLStreamConstants.START_ELEMENT) {
219    * throw new XMLStreamException(
220    * "element text content may not contain START_ELEMENT", getLocation());
221    * } else {
222    * throw new XMLStreamException(
223    * "Unexpected event type "+eventType, getLocation());
224    * }
225    * eventType = next();
226    * }
227    * return buf.toString();
228    * </pre>
229    *
230    * @throws XMLStreamException if the current event is not a START_ELEMENT
231    * or if a non text element is encountered
232    */

233   public String JavaDoc getElementText() throws XMLStreamException;
234
235   /**
236    * Skips any white space (isWhiteSpace() returns true), COMMENT,
237    * or PROCESSING_INSTRUCTION,
238    * until a START_ELEMENT or END_ELEMENT is reached.
239    * If other than white space characters, COMMENT, PROCESSING_INSTRUCTION, START_ELEMENT, END_ELEMENT
240    * are encountered, an exception is thrown. This method should
241    * be used when processing element-only content seperated by white space.
242    *
243    * <br /> Precondition: none
244    * <br /> Postcondition: the current event is START_ELEMENT or END_ELEMENT
245    * and cursor may have moved over any whitespace event.
246    *
247    * <br />Essentially it does the following (implementations are free to optimized
248    * but must do equivalent processing):
249    * <pre>
250    * int eventType = next();
251    * while((eventType == XMLStreamConstants.CHARACTERS &amp;&amp; isWhiteSpace()) // skip whitespace
252    * || (eventType == XMLStreamConstants.CDATA &amp;&amp; isWhiteSpace())
253    * // skip whitespace
254    * || eventType == XMLStreamConstants.SPACE
255    * || eventType == XMLStreamConstants.PROCESSING_INSTRUCTION
256    * || eventType == XMLStreamConstants.COMMENT
257    * ) {
258    * eventType = next();
259    * }
260    * if (eventType != XMLStreamConstants.START_ELEMENT &amp;&amp; eventType != XMLStreamConstants.END_ELEMENT) {
261    * throw new String XMLStreamException("expected start or end tag", getLocation());
262    * }
263    * return eventType;
264    * </pre>
265    *
266    * @return the event type of the element read (START_ELEMENT or END_ELEMENT)
267    * @throws XMLStreamException if the current event is not white space, PROCESSING_INSTRUCTION,
268    * START_ELEMENT or END_ELEMENT
269    * @throws NoSuchElementException if this is called when hasNext() returns false
270    */

271   public int nextTag() throws XMLStreamException;
272
273   /**
274    * Returns true if there are more parsing events and false
275    * if there are no more events. This method will return
276    * false if the current state of the XMLStreamReader is
277    * END_DOCUMENT
278    * @return true if there are more events, false otherwise
279    * @throws XMLStreamException if there is a fatal error detecting the next state
280    */

281   public boolean hasNext() throws XMLStreamException;
282   
283   /**
284    * Frees any resources associated with this Reader. This method does not close the
285    * underlying input source.
286    * @throws XMLStreamException if there are errors freeing associated resources
287    */

288   public void close() throws XMLStreamException;
289
290   /**
291    * Return the uri for the given prefix.
292    * The uri returned depends on the current state of the processor.
293    *
294    * <p><strong>NOTE:</strong>The 'xml' prefix is bound as defined in
295    * <a HREF="http://www.w3.org/TR/REC-xml-names/#ns-using">Namespaces in XML</a>
296    * specification to "http://www.w3.org/XML/1998/namespace".
297    *
298    * <p><strong>NOTE:</strong> The 'xmlns' prefix must be resolved to following namespace
299    * <a HREF="http://www.w3.org/2000/xmlns/">http://www.w3.org/2000/xmlns/</a>
300    * @param prefix The prefix to lookup, may not be null
301    * @return the uri bound to the given prefix or null if it is not bound
302    * @throws IllegalArgumentException if the prefix is null
303    */

304   public String JavaDoc getNamespaceURI(String JavaDoc prefix);
305
306   /**
307    * Returns true if the cursor points to a start tag (otherwise false)
308    * @return true if the cursor points to a start tag, false otherwise
309    */

310   public boolean isStartElement();
311
312   /**
313    * Returns true if the cursor points to an end tag (otherwise false)
314    * @return true if the cursor points to an end tag, false otherwise
315    */

316   public boolean isEndElement();
317
318   /**
319    * Returns true if the cursor points to a character data event
320    * @return true if the cursor points to character data, false otherwise
321    */

322   public boolean isCharacters();
323
324   /**
325    * Returns true if the cursor points to a character data event
326    * that consists of all whitespace
327    * @return true if the cursor points to all whitespace, false otherwise
328    */

329   public boolean isWhiteSpace();
330
331
332   /**
333    * Returns the normalized attribute value of the
334    * attribute with the namespace and localName
335    * If the namespaceURI is null the namespace
336    * is not checked for equality
337    * @param namespaceURI the namespace of the attribute
338    * @param localName the local name of the attribute, cannot be null
339    * @return returns the value of the attribute , returns null if not found
340    * @throws IllegalStateException if this is not a START_ELEMENT or ATTRIBUTE
341    */

342   public String JavaDoc getAttributeValue(String JavaDoc namespaceURI,
343                                   String JavaDoc localName);
344
345   /**
346    * Returns the count of attributes on this START_ELEMENT,
347    * this method is only valid on a START_ELEMENT or ATTRIBUTE. This
348    * count excludes namespace definitions. Attribute indices are
349    * zero-based.
350    * @return returns the number of attributes
351    * @throws IllegalStateException if this is not a START_ELEMENT or ATTRIBUTE
352    */

353   public int getAttributeCount();
354
355   /** Returns the qname of the attribute at the provided index
356    *
357    * @param index the position of the attribute
358    * @return the QName of the attribute
359    * @throws IllegalStateException if this is not a START_ELEMENT or ATTRIBUTE
360    */

361   public QName JavaDoc getAttributeName(int index);
362   
363   /**
364    * Returns the namespace of the attribute at the provided
365    * index
366    * @param index the position of the attribute
367    * @return the namespace URI (can be null)
368    * @throws IllegalStateException if this is not a START_ELEMENT or ATTRIBUTE
369    */

370   public String JavaDoc getAttributeNamespace(int index);
371
372   /**
373    * Returns the localName of the attribute at the provided
374    * index
375    * @param index the position of the attribute
376    * @return the localName of the attribute
377    * @throws IllegalStateException if this is not a START_ELEMENT or ATTRIBUTE
378    */

379   public String JavaDoc getAttributeLocalName(int index);
380
381   /**
382    * Returns the prefix of this attribute at the
383    * provided index
384    * @param index the position of the attribute
385    * @return the prefix of the attribute
386    * @throws IllegalStateException if this is not a START_ELEMENT or ATTRIBUTE
387    */

388   public String JavaDoc getAttributePrefix(int index);
389
390   /**
391    * Returns the XML type of the attribute at the provided
392    * index
393    * @param index the position of the attribute
394    * @return the XML type of the attribute
395    * @throws IllegalStateException if this is not a START_ELEMENT or ATTRIBUTE
396    */

397   public String JavaDoc getAttributeType(int index);
398
399   /**
400    * Returns the value of the attribute at the
401    * index
402    * @param index the position of the attribute
403    * @return the attribute value
404    * @throws IllegalStateException if this is not a START_ELEMENT or ATTRIBUTE
405    */

406   public String JavaDoc getAttributeValue(int index);
407
408   /**
409    * Returns a boolean which indicates if this
410    * attribute was created by default
411    * @param index the position of the attribute
412    * @return true if this is a default attribute
413    * @throws IllegalStateException if this is not a START_ELEMENT or ATTRIBUTE
414    */

415   public boolean isAttributeSpecified(int index);
416
417   /**
418    * Returns the count of namespaces declared on this START_ELEMENT or END_ELEMENT,
419    * this method is only valid on a START_ELEMENT, END_ELEMENT or NAMESPACE. On
420    * an END_ELEMENT the count is of the namespaces that are about to go
421    * out of scope. This is the equivalent of the information reported
422    * by SAX callback for an end element event.
423    * @return returns the number of namespace declarations on this specific element
424    * @throws IllegalStateException if this is not a START_ELEMENT, END_ELEMENT or NAMESPACE
425    */

426   public int getNamespaceCount();
427
428   /**
429    * Returns the prefix for the namespace declared at the
430    * index. Returns null if this is the default namespace
431    * declaration
432    *
433    * @param index the position of the namespace declaration
434    * @return returns the namespace prefix
435    * @throws IllegalStateException if this is not a START_ELEMENT, END_ELEMENT or NAMESPACE
436    */

437   public String JavaDoc getNamespacePrefix(int index);
438   
439   /**
440    * Returns the uri for the namespace declared at the
441    * index.
442    *
443    * @param index the position of the namespace declaration
444    * @return returns the namespace uri
445    * @throws IllegalStateException if this is not a START_ELEMENT, END_ELEMENT or NAMESPACE
446    */

447   public String JavaDoc getNamespaceURI(int index);
448
449   /**
450    * Returns a read only namespace context for the current
451    * position. The context is transient and only valid until
452    * a call to next() changes the state of the reader.
453    * @return return a namespace context
454    */

455   public NamespaceContext JavaDoc getNamespaceContext();
456
457   /**
458    * Returns a reader that points to the current start element
459    * and all of its contents. Throws an XMLStreamException if the
460    * cursor does not point to a START_ELEMENT.<p>
461    * The sub stream is read from it MUST be read before the parent stream is
462    * moved on, if not any call on the sub stream will cause an XMLStreamException to be
463    * thrown. The parent stream will always return the same result from next()
464    * whatever is done to the sub stream.
465    * @return an XMLStreamReader which points to the next element
466    */

467   // public XMLStreamReader subReader() throws XMLStreamException;
468

469   /**
470    * Allows the implementation to reset and reuse any underlying tables
471    */

472   // public void recycle() throws XMLStreamException;
473

474   /**
475    * Returns an integer code that indicates the type
476    * of the event the cursor is pointing to.
477    */

478   public int getEventType();
479
480   /**
481    * Returns the current value of the parse event as a string,
482    * this returns the string value of a CHARACTERS event,
483    * returns the value of a COMMENT, the replacement value
484    * for an ENTITY_REFERENCE, the string value of a CDATA section,
485    * the string value for a SPACE event,
486    * or the String value of the internal subset of the DTD.
487    * If an ENTITY_REFERENCE has been resolved, any character data
488    * will be reported as CHARACTERS events.
489    * @return the current text or null
490    * @throws java.lang.IllegalStateException if this state is not
491    * a valid text state.
492    */

493   public String JavaDoc getText();
494
495   /**
496    * Returns an array which contains the characters from this event.
497    * This array should be treated as read-only and transient. I.e. the array will
498    * contain the text characters until the XMLStreamReader moves on to the next event.
499    * Attempts to hold onto the character array beyond that time or modify the
500    * contents of the array are breaches of the contract for this interface.
501    * @return the current text or an empty array
502    * @throws java.lang.IllegalStateException if this state is not
503    * a valid text state.
504    */

505   public char[] getTextCharacters();
506
507   /**
508    * Gets the the text associated with a CHARACTERS, SPACE or CDATA event.
509    * Text starting a "sourceStart" is copied into "target" starting at "targetStart".
510    * Up to "length" characters are copied. The number of characters actually copied is returned.
511    *
512    * The "sourceStart" argument must be greater or equal to 0 and less than or equal to
513    * the number of characters associated with the event. Usually, one requests text starting at a "sourceStart" of 0.
514    * If the number of characters actually copied is less than the "length", then there is no more text.
515    * Otherwise, subsequent calls need to be made until all text has been retrieved. For example:
516    *
517    *<code>
518    * int length = 1024;
519    * char[] myBuffer = new char[ length ];
520    *
521    * for ( int sourceStart = 0 ; ; sourceStart += length )
522    * {
523    * int nCopied = stream.getTextCharacters( sourceStart, myBuffer, 0, length );
524    *
525    * if (nCopied < length)
526    * break;
527    * }
528    * </code>
529    * XMLStreamException may be thrown if there are any XML errors in the underlying source.
530    * The "targetStart" argument must be greater than or equal to 0 and less than the length of "target",
531    * Length must be greater than 0 and "targetStart + length" must be less than or equal to length of "target".
532    *
533    * @param sourceStart the index of the first character in the source array to copy
534    * @param target the destination array
535    * @param targetStart the start offset in the target array
536    * @param length the number of characters to copy
537    * @return the number of characters actually copied
538    * @throws XMLStreamException if the underlying XML source is not well-formed
539    * @throws IndexOutOfBoundsException if targetStart < 0 or > than the length of target
540    * @throws IndexOutOfBoundsException if length < 0 or targetStart + length > length of target
541    * @throws UnsupportedOperationException if this method is not supported
542    * @throws NullPointerException is if target is null
543    */

544    public int getTextCharacters(int sourceStart, char[] target, int targetStart, int length)
545      throws XMLStreamException;
546
547   /**
548    * Gets the text associated with a CHARACTERS, SPACE or CDATA event. Allows the underlying
549    * implementation to return the text as a stream of characters. The reference to the
550    * Reader returned by this method is only valid until next() is called.
551    *
552    * All characters must have been checked for well-formedness.
553    *
554    * <p> This method is optional and will throw UnsupportedOperationException if it is not supported.
555    * @throws UnsupportedOperationException if this method is not supported
556    * @throws IllegalStateException if this is not a valid text state
557    */

558   //public Reader getTextStream();
559

560   /**
561    * Returns the offset into the text character array where the first
562    * character (of this text event) is stored.
563    * @throws java.lang.IllegalStateException if this state is not
564    * a valid text state.
565    */

566   public int getTextStart();
567
568   /**
569    * Returns the length of the sequence of characters for this
570    * Text event within the text character array.
571    * @throws java.lang.IllegalStateException if this state is not
572    * a valid text state.
573    */

574   public int getTextLength();
575
576   /**
577    * Return input encoding if known or null if unknown.
578    * @return the encoding of this instance or null
579    */

580   public String JavaDoc getEncoding();
581
582   /**
583    * Return true if the current event has text, false otherwise
584    * The following events have text:
585    * CHARACTERS,DTD ,ENTITY_REFERENCE, COMMENT, SPACE
586    */

587   public boolean hasText();
588
589   /**
590    * Return the current location of the processor.
591    * If the Location is unknown the processor should return
592    * an implementation of Location that returns -1 for the
593    * location and null for the publicId and systemId.
594    * The location information is only valid until next() is
595    * called.
596    */

597   public Location getLocation();
598
599   /**
600    * Returns a QName for the current START_ELEMENT or END_ELEMENT event
601    * @return the QName for the current START_ELEMENT or END_ELEMENT event
602    * @throws IllegalStateException if this is not a START_ELEMENT or
603    * END_ELEMENT
604    */

605   public QName JavaDoc getName();
606
607   /**
608    * Returns the (local) name of the current event.
609    * For START_ELEMENT or END_ELEMENT returns the (local) name of the current element.
610    * For ENTITY_REFERENCE it returns entity name.
611    * The current event must be START_ELEMENT or END_ELEMENT,
612    * or ENTITY_REFERENCE
613    * @return the localName
614    * @throws IllegalStateException if this not a START_ELEMENT,
615    * END_ELEMENT or ENTITY_REFERENCE
616    */

617   public String JavaDoc getLocalName();
618
619   /**
620    * returns true if the current event has a name (is a START_ELEMENT or END_ELEMENT)
621    * returns false otherwise
622    */

623   public boolean hasName();
624
625   /**
626    * If the current event is a START_ELEMENT or END_ELEMENT this method
627    * returns the URI of the prefix or the default namespace.
628    * Returns null if the event does not have a prefix.
629    * @return the URI bound to this elements prefix, the default namespace, or null
630    */

631   public String JavaDoc getNamespaceURI();
632
633   /**
634    * Returns the prefix of the current event or null if the event does not have a prefix
635    * @return the prefix or null
636    */

637   public String JavaDoc getPrefix();
638   
639   /**
640    * Get the xml version declared on the xml declaration
641    * Returns null if none was declared
642    * @return the XML version or null
643    */

644   public String JavaDoc getVersion();
645
646   /**
647    * Get the standalone declaration from the xml declaration
648    * @return true if this is standalone, or false otherwise
649    */

650   public boolean isStandalone();
651
652   /**
653    * Checks if standalone was set in the document
654    * @return true if standalone was set in the document, or false otherwise
655    */

656   public boolean standaloneSet();
657
658   /**
659    * Returns the character encoding declared on the xml declaration
660    * Returns null if none was declared
661    * @return the encoding declared in the document or null
662    */

663   public String JavaDoc getCharacterEncodingScheme();
664
665   /**
666    * Get the target of a processing instruction
667    * @return the target or null
668    */

669   public String JavaDoc getPITarget();
670
671   /**
672    * Get the data section of a processing instruction
673    * @return the data or null
674    */

675   public String JavaDoc getPIData();
676 }
677
678
679
680
681
Popular Tags