How to remove the white spaces between tags in XML

后端 未结 7 914
太阳男子
太阳男子 2020-12-06 18:00

I created an XML document using Java in my android application. I have to call a web service in my application and pass this XML as an argument there. But my problem is ther

7条回答
  •  鱼传尺愫
    2020-12-06 18:33

    I was able to remove whitespace/tabs/newlines from my transformation using the following property:

    transformer.setOutputProperty(OutputKeys.INDENT, "no");
    

    You had it set to yes. I'm sure this question is old enough that it doesn't matter now; but if anyone runs into this in the future, setting the property to no saved me.

提交回复
热议问题