自定义Taglib编译错误

use*_*944 0 jsp jsp-tags taglib

我正在尝试为自定义标记创建一个taglib.但是我在Eclipse IDE中遇到了编译错误.这是我的TagLib描述:

<?xml version="1.0" encoding="UTF-8"?>
<taglib version="2.1" xmlns="http://java.sun.com/xml/ns/javaee" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd">
  <tlib-version>1.0</tlib-version>  
  <uri>MyFunction</uri>
  <function>
      <name>myFunc</name>
      <function-class>com.tldcls.MyClass</function-class>
      <function-signature>int age()</function-signature>
  </function> 
</taglib>
Run Code Online (Sandbox Code Playgroud)

我在标签上收到编译错误.错误告诉:

cvc-complex-type.2.4.a: Invalid content was found starting with element 'uri'.
Run Code Online (Sandbox Code Playgroud)

我无法弄清问题在哪里.

JB *_*zet 5

文件中提到的XSD(http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd)显示taglib元素具有以下子元素,按此顺序

  • tlib-version
  • short-name
  • uri
  • ...

short-name不是可选的,它应该是建议的前缀用于此标记库.