我听说使用单引号来包围XML属性值是一种"糟糕的风格".它是否正确?
我应该总是写:
<element attr="value">
Run Code Online (Sandbox Code Playgroud)
或者可以写:
<element attr='value'>
Run Code Online (Sandbox Code Playgroud)
或者我使用哪种风格无关紧要?
<bean id="fileDiffTaskelt" class="org.springframework.batch.core.step.tasklet.SystemCommandTasklet" scope="step">
<property name="command" value="diff #{jobParameters['INPUT_FILE']} #{jobParameters['PREVIOUS_FILE']} | grep -e '<' -e '>' | grep -x '.\{20\}' > #{jobParameters['FILTERED_FILE']}"/>
<property name="timeout" value="60000"/>
<property name="workingDirectory" value="/tmp/hub"/>
</bean>
Run Code Online (Sandbox Code Playgroud)
我在 IDE 中收到此错误:与元素类型“属性”关联的属性“值”的值不得包含“<”字符。我在我的 grep 命令中使用了这个字符,非常重要,卡在这里。