java - 为什么此 XML 会产生 "...must be well-formed"验证错误?

标签 java xml jsp servlets

<分区>

我的 J2EE Web 项目的 WEB-INF 文件夹中有一个 TLD(标记库描述符)文件。我从教科书中复制了 TLD 文件。在 Eclipse EE 中,在 taglib 行附近,它给了我错误:

The markup in the document preceding the root element must be well-formed.

XML/TLD 文件:

<?xml version="1.0" encoding="ISO-8859-1" ?>

< taglib xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" version="2.0">
<tlib-version>1.2</tlib-version>
<uri>DiceFunctions</uri>
<function>
<name>rollIt</name>
<function-class>foo.DiceRoller</function-class>
<function-signature>
int rollDice()
</function-signature>
</function>
</taglib>

我该如何解决这个错误?

最佳答案

< taglib ....>应该是<taglib .....>

注意 < 之间缺少空格和 taglib .

关于java - 为什么此 XML 会产生 "...must be well-formed"验证错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23451530/

相关文章:

java - 将替代服务实现添加到类路径

java - EJB 3.1 : Kick off asynchronous task in stateless bean

c# - 如何以特定格式绑定(bind)日期时间列中的网格

java - 使用 displaytag 和 Struts 1.3 的 JSP 表格中的按钮列

java - 如何通过表单方法 GET 将填写的表单字段作为查询参数专门发送?

android - 如何解决: error: failed processing manifest

java - Gradle 项目同步失败。基本功能 - 在 Android Studio 2.2 上失败

javascript - 无法通过getRequestDispatcher转发到jsp页面

java - 如何从jsp页面中删除数据库记录?

java - 来自 byte[] 的 BitSet 长度奇怪