Java使用dom4j生成xml的时候 第二行空行 并xmlns无效问题

                Element root = null;
		Document document = DocumentHelper.createDocument(root);
		root = document.addElement("Message","http://www.chinaport.gov.cn/ENT");

上面代码解决 xmlns无效问题 ,Message是根节点。

format.setNewLineAfterDeclaration(false); 
上面的解决第二行空行问题。

猜你喜欢

转载自blog.csdn.net/g631521612/article/details/79390429
今日推荐