运行 xml 文件时在斜线 n 附近解析错误

Parse error near slash n while running xml file

我曾尝试 运行 这个 xml 文件,但不幸的是它无法解析,我总是收到错误消息:config.xml:2: parse error near `\ n' .

老实说,我不知道如何解决它。

<config control-bind="127.0.0.1:8059" version="1.0">
    <web-server context="/fisheye">
        <http bind="<IP Address>:8060"/>
    </web-server>
    <security allow-anon="true" allow-cru-anon="true"/>
    <repository-defaults>
        <linker/>
        <allow/>
        <tarball enabled="false" maxFileCount="0"/>
        <security allow-anon="true"/>
    </repository-defaults>
</config>

问题是属性值中不能有 < 个字符。

改变

    <http bind="<IP Address>:8060"/>

    <http bind="&lt;IP Address>:8060"/>

然后你的 XML 将是 well-formed

另见

  • Simplified XML Escaping (prioritized, 100% complete)