Path: blob/aarch64-shenandoah-jdk8u272-b10/jaxp/src/javax/xml/stream/XMLEventReader.java
48534 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;2930import javax.xml.stream.events.XMLEvent;3132import java.util.Iterator;3334/**35*36* This is the top level interface for parsing XML Events. It provides37* the ability to peek at the next event and returns configuration38* information through the property interface.39*40* @version 1.041* @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.42* @see XMLInputFactory43* @see XMLEventWriter44* @since 1.645*/46public interface XMLEventReader extends Iterator {47/**48* Get the next XMLEvent49* @see XMLEvent50* @throws XMLStreamException if there is an error with the underlying XML.51* @throws NoSuchElementException iteration has no more elements.52*/53public XMLEvent nextEvent() throws XMLStreamException;5455/**56* Check if there are more events.57* Returns true if there are more events and false otherwise.58* @return true if the event reader has more events, false otherwise59*/60public boolean hasNext();6162/**63* Check the next XMLEvent without reading it from the stream.64* Returns null if the stream is at EOF or has no more XMLEvents.65* A call to peek() will be equal to the next return of next().66* @see XMLEvent67* @throws XMLStreamException68*/69public XMLEvent peek() throws XMLStreamException;7071/**72* Reads the content of a text-only element. Precondition:73* the current event is START_ELEMENT. Postcondition:74* The current event is the corresponding END_ELEMENT.75* @throws XMLStreamException if the current event is not a START_ELEMENT76* or if a non text element is encountered77*/78public String getElementText() throws XMLStreamException;7980/**81* Skips any insignificant space events until a START_ELEMENT or82* END_ELEMENT is reached. If anything other than space characters are83* encountered, an exception is thrown. This method should84* be used when processing element-only content because85* the parser is not able to recognize ignorable whitespace if86* the DTD is missing or not interpreted.87* @throws XMLStreamException if anything other than space characters are encountered88*/89public XMLEvent nextTag() throws XMLStreamException;9091/**92* Get the value of a feature/property from the underlying implementation93* @param name The name of the property94* @return The value of the property95* @throws IllegalArgumentException if the property is not supported96*/97public Object getProperty(java.lang.String name) throws java.lang.IllegalArgumentException;9899/**100* Frees any resources associated with this Reader. This method does not close the101* underlying input source.102* @throws XMLStreamException if there are errors freeing associated resources103*/104public void close() throws XMLStreamException;105}106107108