286N/A/*
286N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
286N/A *
286N/A * This code is free software; you can redistribute it and/or modify it
286N/A * under the terms of the GNU General Public License version 2 only, as
286N/A * published by the Free Software Foundation. Oracle designates this
286N/A * particular file as subject to the "Classpath" exception as provided
286N/A * by Oracle in the LICENSE file that accompanied this code.
286N/A *
286N/A * This code is distributed in the hope that it will be useful, but WITHOUT
286N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
286N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
286N/A * version 2 for more details (a copy is included in the LICENSE file that
286N/A * accompanied this code).
286N/A *
286N/A * You should have received a copy of the GNU General Public License version
286N/A * 2 along with this work; if not, write to the Free Software Foundation,
286N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
286N/A *
286N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
286N/A * or visit www.oracle.com if you need additional information or have any
286N/A * questions.
286N/A */
286N/A
286N/A/*
286N/A * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
286N/A */
286N/A
286N/Apackage javax.xml.stream.events;
286N/A
286N/Aimport java.io.Writer;
286N/Aimport javax.xml.namespace.QName;
286N/A/**
286N/A * This is the base event interface for handling markup events.
286N/A * Events are value objects that are used to communicate the
286N/A * XML 1.0 InfoSet to the Application. Events may be cached
286N/A * and referenced after the parse has completed.
286N/A *
286N/A * @version 1.0
286N/A * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
286N/A * @see javax.xml.stream.XMLEventReader
286N/A * @see Characters
286N/A * @see ProcessingInstruction
286N/A * @see StartElement
286N/A * @see EndElement
286N/A * @see StartDocument
286N/A * @see EndDocument
286N/A * @see EntityReference
286N/A * @see EntityDeclaration
286N/A * @see NotationDeclaration
286N/A * @since 1.6
286N/A */
286N/Apublic interface XMLEvent extends javax.xml.stream.XMLStreamConstants {
286N/A
286N/A /**
286N/A * Returns an integer code for this event.
286N/A * @see #START_ELEMENT
286N/A * @see #END_ELEMENT
286N/A * @see #CHARACTERS
286N/A * @see #ATTRIBUTE
286N/A * @see #NAMESPACE
286N/A * @see #PROCESSING_INSTRUCTION
286N/A * @see #COMMENT
286N/A * @see #START_DOCUMENT
286N/A * @see #END_DOCUMENT
286N/A * @see #DTD
286N/A */
286N/A public int getEventType();
286N/A
286N/A /**
286N/A * Return the location of this event. The Location
286N/A * returned from this method is non-volatile and
286N/A * will retain its information.
286N/A * @see javax.xml.stream.Location
286N/A */
286N/A javax.xml.stream.Location getLocation();
286N/A
286N/A /**
286N/A * A utility function to check if this event is a StartElement.
286N/A * @see StartElement
286N/A */
286N/A public boolean isStartElement();
286N/A
286N/A /**
286N/A * A utility function to check if this event is an Attribute.
286N/A * @see Attribute
286N/A */
286N/A public boolean isAttribute();
286N/A
286N/A /**
286N/A * A utility function to check if this event is a Namespace.
286N/A * @see Namespace
286N/A */
286N/A public boolean isNamespace();
286N/A
286N/A
286N/A /**
286N/A * A utility function to check if this event is a EndElement.
286N/A * @see EndElement
286N/A */
286N/A public boolean isEndElement();
286N/A
286N/A /**
286N/A * A utility function to check if this event is an EntityReference.
286N/A * @see EntityReference
286N/A */
286N/A public boolean isEntityReference();
286N/A
286N/A /**
286N/A * A utility function to check if this event is a ProcessingInstruction.
286N/A * @see ProcessingInstruction
286N/A */
286N/A public boolean isProcessingInstruction();
286N/A
286N/A /**
286N/A * A utility function to check if this event is Characters.
286N/A * @see Characters
286N/A */
286N/A public boolean isCharacters();
286N/A
286N/A /**
286N/A * A utility function to check if this event is a StartDocument.
286N/A * @see StartDocument
286N/A */
286N/A public boolean isStartDocument();
286N/A
286N/A /**
286N/A * A utility function to check if this event is an EndDocument.
286N/A * @see EndDocument
286N/A */
286N/A public boolean isEndDocument();
286N/A
286N/A /**
286N/A * Returns this event as a start element event, may result in
286N/A * a class cast exception if this event is not a start element.
286N/A */
286N/A public StartElement asStartElement();
286N/A
286N/A /**
286N/A * Returns this event as an end element event, may result in
286N/A * a class cast exception if this event is not a end element.
286N/A */
286N/A public EndElement asEndElement();
286N/A
286N/A /**
286N/A * Returns this event as Characters, may result in
286N/A * a class cast exception if this event is not Characters.
286N/A */
286N/A public Characters asCharacters();
286N/A
286N/A /**
286N/A * This method is provided for implementations to provide
286N/A * optional type information about the associated event.
286N/A * It is optional and will return null if no information
286N/A * is available.
286N/A */
286N/A public QName getSchemaType();
286N/A
286N/A /**
286N/A * This method will write the XMLEvent as per the XML 1.0 specification as Unicode characters.
286N/A * No indentation or whitespace should be outputted.
286N/A *
286N/A * Any user defined event type SHALL have this method
286N/A * called when being written to on an output stream.
286N/A * Built in Event types MUST implement this method,
286N/A * but implementations MAY choose not call these methods
286N/A * for optimizations reasons when writing out built in
286N/A * Events to an output stream.
286N/A * The output generated MUST be equivalent in terms of the
286N/A * infoset expressed.
286N/A *
286N/A * @param writer The writer that will output the data
286N/A * @throws XMLStreamException if there is a fatal error writing the event
286N/A */
286N/A public void writeAsEncodedUnicode(Writer writer)
286N/A throws javax.xml.stream.XMLStreamException;
286N/A
286N/A}