Save This Page
Home » openjdk-7 » javax » xml » stream » events » [javadoc | source]
    1   /*
    2    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    3    *
    4    * This code is free software; you can redistribute it and/or modify it
    5    * under the terms of the GNU General Public License version 2 only, as
    6    * published by the Free Software Foundation.  Sun designates this
    7    * particular file as subject to the "Classpath" exception as provided
    8    * by Sun in the LICENSE file that accompanied this code.
    9    *
   10    * This code is distributed in the hope that it will be useful, but WITHOUT
   11    * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   12    * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   13    * version 2 for more details (a copy is included in the LICENSE file that
   14    * accompanied this code).
   15    *
   16    * You should have received a copy of the GNU General Public License version
   17    * 2 along with this work; if not, write to the Free Software Foundation,
   18    * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   19    *
   20    * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   21    * CA 95054 USA or visit www.sun.com if you need additional information or
   22    * have any questions.
   23    */
   24   
   25   /*
   26    * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
   27    */
   28   
   29   package javax.xml.stream.events;
   30   
   31   import java.io.Writer;
   32   import javax.xml.namespace.QName;
   33   /**
   34    * This is the base event interface for handling markup events.
   35    * Events are value objects that are used to communicate the
   36    * XML 1.0 InfoSet to the Application.  Events may be cached
   37    * and referenced after the parse has completed.
   38    *
   39    * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
   40    * @see javax.xml.stream.XMLEventReader
   41    * @see Characters
   42    * @see ProcessingInstruction
   43    * @see StartElement
   44    * @see EndElement
   45    * @see StartDocument
   46    * @see EndDocument
   47    * @see EntityReference
   48    * @see EntityDeclaration
   49    * @see NotationDeclaration
   50    * @since 1.6
   51    */
   52   public interface XMLEvent extends javax.xml.stream.XMLStreamConstants {
   53   
   54     /**
   55      * Returns an integer code for this event.
   56      * @see #START_ELEMENT
   57      * @see #END_ELEMENT
   58      * @see #CHARACTERS
   59      * @see #ATTRIBUTE
   60      * @see #NAMESPACE
   61      * @see #PROCESSING_INSTRUCTION
   62      * @see #COMMENT
   63      * @see #START_DOCUMENT
   64      * @see #END_DOCUMENT
   65      * @see #DTD
   66      */
   67     public int getEventType();
   68   
   69     /**
   70      * Return the location of this event.  The Location
   71      * returned from this method is non-volatile and
   72      * will retain its information.
   73      * @see javax.xml.stream.Location
   74      */
   75     javax.xml.stream.Location getLocation();
   76   
   77     /**
   78      * A utility function to check if this event is a StartElement.
   79      * @see StartElement
   80      */
   81     public boolean isStartElement();
   82   
   83     /**
   84      * A utility function to check if this event is an Attribute.
   85      * @see Attribute
   86      */
   87     public boolean isAttribute();
   88   
   89     /**
   90      * A utility function to check if this event is a Namespace.
   91      * @see Namespace
   92      */
   93     public boolean isNamespace();
   94   
   95   
   96     /**
   97      * A utility function to check if this event is a EndElement.
   98      * @see EndElement
   99      */
  100     public boolean isEndElement();
  101   
  102     /**
  103      * A utility function to check if this event is an EntityReference.
  104      * @see EntityReference
  105      */
  106     public boolean isEntityReference();
  107   
  108     /**
  109      * A utility function to check if this event is a ProcessingInstruction.
  110      * @see ProcessingInstruction
  111      */
  112     public boolean isProcessingInstruction();
  113   
  114     /**
  115      * A utility function to check if this event is Characters.
  116      * @see Characters
  117      */
  118     public boolean isCharacters();
  119   
  120     /**
  121      * A utility function to check if this event is a StartDocument.
  122      * @see StartDocument
  123      */
  124     public boolean isStartDocument();
  125   
  126     /**
  127      * A utility function to check if this event is an EndDocument.
  128      * @see EndDocument
  129      */
  130     public boolean isEndDocument();
  131   
  132     /**
  133      * Returns this event as a start element event, may result in
  134      * a class cast exception if this event is not a start element.
  135      */
  136     public StartElement asStartElement();
  137   
  138     /**
  139      * Returns this event as an end  element event, may result in
  140      * a class cast exception if this event is not a end element.
  141      */
  142     public EndElement asEndElement();
  143   
  144     /**
  145      * Returns this event as Characters, may result in
  146      * a class cast exception if this event is not Characters.
  147      */
  148     public Characters asCharacters();
  149   
  150     /**
  151      * This method is provided for implementations to provide
  152      * optional type information about the associated event.
  153      * It is optional and will return null if no information
  154      * is available.
  155      */
  156     public QName getSchemaType();
  157   
  158     /**
  159      * This method will write the XMLEvent as per the XML 1.0 specification as Unicode characters.
  160      * No indentation or whitespace should be outputted.
  161      *
  162      * Any user defined event type SHALL have this method
  163      * called when being written to on an output stream.
  164      * Built in Event types MUST implement this method,
  165      * but implementations MAY choose not call these methods
  166      * for optimizations reasons when writing out built in
  167      * Events to an output stream.
  168      * The output generated MUST be equivalent in terms of the
  169      * infoset expressed.
  170      *
  171      * @param writer The writer that will output the data
  172      * @throws XMLStreamException if there is a fatal error writing the event
  173      */
  174     public void writeAsEncodedUnicode(Writer writer)
  175       throws javax.xml.stream.XMLStreamException;
  176   
  177   }

Save This Page
Home » openjdk-7 » javax » xml » stream » events » [javadoc | source]