Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在属性参数中有一个带有换行符的字符串:
<rule-parameter formattingMethod="NO_FORMATTING_METHOD" type="String" value="Hello, My name is luba. How are you?"/>
当我解组此 xml 时,我为此属性获取的对象字符串位于一行中。
我应该怎么做才能使 java 属性在字符串中也有换行符?
XML 解析器(包括 JAXB)不会在 XML 属性中保留换行符。
您需要将此内容移动到 XML 元素。