/** * Reads the events from the provided event stream until either a start or * end tag is encountered. In the former case, the start tag will be * returned, but if an end tag is encountered, <code>null</code> will be * returned. After returning, the stream will be positioned just before the * returned start element. The start element will not be consumed by this * method. * * @param reader The event stream from which to read. * @return The StartElement read from the stream, or <code>null</code> if * an end tag was found first, or the stream ended before a start * element was found. * @throws XMLStreamException If an error occurs reading the stream. */ public static final StartElement nextElement(XMLEventReader reader) throws XMLStreamException { return nextElement(reader, null); }