List of utility methods to do XMLStreamReader
String | printEvent(XMLStreamReader xmlr) print Event StringBuffer b = new StringBuffer(); b.append("EVENT:[" + xmlr.getLocation().getLineNumber() + "][" + xmlr.getLocation().getColumnNumber() + "] "); b.append(getName(xmlr.getEventType())); b.append(" ["); switch (xmlr.getEventType()) { case XMLStreamReader.START_ELEMENT: b.append("<"); ... |
void | printEvent(XMLStreamReader xmlr, boolean showEvents) print Event if (showEvents) { System.out.print("EVENT:[" + xmlr.getLocation().getLineNumber() + "][" + xmlr.getLocation().getColumnNumber() + "] [" + getEventTypeName(xmlr.getEventType()) + "]"); System.out.print(" ["); switch (xmlr.getEventType()) { case XMLStreamConstants.START_ELEMENT: System.out.print("<"); ... |
void | printLiterally(final PrintStream os, final XMLStreamReader xmlReader) print Literally final int start = xmlReader.getTextStart(); final int length = xmlReader.getTextLength(); os.print(new String(xmlReader.getTextCharacters(), start, length)); |
void | printText(XMLStreamReader xmlr) Print out text if (xmlr.hasText()) { System.out.println("HAS TEXT: " + xmlr.getText()); } else { System.out.println("HAS NO TEXT"); |
void | readEndTag(XMLStreamReader reader, String localName) read End Tag reader.nextTag(); reader.require(XMLStreamConstants.END_ELEMENT, null, localName); |
String | readEvent(XMLStreamReader reader) read Event StringBuffer buf = new StringBuffer(); int type = reader.getEventType(); switch (type) { case XMLStreamConstants.START_DOCUMENT: break; case XMLStreamConstants.END_DOCUMENT: break; case XMLStreamConstants.START_ELEMENT: ... |
String | readTextWithNodes(XMLStreamReader xsr, Map Processes the TextWithNodes element from this XMLStreamReader, returning the text content of the document. StringBuffer textBuf = new StringBuffer(20480); int eventType; while ((eventType = xsr.next()) != XMLStreamConstants.END_ELEMENT) { switch (eventType) { case XMLStreamConstants.CHARACTERS: textBuf.append(xsr.getTextCharacters(), xsr.getTextStart(), xsr.getTextLength()); break; case XMLStreamConstants.START_ELEMENT: ... |
void | skip(XMLStreamReader parser) skip while (parser.hasNext()) { int eventType = parser.next(); if (eventType == XMLStreamConstants.START_ELEMENT) { skip(parser); } else if (eventType == XMLStreamConstants.END_ELEMENT) { return; |
void | skip(XMLStreamReader parser) Skips a tag or subtree. assert parser != null; int level = 1; while (next(parser)) { int event = parser.getEventType(); if (event == XMLStreamConstants.START_ELEMENT) { level++; } else if (event == XMLStreamConstants.END_ELEMENT) { level--; ... |
int | skipEventsTo(int targetEvent, XMLStreamReader parser) skip Events To int eventType = 0; while (parser.hasNext()) { eventType = parser.next(); if (eventType == targetEvent) return eventType; return eventType; |