Eclipse中xml格式化设置

1.问题

Eclipse中xml文件格式化后,整个一团糟,并不是我们想要的,我们需要自行修改其格式化参数

2.解决

2.1 找到 Windows>Preference>XML>XML Files>Editor

2.2 具体参数

  • Line width: 设置每行宽度Line width设定为80到100个字符。
  • Split multiple attributes each on a new line: 标签的每个属性都单独一行显示
  • Preserve whitespace in tags with PCDATA content: 保留具有 PCDATA 内容的标签中的空白
  • Align final bracket in multi-line element tags: 标签结束符不单独占用一行
  • Clear all blank lines: 去掉所有空行
  • Insert whitespace before closing empty end-tags: 在标签结束符前添加空格
  • Indent using spaces: 缩进使用空格代替tab
  • Indentation size: 如果use tabs,设定为1,代表使用1个tab; 如果使用use spaces,设定缩进宽度设定为4,即缩进4个空格
posted @   DawnTraveler  阅读(321)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示