Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;

public class Main {
    public static boolean goToNextXBeforeY(XMLStreamReader reader, String X, String Y) throws XMLStreamException {
        while (reader.hasNext()) {
            int code = reader.next();
            if (code == XMLStreamReader.END_ELEMENT && reader.getLocalName().equals(Y)) {
                return false;
            }
            if (code == XMLStreamReader.START_ELEMENT && reader.getLocalName().equals(X)) {
                return true;
            }
        }
        return false;
    }
}