有选择地关闭XML文件的Eclipse格式

Ben*_*eer 9 xml eclipse formatting

有一种方法可以有选择地关闭Eclipse格式(Java代码)(参见此处).

是否有格式化XML文件的等价物?

yot*_*oto 5

不可以.您唯一能做的就是选择"使用PCDATA内容保留标签中的空格"


sgr*_*lon 5

<token><![CDATA[..... Your line ....]]></token>

在 Eclispe 上,我在 pom.xml 中使用此解决方案

<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
    <version>1.5.3</version>
    <executions>
        <execution>
            <phase>compile</phase>
            <goals>
                <goal>replace</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
    <basedir>${basedir}</basedir>
    <unescape>true</unescape>
    <includes>
        <include>src/test/resources/steps/scenarios/xxxxxx.feature</include>
    </includes>
    <token><![CDATA[Then home page is displayed[\\s\\S]*Then go to PRODUCTION]]></token>
    <value><![CDATA[Then home page is displayed\n\n    ##patch for IC\n    Then I change CP\n    ##end patch for IC\n\n    Then go to PRODUCTION]]></value>
    </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)

  • 这应该是公认的答案。CDATA 技巧很好地防止了 Eclipse XML 格式化程序将长 Docker cmd/shell 值分解为随后失败的片段,谢谢。 (2认同)