How to create an XML text node with an empty string value (in Java)

后端 未结 7 1716
温柔的废话
温柔的废话 2020-12-16 16:00

I am using a Transform object to save my XML file but it seems to drop empty text nodes. Is there any way to create (and keep) a text node with an empty string

7条回答
  •  没有蜡笔的小新
    2020-12-16 16:39

    If you consider the XML specs, an empty string '' is not really defined amongst the set of valid characters. so it is possible that the document builder simply ignores any occurrence of characters which are not valid.

提交回复
热议问题