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

Error while writing taglib

venkatesh pendharkar
Ranch Hand

Joined: Apr 29, 2006
Posts: 106
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???
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

hi venkatesh pendharkar,

change your XML Header with this then try..



Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
venkatesh pendharkar
Ranch Hand

Joined: Apr 29, 2006
Posts: 106
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

Joined: Apr 29, 2006
Posts: 106
somebody please help me in this....!!!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

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


Patience is a virtue.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

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
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

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

Joined: Apr 29, 2006
Posts: 106
Thanks for you relpy Mr Bibeault, I will check the link that you have sentt & will try to find the solution.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

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

Joined: Apr 29, 2006
Posts: 106
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

Joined: Apr 29, 2006
Posts: 106
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
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error while writing taglib