开发者

Carriage returns in XML comment: "The content of elements must consist of well-formed character data or markup"

I have the following Ant build file:

<?x开发者_Go百科ml version="1.0" encoding="UTF-8"?>
<project default="build" name="MyAntScript">

    <!--
    A comment explaining
    the ant file going over
    multiple lines
    like this
    quite poetic, huh?
    -->

    <import file="myant.xml" />
    ...
</project>

When viewing this file in Eclipse and when running my Ant script, it gives me the following error message

      c:\myant.xml:6: The content of elements must consist of well-formed
      character data or markup.

The error goes away if I turn the XML comment into a single line (edit: and comes back when I put the newline back in...). What gives??


Edit The problem was in the imported ant file..Eclipse had an issue where it marked line 6 in the main Ant build file rather than the imported build file.


Thanks to Jon Skeet's pointers, I tried shortening the Ant file until I figured out the problem was actually in line six of an imported Ant build file, not the main file itself. This had thrown me off since Eclipse was marking line six of the main Ant build file.

The imported Ant build file had a SVN conflict which obviously led to issues with XML well-formedness.

Sorry about that. I'll leave this open in case someone else encounters a similar silly mistake...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜