package test.andy.xml;
import java.io.IOException;
import javax.xml.bind.JAXBException;
import javax.xml.stream.FactoryConfigurationError;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
public class TestXML {
public static void main(String[] args) throws XMLStreamException,
FactoryConfigurationError {
XMLStreamWriter writer = XMLOutputFactory.newInstance()
.createXMLStreamWriter(System.out);
writer.writeProcessingInstruction("xml",
"version=\"1.0\" encoding=\"ISO-8859-1\"");
// 写入根节点
writer.writeStartElement("elXmlIniPlus");
writer.writeStartElement("Section");
writer.writeAttribute("SectionName", "test");
writer.writeStart