use of org.jboss.galleon.xml.util.FormattingXmlStreamWriter in project galleon by wildfly.
the class BaseXmlWriter method write.
public void write(T t, Writer stream) throws XMLStreamException, IOException {
final ElementNode root = toElement(t);
try (FormattingXmlStreamWriter writer = new FormattingXmlStreamWriter(XMLOutputFactory.newInstance().createXMLStreamWriter(stream))) {
writer.writeStartDocument();
root.marshall(writer);
writer.writeEndDocument();
}
}
use of org.jboss.galleon.xml.util.FormattingXmlStreamWriter in project galleon by wildfly.
the class Configuration method needRewrite.
public void needRewrite() throws XMLStreamException, IOException {
Path configFile = getConfigFile();
Files.deleteIfExists(configFile);
try (BufferedWriter bw = Files.newBufferedWriter(configFile, StandardOpenOption.CREATE, StandardOpenOption.WRITE)) {
try (FormattingXmlStreamWriter writer = new FormattingXmlStreamWriter(XMLOutputFactory.newInstance().createXMLStreamWriter(bw))) {
writer.writeStartDocument();
writer.writeStartElement(ConfigXmlParser10.ROOT_1_0.getLocalPart());
writer.writeDefaultNamespace(ConfigXmlParser10.NAMESPACE_1_0);
maven.write(writer);
writer.writeEndElement();
writer.writeEndDocument();
}
}
}
Aggregations