on-internet
← Community

How to add line break into XML file with Java?

Stack Overflow ·

How to add line break after the "do not edit this file" comment? I've tried to add textnode with line break but it doesn't work. Code: import java.io.File; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.w3c.dom.Document; import org.w3c.dom.Element; public class Main { public static void main(String[] args) { try { final Document doc = DocumentBuilderFactory.newInstance

Comments

Sign in or sign up to comment and upvote.

No comments yet.