Path: blob/jdk8u272-b10-aarch32-20201026/jaxp/src/javax/xml/stream/events/XMLEvent.java
48792 views
/*1* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.2*3* This code is free software; you can redistribute it and/or modify it4* under the terms of the GNU General Public License version 2 only, as5* published by the Free Software Foundation. Oracle designates this6* particular file as subject to the "Classpath" exception as provided7* by Oracle in the LICENSE file that accompanied this code.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 2 along with this work; if not, write to the Free Software Foundation,17* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18*19* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*/2324/*25* Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.26*/2728package javax.xml.stream.events;2930import java.io.Writer;31import javax.xml.namespace.QName;32/**33* This is the base event interface for handling markup events.34* Events are value objects that are used to communicate the35* XML 1.0 InfoSet to the Application. Events may be cached36* and referenced after the parse has completed.37*38* @version 1.039* @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.40* @see javax.xml.stream.XMLEventReader41* @see Characters42* @see ProcessingInstruction43* @see StartElement44* @see EndElement45* @see StartDocument46* @see EndDocument47* @see EntityReference48* @see EntityDeclaration49* @see NotationDeclaration50* @since 1.651*/52public interface XMLEvent extends javax.xml.stream.XMLStreamConstants {5354/**55* Returns an integer code for this event.56* @see #START_ELEMENT57* @see #END_ELEMENT58* @see #CHARACTERS59* @see #ATTRIBUTE60* @see #NAMESPACE61* @see #PROCESSING_INSTRUCTION62* @see #COMMENT63* @see #START_DOCUMENT64* @see #END_DOCUMENT65* @see #DTD66*/67public int getEventType();6869/**70* Return the location of this event. The Location71* returned from this method is non-volatile and72* will retain its information.73* @see javax.xml.stream.Location74*/75javax.xml.stream.Location getLocation();7677/**78* A utility function to check if this event is a StartElement.79* @see StartElement80*/81public boolean isStartElement();8283/**84* A utility function to check if this event is an Attribute.85* @see Attribute86*/87public boolean isAttribute();8889/**90* A utility function to check if this event is a Namespace.91* @see Namespace92*/93public boolean isNamespace();949596/**97* A utility function to check if this event is a EndElement.98* @see EndElement99*/100public boolean isEndElement();101102/**103* A utility function to check if this event is an EntityReference.104* @see EntityReference105*/106public boolean isEntityReference();107108/**109* A utility function to check if this event is a ProcessingInstruction.110* @see ProcessingInstruction111*/112public boolean isProcessingInstruction();113114/**115* A utility function to check if this event is Characters.116* @see Characters117*/118public boolean isCharacters();119120/**121* A utility function to check if this event is a StartDocument.122* @see StartDocument123*/124public boolean isStartDocument();125126/**127* A utility function to check if this event is an EndDocument.128* @see EndDocument129*/130public boolean isEndDocument();131132/**133* Returns this event as a start element event, may result in134* a class cast exception if this event is not a start element.135*/136public StartElement asStartElement();137138/**139* Returns this event as an end element event, may result in140* a class cast exception if this event is not a end element.141*/142public EndElement asEndElement();143144/**145* Returns this event as Characters, may result in146* a class cast exception if this event is not Characters.147*/148public Characters asCharacters();149150/**151* This method is provided for implementations to provide152* optional type information about the associated event.153* It is optional and will return null if no information154* is available.155*/156public QName getSchemaType();157158/**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 method163* 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 methods166* for optimizations reasons when writing out built in167* Events to an output stream.168* The output generated MUST be equivalent in terms of the169* infoset expressed.170*171* @param writer The writer that will output the data172* @throws XMLStreamException if there is a fatal error writing the event173*/174public void writeAsEncodedUnicode(Writer writer)175throws javax.xml.stream.XMLStreamException;176177}178179180