When Java uses dom4j to generate xml, the second line is blank and xmlns is invalid.

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

The above code solves the problem of invalid xmlns, and Message is the root node.

format.setNewLineAfterDeclaration(false);
The above solves the second blank line problem.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325349560&siteId=291194637