Java StAX: XMLOutputFactory
javax.xml.stream.XMLOutputFactory is a root component of the Java StAX API.
From this class you can create both an
XMLStreamWriter and an
Here are two examples:
XMLOutputFactory factory = XMLOutputFactory.newInstance(); XMLEventWriter eventWriter = factory.createXMLEventWriter( new FileWriter("data\\test.xml")); XMLStreamWriter streamWriter = factory.createXMLStreamWriter( new FileWriter("data\\test.xml"));
You can set one property on the
XMLOutputFactory instance using the
setProperty() method. Here is an example:
For a full list of properties and their meaning, see the official JavaDoc (in Java 6) for the StAX API.