http://tutorials.jenkov.com/java-xml/stax-xmlinputfactory.html에서 가져옴


The class javax.xml.stream.XMLInputFactory is a root component of the Java StAX API. From this class you can create both an XMLStreamReader and an XMLEventReader. Here are two examples:

XMLInputFactory factory = XMLInputFactory.newInstance();

XMLEventReader eventReader =
    factory.createXMLEventReader(
        new FileReader("data\\test.xml"));

XMLStreamReader streamReader =
    factory.createXMLStreamReader(
        new FileReader("data\\test.xml"));

XMLInputFactory Properties

You can set various properties on the XMLInputFactory instance using the setProperty() method. Here is an example:

factory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, true);

For a full list of properties and their meaning, see the official JavaDoc (in Java 6) for the StAX API.

'밤을 지새다 > Java' 카테고리의 다른 글

Java StAX: XMLEventReader - The Iterator API  (0) 2012.04.30
Java StAX: XMLOutputFactory  (0) 2012.04.30
Java StAX  (0) 2012.04.30
Exceptions  (0) 2011.09.05
자바. 얼마나 알고 사용하고 계신가요?  (0) 2011.08.25

+ Recent posts