Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

namespaces, rdf and forEach

 
mik mak
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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">
<xut 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?
 
Bobby Sharma
Ranch Hand
Posts: 598
3
Google App Engine jQuery Windows
  • Mark post as helpful
  • send pies
  • 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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would he need to write a tld?
 
Bobby Sharma
Ranch Hand
Posts: 598
3
Google App Engine jQuery Windows
  • Mark post as helpful
  • send pies
  • 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.


Noteon'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
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
Google App Engine jQuery Windows
  • Mark post as helpful
  • send pies
  • 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=",">
<cut 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
  • 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
Google App Engine jQuery Windows
  • Mark post as helpful
  • send pies
  • 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
  • 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
Google App Engine jQuery Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think your problem is more logical than syntactical.
Please wait for our experts to reply.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic