Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

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

public class Main {
    /**
     * Raises a new unexpected element exception, reporting the single expected element.
     * @param reader Reader.
     * @param expected Expected element.
     * @return Exception.
     */
    public static XMLStreamException unexpectedElementException(XMLStreamReader reader, String expected) {
        return new XMLStreamException(
                String.format("Unexpected element. Expected %s, got %s.", expected, reader.getName().toString()));
    }

    /**
     * Raises a new unexpected element exception.
     * @param reader XML reader.
     * @return Exception.
     */
    public static XMLStreamException unexpectedElementException(XMLStreamReader reader) {
        return new XMLStreamException(String.format("Unexpected element: %s.", reader.getName().toString()));
    }
}