Adding linebreak in xml file before root node

前端 未结 5 2702
庸人自扰
庸人自扰 2021-02-20 01:41

I am trying to add line break after my comments above the root node in XML document.

I need something like this:



        
5条回答
  •  我在风中等你
    2021-02-20 02:36

    There is a JDK bug concerning this. It was not fixed (as you would expect) because that would likely cause many problems to users' existing applications.

    Adding the following output property fixes this:

    transformer.setOutputProperty("http://www.oracle.com/xml/is-standalone", "yes");
    

提交回复
热议问题