How to disable/avoid Ampersand-Escaping in Java-XML?

后端 未结 4 1040
梦谈多话
梦谈多话 2021-01-05 10:50

I want to create a XML where blanks are replaced by  . But the Java-Transformer escapes the Ampersand, so that the output is  

4条回答
  •  清酒与你
    2021-01-05 11:17

    Try to use

    element.appendChild (document.createCDATASection (" "));
    

    instead of

    element.setTextContent(...);
    

    You'll get this in your xml: It may work if I understand correctly what you're trying to do.

提交回复
热议问题