Java XMLStreamReader getXMLStreamReader(File file)

Here you can find the source of getXMLStreamReader(File file)

Description

get XML Stream Reader

License

Open Source License

Declaration

public static XMLStreamReader getXMLStreamReader(File file) throws XMLStreamException, FileNotFoundException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

import java.io.InputStream;

import javax.xml.stream.XMLInputFactory;

import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;

public class Main {
    private static XMLInputFactory staxInputFactory;

    public static XMLStreamReader getXMLStreamReader(File file) throws XMLStreamException, FileNotFoundException {
        InputStream inputStream = new BufferedInputStream(new FileInputStream(file));
        return getStaxInputFactory().createXMLStreamReader(inputStream);
    }/*from  www  .j a va  2  s. co  m*/

    public static XMLInputFactory getStaxInputFactory() {
        if (staxInputFactory == null) {
            staxInputFactory = XMLInputFactory.newInstance();
        }
        return staxInputFactory;
    }
}

Related

  1. createXMLStreamReader(InputStream in)
  2. createXMLStreamReader(InputStream in, String encoding)
  3. createXMLStreamReaderFromReader(final Reader reader)
  4. decodeAsDataHandler(XMLStreamReader reader, AttachmentUnmarshaller au)
  5. getNextEvent(XMLStreamReader reader)
  6. getXMLStreamReader(InputStream is)
  7. getXSIType(XMLStreamReader reader)
  8. isContextual(XMLStreamReader input)
  9. isEndTag(XMLStreamReader reader, String tagLocalName)