Java tutorial
//package com.java2s; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; public class Main { public static void skipElement(XMLStreamReader parser) throws XMLStreamException { int numEndTags = 1; while (numEndTags > 0) { switch (parser.next()) { case XMLStreamConstants.START_ELEMENT: ++numEndTags;//go down break; case XMLStreamConstants.END_ELEMENT: --numEndTags;//go up break; } } } }