List of utility methods to do XMLStreamReader
int | getNextEvent(XMLStreamReader reader) Returns the next relevant reader event. while (reader.hasNext()) { int e = reader.next(); if (e == XMLStreamConstants.END_DOCUMENT) { return e; if (e == XMLStreamConstants.START_ELEMENT || e == XMLStreamConstants.END_ELEMENT) { return e; } else if (e == XMLStreamConstants.CHARACTERS) { ... |
XMLStreamReader | getXMLStreamReader(File file) get XML Stream Reader InputStream inputStream = new BufferedInputStream(new FileInputStream(file)); return getStaxInputFactory().createXMLStreamReader(inputStream); |
XMLStreamReader | getXMLStreamReader(InputStream is) get XML Stream Reader return new StreamReaderDelegate(XMLInputFactory.newInstance().createXMLStreamReader(is)) { public int next() throws XMLStreamException { while (true) { int event = super.next(); switch (event) { case XMLStreamConstants.COMMENT: case XMLStreamConstants.PROCESSING_INSTRUCTION: continue; ... |
QName | getXSIType(XMLStreamReader reader) Returns the value of xsi:type attribute String qname = reader.getAttributeValue(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "type"); return getValueAsQName(reader, qname); |
boolean | isContextual(XMLStreamReader input) is Contextual return input.getAttributeValue(LOCATION_NS, LOCATION_END_LINE_ATTR) != null ? true : false;
|
boolean | isEndTag(XMLStreamReader reader, String tagLocalName) Test if reader is on an end tag named tagLocalName. return (reader.getEventType() == XMLStreamConstants.END_ELEMENT)
&& (reader.getLocalName().equals(tagLocalName));
|
boolean | isStartTag(XMLStreamReader reader) Test if reader is on a start tag. return (reader.getEventType() == XMLStreamConstants.START_ELEMENT);
|
void | logReader(Logger logger, String msg, XMLStreamReader reader) log Reader if (logger.isDebugEnabled()) {
logger.debug(readerStatus(msg, reader));
|
boolean | move(XMLStreamReader reader) move if (reader.getEventType() == XMLStreamReader.START_ELEMENT || reader.getEventType() == XMLStreamReader.END_ELEMENT) { return false; return true; |
void | moveReaderToEndCurrentTag(XMLStreamReader reader) Moves the reader to the closing tag of current tag. int level = 0; QName tag = reader.getName(); for (int event = reader.getEventType(); reader.hasNext(); event = reader.next()) { if (XMLStreamReader.START_ELEMENT == event) { level += 1; } else if (XMLStreamReader.END_ELEMENT == event) { level -= 1; if (level == 0 && tag.equals(reader.getName())) { ... |