void next() throws XMLStreamException {
if (nextNode()) {
if (node instanceof OMSourcedElement) {
OMSourcedElement element = (OMSourcedElement)node;
if (!element.isExpanded()) {
OMDataSource ds = element.getDataSource();
if (ds != null) {
if (serializer.isDataSourceALeaf()) {
this.ds = ds;
currentEvent = -1;
// Mark the node as visited so that we continue with the next sibling
visited = true;
return;
}
if (!(OMDataSourceUtil.isPushDataSource(ds)
|| (cache && OMDataSourceUtil.isDestructiveRead(ds)))) {
XMLStreamReader reader = ds.getReader();
while (reader.next() != START_ELEMENT) {
// Just loop
}
serializer.pushState(new IncludeWrapper(serializer, reader));
visited = true;