Well, this is simple enough (assuming that you can overlook Kwok's flame-bating :). According to the JSP spec (same in 1.1/1.2/2.0), your taglib definition must be relative to "web.xml" (e.g. see section 7.3.2 of the 1.2 JSP spec). In particular, this means that it must be in the file ".../WEB-INF/myfile.xml". To get what you want, you need to specify uri="/myfile.xml". However this is very bad-practice, since it means that anyone can download your tld file if they know the name. It is much better to keep your pages as they are, and move the tld file to WEB-INF.
<[EMAIL PROTECTED]> wrote in message news:OF15B0E1A7.E1E9CFFF-ON48256C7F.000C82C7-48256C7F.000CB391@allsolutions. com.au... > OK, here's my JSP: > > <%@ taglib uri="myfile.xml" prefix="tl" %> > > <html><head></head> > <body> > <table border="0" width="50%"> > <tr> > <td>XML</td> > </tr> > </table> > </body> > </html> > > As you can see, I am not even attempting to parse it yet. Both the JSP and > myfile.xml residfe in the same directory - webapps/mydir/... > > Paul. > > > > > uri tells the tag where the xml file is. > What tag are you using to parse your jsp? I can't seem to find any info > on what tag you are using. > If you are using a taglib, make sure you read the doc for that taglib. > It *might* help. > > [EMAIL PROTECTED] wrote: > > >Hi, > > In my quest to be able to parse a 10 line XML file in a JSP > >(notice the sarcasm there?) and extract an element value, I have come > >accross a few PDFs that talk of custom tags - and for the purposes of > XML, > >a taglib directive. In several examples I saw <%@ taglib uri="..." > >prefix="tl" %> and syntax such as <tl:parse id=...". Can anyone shed some > > >light on this please? What is 'uri'? Presuming it was a path to my XML > >file I plugged in - <%@ taglib uri="myfile.xml" prefix="tl" %>, hoping I > >could parse it and extract elements using <tl:parse id=.... etc. > Supplying > >the XML file below, I was given the error in the browser: > > > >org.apache.jasper.JasperException: XML parsing error on file /myfile.xml: > > >(line 3, col -1): Element type "books" is not declared. > > > ><?xml version="1.0" encoding="ISO-8859-1"?> > ><books> > > > > <book isbn="123"> > > <title>1</title> > > <quantity>10</quantity> > > <price>$17.95</price> > > </book> > > > ></books> > > > >What have I stumbled upon? Am i way off thinking I can use this syntax to > > >parse my XML file? What is the significance of the error displayed? > > > >Thanks very much > > > >paul. > > > > > > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
