Java XML QName isEventStartOrEndElementWithMatchingName(XMLEvent event, QName elementName)

Here you can find the source of isEventStartOrEndElementWithMatchingName(XMLEvent event, QName elementName)

Description

is Event Start Or End Element With Matching Name

License

Open Source License

Declaration

static boolean isEventStartOrEndElementWithMatchingName(XMLEvent event, QName elementName) 

Method Source Code


//package com.java2s;
import javax.xml.namespace.QName;

import javax.xml.stream.events.XMLEvent;

public class Main {
    static boolean isEventStartOrEndElementWithMatchingName(XMLEvent event, QName elementName) {
        if (event == null)
            throw new IllegalArgumentException("Event may not be null.");

        QName eventElementName = null;
        if (event.isStartElement())
            eventElementName = event.asStartElement().getName();
        else if (event.isEndElement())
            eventElementName = event.asEndElement().getName();
        else/*from  w ww.j ava  2s.  c om*/
            return false;

        if (eventElementName.equals(elementName))
            return true;
        return false;
    }
}

Related

  1. hasGmlNamespace(QName qname)
  2. hasQName(final Node e, final QName name)
  3. hasQName(Node node, QName qname)
  4. isElementName(Element element, QName name)
  5. isEndElement(final XMLEvent event, final QName name)
  6. isJAXBElement(Class declaredType, QName name, Class scope, Object value)
  7. isPrimitiveIdlType(QName idlType)
  8. isPrimitiveType(final QName elementType)
  9. isSameNamespace(QName q1, QName q2)