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

前端之家收集整理的这篇文章主要介绍了xml – 有没有办法阻止Eclipse(3.7)搞乱标签内容?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如果我使用属性视图在 XML模式中编写多行文档,则会创建< xsd:documentation>包含它的标签.

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

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

格式化之前:@H_404_2@

<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>

格式化后:@H_404_2@

<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文件 – >编辑对缩进没有帮助.在相同的首选项页面增加“行宽”修复了换行,但我真的希望编辑器不要格式化我的文档元素的内容.@H_404_2@

您可以向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>

猜你在找的XML相关文章