加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

xml – 有没有办法阻止Eclipse(3.7)搞乱标签内容?

发布时间:2020-12-16 07:45:24 所属栏目:百科 来源:网络整理
导读:如果我使用属性视图在 XML模式中编写多行文档,则会创建 xsd:documentation包含它的标签. 每当我格式化文件(CTRL SHIFT F)时,除了第一行之外的所有行都是缩进的,有时由于这种缩进而被包装. 这种缩进和包装有效地破坏了从文件生成漂亮文档的所有努力.特别是如
如果我使用属性视图在 XML模式中编写多行文档,则会创建< xsd:documentation>包含它的标签.

每当我格式化文件(CTRL SHIFT F)时,除了第一行之外的所有行都是缩进的,有时由于这种缩进而被包装.

这种缩进和包装有效地破坏了从文件生成漂亮文档的所有努力.特别是如果我想记录一个允许值的表.

格式化之前:

<xsd:documentation>1st line of comment
2nd line is indented and also wrapped as it exceeds the max line length setting.
3rd line is just indented.
</xsd:documentation>

格式化后:

<xsd:documentation>1st line of comment
    2nd line is indented and also wrapped as it exceeds the max line 
    length setting.
    3rd line is just indented.
</xsd:documentation>

首选项中的“格式注释”选项 – > XML – > XML文件 – >编辑对缩进没有帮助.在相同的首选项页面上增加“行宽”修复了换行,但我真的希望编辑器不要格式化我的文档元素的内容.

您可以向xsd:documentation添加xml atribute xml:space =“preserve”以告知必须保留空格.例如:
<xsd:documentation xml:space="preserve" >1st line of comment
    2nd line is indented and also wrapped as it exceeds the max line length setting.
    3rd line is just indented.
</xsd:documentation>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读