JSTL, XML and namespaces

Discussion in 'Java' started by Digby, Oct 29, 2003.

  1. Digby

    Digby Guest

    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


    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.532 / Virus Database: 326 - Release Date: 27/10/2003
     
    Digby, Oct 29, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fotz
    Replies:
    0
    Views:
    598
  2. Robert Mark Bram

    Custom JSTL that accepts JSTL expression

    Robert Mark Bram, Dec 15, 2004, in forum: Java
    Replies:
    0
    Views:
    1,007
    Robert Mark Bram
    Dec 15, 2004
  3. Mark Smits

    Newbie: XML 2 XML and namespaces

    Mark Smits, Sep 17, 2003, in forum: XML
    Replies:
    2
    Views:
    667
    Mark Smits
    Sep 21, 2003
  4. Greg Wogan-Browne
    Replies:
    1
    Views:
    877
    Uche Ogbuji
    Jan 28, 2005
  5. DaFoot
    Replies:
    1
    Views:
    1,761
    DaFoot
    Oct 23, 2008
Loading...

Share This Page