Java – JSP custom tag: missing DTD / XML schema

I wrote my JSP custom tag with the following TLD:

<?xml version="1.0" encoding="UTF-8"?>
<taglib
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee web-jsptaglibrary_2_1.xsd"
  xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  version="2.1">
  <tlibversion>1.0</tlibversion> 
  <jspversion>2.1</jspversion>
  ...

Now eclipse Helios complains that "no syntactic constraints (DTD or XML schema) have been detected for the document."

I know how to disable warnings. I want to know how to solve the problem by providing DTD or schema information

By the way, in the XML above, I have:

xsi:schemaLocation="http://java.sun.com/xml/ns/javaee web-jsptaglibrary_2_1.xsd"

But it doesn't seem to help

To update Peter's suggestions, I went to my window > Preferences > XML > XML directory and I found that the following might be suitable:

Entry element:  Public
Location:   dtdsAndSchemas/web-jsptaglibrary_1_2.dtd in jar file 
usr/local/eclipse/plugins/org.eclipse.jst.standard.schemas_1.1.0.v201003031644.jar
URI:       jar:file:/usr/local/eclipse/plugins/org
  .eclipse.jst.standard.schemas_1.1.0.v201003031644.jar!/dtdsAndSchemas
  /web-jsptaglibrary_1_2.dtd
Key type:   Public ID
Key:    -//Sun Microsystems,Inc.//DTD JSP Tag Library 1.2//EN

So I try to add the following to my TLD:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems,Inc.//DTD JSP Tag Library 1.2//EN" 
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_2.dtd">

Now I have the following errors:

Multiple comments were found on this line:

>Attribute 'XSI: schemalocation'. Must be declared for element type 'taglib' Attribute 'version'. Must be declared for element type 'taglib' Value is“ http://java.sun.com/xml/ns/javaee ”The value of the property 'xmlns' of must be“ http://java.sun.com/JSP/ TagLibraryDescriptor”. > schema_ reference. 4: Unable to read schema document 'web jsptaglibrary'_ 2_ 1. XSD 'because

1) File not found; 2) The document cannot be read; 3) The root element of the document is not. > The content of element type "taglib" must match "(tlib version, JSP version, short name, URI?, display name?, small icon?, large icon?, description?, validator?, listener *, label)". > Attribute 'xmlns: XSI' must be declared for element type 'taglib'

Solution

If eclipse does not automatically get the XSD from the library, you can add it manually at any time:

In my case, it already exists in the plug - in section It may come with an eclipse Java EE plug - in

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>