Java Tutorial/XML/XMLInputFactory

Материал из Java эксперт
Перейти к: навигация, поиск

Create XMLStreamReader from XMLInputFactory

import java.io.FileInputStream;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
public class FISTest {
  public static void main(String[] args) throws Exception {
    XMLInputFactory factory = XMLInputFactory.newInstance();
    FileInputStream fis = new FileInputStream("c.xml");
    XMLStreamReader reader = factory.createXMLStreamReader(fis);
    reader.close();
    fis.close();
  }
}