XML中的换行效果如何保留并实现

???Michelle? 2020-03-06 06:03:47
在xml的代码中仅会对\r\n的\r进行转换,变成 \n,然后data的换行效果可以正常实现,但是如果返回的data只有\n,换行效果消失,多行内容会变成一行输出。
想问:
1. 为什么仅对\r进行转换,\n不会变成 ;?
2. xml是否无法实现仅有\n的换行效果,必须\r\n一对使用?

用SoapUI call webservice后,http log的显示:
Fri Mar 06 17:09:42 CST 2020:DEBUG:<< "Some of the images are partially degraded by artefact.[\n]"
Fri Mar 06 17:09:42 CST 2020:DEBUG:<< "No definite intraluminal lesion nor extrinsic compression of the trachea and main bronchi demonstrated. [\n]"
Fri Mar 06 17:09:42 CST 2020:DEBUG:<< "There is apparent prominence over lateral wall of oropharynx ? significance, suggest clinical correlation.[\n]"
Fri Mar 06 17:09:42 CST 2020:DEBUG:<< "Bulging appearance seen nasopharynx, features could be related to adenoids.[\n]"
Fri Mar 06 17:09:42 CST 2020:DEBUG:<< "Slightly hyperintense signal seen anterior superior mediastinum, features consistent with prominent thymus, probably normal variation in this age group.[\n]"
Fri Mar 06 17:09:42 CST 2020:DEBUG:<< "Multiple lymph nodes seen both sides of neck, features could be variation appearance in this age group.</report_content><linked_rpt_message/></result></ePR_rad_exam_text_report></return></ns2:getEPRRadExamTextReportResponse></S:Body></S:Envelope>"

页面显示:(会变成一大段)
MRI Trachea and Main Bronchi:Clinical Information:Recurrent spasmodic croup, need to r/o congenital upper airway/trachea obstruction like vascular ring. Sequences:Axial FL T1, HATSE T2, TRUFI T2.Coronal FL T1, TRUFI T2.Sagittal FL T1. Findings:Some of the images are partially degraded by artefact.No definite intraluminal lesion nor extrinsic compression of the trachea and main bronchi demonstrated. There is apparent prominence over lateral wall of oropharynx ? significance, suggest clinical correlation.Bulging appearance seen nasopharynx, features could be related to adenoids.Slightly hyperintense signal seen anterior superior mediastinum, features consistent with prominent thymus, probably normal variation in this age group.Multiple lymph nodes seen both sides of

正常有换行效果显示的SoapUI返回结果:( \n)
Fri Mar 06 17:58:58 CST 2020:DEBUG:<< "<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Header><work:WorkContext xmlns:work="http://oracle.com/weblogic/soap/workarea/">rO0ABXdbACN3ZWJsb2dpYy5hcHAuRVBSX0VOUVVJUllfR0VUUkFEX1dTUwAAANYAAAAjd2VibG9naWMud29ya2FyZWEuU3RyaW5nV29ya0NvbnRleHQABzIuMC4wLjEAAA==</work:WorkContext></S:Header><S:Body><ns2:getEPRRadExamTextReportResponse xmlns:ns2="http://epr_enquiry_getrad_wss.epr.ha.org.hk/"><return><?xml version="1.0" encoding="BIG5"?><ePR_rad_exam_text_report><result_status>000</result_status><in_record_key>EXAMVHM294944500002</in_record_key><result><master_record_key>EXAMVHM294944500002</master_record_key><last_updated_dtm>2009-02-16 10:43:01</last_updated_dtm><last_endorsed_dtm>2009-02-16 10:43:01</last_endorsed_dtm><first_endorsed_by>Elaine Au</first_endorsed_by><first_endorsed_dtm>2009-02-16 10:43:01</first_endorsed_dtm><second_endorsed_by/><second_endorsed_dtm/><report_content>Testing report. [\n]"
Fri Mar 06 17:58:58 CST 2020:DEBUG:<< " [\n]"
Fri Mar 06 17:58:58 CST 2020:DEBUG:<< "Intestine, Transrectal</report_content><linked_rpt_message/></result></ePR_rad_exam_text_report></return></ns2:getEPRRadExamTextReportResponse></S:Body></S:Envelope>"

页面显示:
Testing report.

Intestine, Transrectal
...全文
240 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

8,906

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧