• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error While Creating Custom Tags

 
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As the problem is with the tld file, don't you think that's what you should be showing us?
 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic