aspose file tools*
The moose likes JSP and the fly likes Error While Creating Custom Tags Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Error While Creating Custom Tags" Watch "Error While Creating Custom Tags" New topic
Author

Error While Creating Custom Tags

Arjun Reddy
Ranch Hand

Joined: Nov 10, 2007
Posts: 627
Hi Guys,

I was going through the following link which explains how to create JSP custom tags and everything seems to be working fine except for an error in my JSP file.

Link: http://www.ibm.com/developerworks/java/library/j-pj2ee8/

The error I got is:

JspTranslate: : XML parsing error on file /WEB-INF/lib/DateTagLib.tld: (line 2, col 9): Document root element "taglib", must match DOCTYPE root "null"..

Any idea on what is causing this error?

Btw, the tld file, I created a new xml file and named it as .tld instead of .xml. Am I doing it right?

My Jsp file is as follows:
<blockquote>code:
<pre name="code" class="core"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib uri="/WEB-INF/lib/DateTagLib.tld" prefix="abc" %>
<HTML>
<HEAD>
<TITLE>Date tag example</TITLE>
</HEAD>

<BODY>
<H1>Date tag Example</H1>
<p>Hi today is <b><abc:displayDate /></b> </p>
</BODY>
</HTML>

</pre>
</blockquote>

Thanks.
[ July 17, 2008: Message edited by: Arjun Reddy ]

Be Humble... Be Nice.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61198
    
  66

As the problem is with the tld file, don't you think that's what you should be showing us?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Arjun Reddy
Ranch Hand

Joined: Nov 10, 2007
Posts: 627
Um.. Okie.. sorry.

<blockquote>code:
<pre name="code" class="core"> <?xml version="1.0" encoding="UTF-8"?>
<taglib>
<tlibversion>1.0</tlibversion>
<info>A simple tag library</info>
<tag>
<name>displayDate</name>
<tagclass>myTags.DateTag</tagclass>
<bodycontent>empty</bodycontent>
<info>Display Date</info>
</tag>
</taglib>
</pre>
</blockquote>

Thanks.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61198
    
  66

Is there really as space before the XML declaration? Is this for a JSP 2.0 application? If so, where's the rest of the taglib declaration (xmlns and so on?)

Here's the first 6 lines of one of my tld file:
<blockquote>code:
<pre name="code" class="core"><?xml version="1.0" standalone="no" ?>

<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">
</pre>
</blockquote>
[ July 17, 2008: Message edited by: Bear Bibeault ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error While Creating Custom Tags