Java tutorial
//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; } }