2

重複
の可能性:「コメント内で文字列「-」を使用することはできません。」例外?

XMLファイルを解析および編集するJavaプロジェクトがあります。プロジェクトを実行しようとすると、次のログメッセージが表示されます。

文字列「-」はコメント内では許可されていません。
スレッド"main"の例外org.xml.sax.SAXParseException:文字列"-"はコメント内で許可されていません。
    com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:246)で
..。

どうすれば解決できますか?

4

1 に答える 1

8

Without further knowing your code:

There error is as you were told. Somewhere in your XML sheet, you have a comment, which includes a -- in it. For example something like this:

<root>
  <!-- my comment with -- in it -->
</root>

This is not a well formed XML. Within a comment -- is not allowed. The parser will have problems to detect the end of the comment then.

于 2012-12-20T09:27:46.827 に答える