JSTL, XML and namespaces

D

Digby

Hi,

I've found that the Jakarta RI for the JSTL XML taglib doesn't seem to
process xml docs with namespaces very well.

I have a simple snippet of jstl:

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml" %>
<c:import var="feed" url="${src}"/> <%-- src cntains url below --%>
<x:parse var="xml" xml="${feed}"/>
<td valign="top">
<x:forEach select="$xml//item" var="item">
<a href="<x:eek:ut select="$item/link"/>" target="_blank"><x:eek:ut
select="$item/title"/></a><br/>
<x:eek:ut select="$item/description"/><br/>
</x:forEach>

and two xml sources - both rss news feeds, but one is RSS 0.91 and the other
1.0:

http://news.bbc.co.uk/rss/newsonline_uk_edition/uk/rss091.xml
http://theregister.co.uk/feeds/latest.rdf

The second one (RSS 1.0) contains references to namespaces, but the first
(0.91) doesn't, and the first is the one to be correctly displayed on the
screen.

I've tried doing similar things with other XML docs, but keep getting the
same problem - I can't parse xml with namespaces.

Am I missing something obvious? Or perhaps I've got an old version of the
taglib (I think I'm currently using 1.0, and going to try 1.1 when I get a
chance).

TIA

Digby
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top