Java Utililty Methods XMLStreamReader

List of utility methods to do XMLStreamReader

Description

The list of methods to do XMLStreamReader are organized into topic(s).

Method

voidskipNewLines(XMLStreamReader xmlStreamReader)
Skip new lines after the end elements.
if (xmlStreamReader.isCharacters()) {
    while (xmlStreamReader.isCharacters() && xmlStreamReader.hasNext())
        xmlStreamReader.next();
StringtoReadableEvent(XMLStreamReader r)
Utility method that converts the current event on the XML stream to something human-readable for debug purposes.
int t = r.getEventType();
if (t == 1)
    return "<" + r.getLocalName() + ">";
if (t == 2)
    return "</" + r.getLocalName() + ">";
if (t == 3)
    return "PROCESSING_INSTRUCTION";
if (t == 4)
...
voidwrite(XMLStreamReader xmlr, XMLStreamWriter writer)
Borrowed from org.apache.xml.security.test.stax.utils.XmlReaderToWriter
switch (xmlr.getEventType()) {
case XMLEvent.START_ELEMENT:
    final String localName = xmlr.getLocalName();
    final String namespaceURI = xmlr.getNamespaceURI();
    if (namespaceURI != null && namespaceURI.length() > 0) {
        final String prefix = xmlr.getPrefix();
        if (prefix != null) {
            writer.writeStartElement(prefix, localName, namespaceURI);
...
voidwriteCharacters(XMLStreamReader reader, XMLStreamWriter writer)
write Characters
writer.writeCharacters(reader.getText());