The require()
method asserts that the current event has a certain type, local name,
and namespace URI:
public void require(int type, String namespaceURI,
String localName)
throws XMLStreamException
If the event does not have the right name and URI,
an XMLStreamException
is thrown.
You can pass null for the local name or namespace URI, to match any local name/namespace URI.
This is useful for in-process validation.