XMLInputFactory: createXMLStreamReader(InputStream stream) : XMLInputFactory « javax.xml.stream « Java by API






XMLInputFactory: createXMLStreamReader(InputStream stream)

  

import java.io.File;
import java.io.FileInputStream;

import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;

public class Main {

  public static void main(String[] args) throws Exception {
    File file = new File("test.xml");

    XMLInputFactory inputFactory = XMLInputFactory.newInstance();
    XMLStreamReader reader = inputFactory.createXMLStreamReader(new FileInputStream(file));

    while (reader.getEventType() == 6)
      reader.next();

    int eventTypeID = reader.next();
    System.out.println("Hello " + reader.getText());
  }
}

   
    
  








Related examples in the same category

1.XMLInputFactory.IS_COALESCING
2.XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES
3.XMLInputFactory.setProperty(String name, Object value)
4.XMLInputFactory: createFilteredReader(XMLEventReader reader, EventFilter filter)
5.XMLInputFactory: createFilteredReader(XMLStreamReader reader, StreamFilter filter)
6.XMLInputFactory: createXMLEventReader(InputStream stream)
7.XMLInputFactory: createXMLEventReader(Reader reader)
8.XMLInputFactory: setXMLResolver(XMLResolver resolver)