• 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 writing taglib

 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI, I am writing a tag library as follows

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems,Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">

<!-- tag library descriptor-->
<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>projsp</short-name>
<uri>http://jakarta.apache.org/tomcat/debug-taglib</uri>;
<info> a simple tag library </info>

<!--simple tags-->
<tag>
<name>pageVisit</name>
<tag-class>myservlets.two.PageVisitTag</tag-class>
<body-content>empty</body-content>
<info>last time you have visisted this page</info>
</tag>
</taglib>


When I run the JSP which uses this taglib it gives the following error:-

org.apache.jasper.JasperException: XML parsing error on file /WEB-INF/jsp/projsp-taglib.tld: (line 12, col 7): Element type "info" must be declared.
at org.apache.jasper.xmlparser.ParserUtils.parseXMLDocument(ParserUtils.java:140)......


I have checked all the syntaxes & dont find any error.Can anyone help me in this???
 
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi venkatesh pendharkar,

change your XML Header with this then try..

 
venkatesh pendharkar
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I Saif thanks for the reply.I tried by making changes that you have mentioned but now its giving following error:

org.apache.jasper.JasperException: XML parsing error on file /WEB-INF/jsp/projsp-taglib.tld: (line 12, col 7): Element type "info" must be declared.
at org.apache.jasper.xmlparser.ParserUtils.parseXMLDocument(ParserUtils.java:140)...


and on the command line its giving following error:-

Exception initializing TldLocationsCache: XML parsing error on file /WEB-INF/jsp
/projsp-taglib.tld: (line 12, col 7): Element type "info" must be declared.
Resolve entity failed-//Sun Microsystems,Inc.//DTD JSP Tag Library 1.1//EN http:
//java.sun.com/dtd/web-jsptaglibrary_1_2.dtd
Invalid PUBLIC ID: -//Sun Microsystems,Inc.//DTD JSP Tag Library 1.1//EN

Any more suggestions??
 
venkatesh pendharkar
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
somebody please help me in this....!!!
 
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

Originally posted by venkatesh pendharkar:
somebody please help me in this....!!!



Patience is a virtue.
 
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
What lead you to believe that <info> was a valid element in a TLD?

The DTD can be found at:

http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd
 
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

Originally posted by Saif uddin:

change your XML Header with this then try..



Why would you tell him to use an older version of the DTD rather than fix his XML?
 
venkatesh pendharkar
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for you relpy Mr Bibeault, I will check the link that you have sentt & will try to find the solution.
 
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
If you are going to be working in this arena, learning how to read a DTD (and eventually an XML Schema) is essential.

Doing so, you will find that <info> is not a defined element for the TLD.
 
venkatesh pendharkar
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Thanks mr Bibeault for your reply.First sorry for late reply as i was not well for last couple of days.
Mr Bibeault i checked that info is not a mandatory attribute while defining a taglibrary.But then why does JSP engine gives the error that
Element type "info" must be declared.
at org.apache.jasper.xmlparser.ParserUtils.parseXMLDocument(ParserUtils.java:140)
This thing is really confusing me
 
venkatesh pendharkar
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,
My problem got solved.I dont know how but now there is no exception>i just copied one of the tld file that was already present with tomcat installation & just made a few changes as per my requirement (like class name & all) & it wokred fine.
Anyways thaks people for your suggestions & tips.
 
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
Look at the DTD. Do you see an <info> element defined anywhere?

You do not.

The error you were getting was saying that in order for you to use an <info> element in the XML file, it would need to be defined in the DTD.

Which, of course, it is not.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic