字符串“-"不允许,java项目 [英] The string "--" is not permitted, java project

查看:104
本文介绍了字符串“-"不允许,java项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
不允许对字符串-"进行修复在评论中."例外?

Possible Duplicate:
Cure for ‘The string "--" is not permitted within comments.’ exception?

我有一个Java项目来解析和编辑XML文件. 当我尝试运行该项目时,我收到以下日志消息:

I have a Java project to parse and edit XML files. When I try to run the project I get the following log message:


The string "--" is not permitted within comments.
Exception in thread "main" org.xml.sax.SAXParseException: The string "--" is not permitted within comments.
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:246)
...

我该如何解决?

推荐答案

无需进一步了解您的代码:

Without further knowing your code:

有错误提示.在XML工作表的某处,您有一个注释,其中包含--.例如这样的东西:

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>

这不是格式正确的XML.注释中不允许使用--.解析器将无法检测到注释的结尾.

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.

这篇关于字符串“-"不允许,java项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆