Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import javax.xml.namespace.QName;

import javax.xml.stream.events.EndElement;
import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent;

public class Main {
    private static boolean checkNameAndNamespace(XMLEvent event, String tagName, String namespace) {
        if (event.isStartElement()) {
            StartElement element = (StartElement) event;
            QName name = element.getName();
            return tagName.equalsIgnoreCase(name.getLocalPart())
                    && namespace.equalsIgnoreCase(name.getNamespaceURI());
        } else if (event.isEndElement()) {
            EndElement element = (EndElement) event;
            QName name = element.getName();
            return tagName.equalsIgnoreCase(name.getLocalPart())
                    && namespace.equalsIgnoreCase(name.getNamespaceURI());
        }

        return false;
    }
}