• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

namespaces, rdf and forEach

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I hope someone can help me with this one. I'm rather new to jstl to maybe it's a no-problem, but anyway I'm stuck.
I have this foxmarks.xml file:

=== foxmarks.xml ===============================================================

=== foxmarks.xml =======================================================

I've shortened it up a bit (...)
It contains information about my firefox bookmarks that I want to present in a webpage.
So I'm trying to read the data with a c:forEach but I don't know how to handle the namespace prefixes.
This is what I've tried:

=== fox.jsp ====================================================================

=== fox.jsp ============================================================

1) The above code gives zero output and no errors. Maybe it can't find any "Folder" tags?

2) So I try to add the namespace
<x:forEach var="n" select="$doc//NC:Folder">
<x:out select="$n/NC:URL" />
It doesn't work either.
javax.xml.transform.TransformerException: Prefix must resolve to a namespace: NC

3) If I try to define it as a namespace using the definition from the foxmarks.xml file:
<%@ taglib prefix="NC" uri="http://home.netscape.com/WEB-rdf#" %>
org.apache.jasper.JasperException: The absolute uri: http://home.netscape.com/WEB-rdf# cannot be resolved in either web.xml or the jar files deployed with this application ...
I thought a namespace was just a definition, not something physically existing.

Thank you for your patience.
Can someone help me please
I don't know where the problem is.
Is it the namespace, is it rdf?
 
Ranch Hand
Posts: 598
3
jQuery Google App Engine Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't see you have created tld file.You need to create tld file(for ex. a.tld)in your web-inf folder.

Create tld first and then ask for farther explanation.Then it would be
easier to help you.
 
Sheriff
Posts: 67752
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
Why would he need to write a tld?
 
Bobby Sharma
Ranch Hand
Posts: 598
3
jQuery Google App Engine Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, When I had problem like that I did so and it was solved.
May it could be hallucination,though. :P

Make the change like on your xml file according to your uri specification.


Note:Don't put code exactly I did.please specify you uri on the tag.

[ March 26, 2008: Message edited by: omi sharma ]
[ March 26, 2008: Message edited by: omi sharma ]
 
Bear Bibeault
Sheriff
Posts: 67752
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
No. Nothing ever need be added to the web.xml in order to use the JSTL.
 
Bobby Sharma
Ranch Hand
Posts: 598
3
jQuery Google App Engine Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mr. Bear , I am really confused with this problem but I will still try to help,even if I am beginner.

Author :You can have some possible solutions but I am not sure because
I am beginner too.I am waiting for experts to reply.

1)put this on your fox.jsp<%@ page isELIgnored="false" %>
2)To load the properties file in jsp, use <fmt:..> to load the bundle and store the message value to variable.
<fmt:setBundle var="mybundle" basename="myfile"/>
<fmt:message var="names" key="fileName" bundle="${mybundle}"/>

Then use <c:forTokens> to split and loop the list. e.g.
<c:forTokens var="file" items="${names}" delims=",">
<c:out value="${file}"/>
</c:forTokens>
3)use tomcat 6 and put this on your jsp
<%@taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
[ March 27, 2008: Message edited by: omi sharma ]
 
mik mak
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your help guys

I was more or less giving up:
* I saw how XUL reads and treats rdf files xulplanet.com but it doesn't seems to render HTML.
* I was going to delete the prefixes with something like XSLT before parsing the data

Then I saw your replies.
As for the TLD. I don't know what a TLD is nor what it can do for me. But if you say I don't need it I won't bother.

I'll try to use c:forToken, I'll let you know soon

As for the other two ideas,
What do they mean?
1) isELIgnored I understand but I don't think EL is ignored. What makes you says it is?
2) How can a properties file be of use? Should I try to load my foxmarks.xml as a properties file?

Once again thanks for your help
 
Bobby Sharma
Ranch Hand
Posts: 598
3
jQuery Google App Engine Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you have to set elIgnored false sometimes ,even it is by default false.
I had some problem ,relating to it so I told you to do so.
Sir, I am new to JSTL.But I have not really got what exactly you want to do?
you want to forward the xml file ? or you want to use it as template file?
or what else? :P
please clarify this ASAP.
[ March 28, 2008: Message edited by: omi sharma ]
 
mik mak
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to transform the foxmarks.xml file above in a HTML page displaying my bookmarks.
Put simply I want to loop through the foxmarks file and display every <NC:Bookmark> entry as a URL.
For example the last entry in the foxmarks file would yield:
<a href="http://en.wikipedia.org/wiki/Main_Page">Wikipedia</a>
 
Bobby Sharma
Ranch Hand
Posts: 598
3
jQuery Google App Engine Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think your problem is more logical than syntactical.
Please wait for our experts to reply.
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic