如何查找 XML 文件中的错误?

发布于 2024-10-05 01:01:20 字数 184 浏览 4 评论 0原文

有时,当我尝试运行代码时,Eclipse 控制台会显示:

XML 文件中出现错误:正在中止构建。

这意味着我的主 XML 文件中有一个错误。有没有什么方法可以找到我的错误,而无需进行猜测和删除一些 XML 代码来查看问题出在哪里?比如验证我的 XML 文件!谢谢。

Sometimes when I'm trying to run my code, the Eclipse console says:

Error in an XML file: aborting build.

That means that I have a mistake in my main XML file. Is there any way to find my mistake without making guesses and erasing some XML code in order to see where the problem is? Something like validation of my XML file! Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

叹倦 2024-10-12 01:01:20

XML 工具,一个插件for Notepad++ 允许您检查 XML 语法是否损坏并告诉您错误在哪一行。

要安装 XML 工具插件,请下载插件 zip 文件,并将内容解压到您安装 Notepad++ 的位置(例如 C:\Program Files\Notepad++)。然后重新启动Notepad++,打开要检查的XML文件,单击顶部的“插件”菜单,选择“XML工具”,然后单击“立即检查XML语法”。

希望有帮助。

XML Tools, a plugin for Notepad++ allows you to check if the XML syntax is broken and tells you on what line the error is.

To install the XML tools plugin, download the plugin zip file, and extract the contents to where you have installed Notepad++ (such as C:\Program Files\Notepad++). Then restart Notepad++, open the XML file you wish to check, click on the "Plugins" menu at the top, select "XML Tools" and click on "Check XML syntax now."

Hope that helps.

粉红×色少女 2024-10-12 01:01:20

您甚至可以在 Firefox 中打开它,如果格式错误,它会显示错误所在。

You could even open it in firefox, and if it is malformed it will show you where the error lies.

翻了热茶 2024-10-12 01:01:20

不能肯定地说这是否是相同的问题,但我有时会使用 xml 文件作为活动窗口运行我的应用程序,这会创建一个中止构建。确保您没有运行 xml 文件。

Can't say for sure if it is same issue but I have on occasion Run my application with an xml file as the active window and that creates an abort build. Make sure your not Running an xml file.

留蓝 2024-10-12 01:01:20

XML Tools,Notepad++ 的一个插件,允许您检查 XML 语法是否损坏并告诉您错误在哪一行

我认为 Notepad++ 会报告错误后的第一行,Notepad++ 知道之前一定有错误。

我刚刚使用 Notepad++ 和 XML Tools 来调查一个文件,结果发现该文件有大约 30 个“单位翻转”错误。例如,“text:p”显示为“text:q”; “table-cell”显示为“table:cdll”和“>”显示为“=”等。

最初我认为错误一定是在报告行之前的匹配标签部分中。然而,由于有如此多的错误,我正在寻找报告错误行上方一百或两百行以及紧邻前面的匹配标签部分上方的问题。

我推断如果结束“>”如果已转换为“=”,则 Notepad++ 将读取后面的大部分内容作为自由文本。

我发现 XML 复制编辑器更容易使用,因为它发现每一行都有错误。我需要先使用 Notepad++ 进行漂亮的打印。

XML Tools, a plugin for Notepad++ allows you to check if the XML syntax is broken and tells you on what line the error is.

I think that Notepad++ reports the first line after the error(s) at which Notepad++ knows there must be an error earlier.

I have just used Notepad++ and XML Tools to investigate a file which turned out to have about 30 "single bit flipped" errors. For example, "text:p" appeared as "text:q"; "table-cell" appeared as "table:cdll" and ">" appeared as "=" etc.

Initially I thought that the error must be in the matched tags section immediately preceding the reported line. However, with so many errors I was looking for problems a hundred or two hundred lines above the reported error line and well above the immediately preceding matched tags section.

I reasoned that if an end ">" had been converted to "=" then Notepad++ would be reading much that followed as free text.

I found XML Copy Editor much easier to use as it found each line with an error. I needed to pretty print first using Notepad++.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文