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

XMLStreamReaderbuildXmlStreamReader(String xml)
build Xml Stream Reader
XMLInputFactory factory = XMLInputFactory.newInstance();
return factory.createXMLStreamReader(new StringReader(xml));
voidclose(XMLStreamReader r)
close
try {
    if (r != null) {
        r.close();
} catch (XMLStreamException ex) {
    throw new RuntimeException("Couldn't close xml reader", ex);
voidclose(XMLStreamReader reader)
close
if (reader != null) {
    reader.close();
voidclose(XMLStreamReader reader)
close
try {
    if (reader != null) {
        reader.close();
} catch (XMLStreamException ignore) {
XMLStreamReadercreateFilteredReader(XMLStreamReader reader, StreamFilter filter)
create Filtered Reader
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
try {
    return inputFactory.createFilteredReader(reader, filter);
} catch (XMLStreamException e) {
    throw new RuntimeException("Cant' create XMLStreamReader", e);
XMLStreamReadercreateXMLStreamReader(File file)
create XML Stream Reader
XMLInputFactory factory = XMLInputFactory.newInstance();
if (factory.isPropertySupported("javax.xml.stream.isValidating")) {
    factory.setProperty("javax.xml.stream.isValidating", Boolean.TRUE);
XMLStreamReader reader = factory.createXMLStreamReader(new FileReader(file));
return reader;
XMLStreamReadercreateXMLStreamReader(InputStream in)
create XML Stream Reader
try {
    return infactory.createXMLStreamReader(in);
} catch (XMLStreamException e) {
    throw new RuntimeException("Couldn't create a stream reader.", e);
XMLStreamReadercreateXMLStreamReader(InputStream in, String encoding)
create XML Stream Reader
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
XMLStreamReader reader = inputFactory.createXMLStreamReader(in, encoding);
return reader;
XMLStreamReadercreateXMLStreamReaderFromReader(final Reader reader)
Creates an XML stream reader from the specified input stream.
XMLInputFactory xmlif = null;
xmlif = XMLInputFactory.newInstance();
xmlif.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.TRUE);
xmlif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE);
xmlif.setProperty(XMLInputFactory.IS_COALESCING, Boolean.TRUE);
return xmlif.createXMLStreamReader(reader);
DataHandlerdecodeAsDataHandler(XMLStreamReader reader, AttachmentUnmarshaller au)
decode As Data Handler
return null;