Thread: JSTL, XML query
View Single Post
  #1 (permalink)  
Old January 25th, 2006, 01:37 PM
ph3n0m ph3n0m is offline
Registered User
Join Date: Jan 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default JSTL, XML query

I have the following xml document

<title>Ali G Interviews The Beckhams</title>
<pubDate>Tue, 24 Jan 2006 21:25:27 CST</pubDate>
<description>Ali G Interviews The Beckhams</description>
<enclosure url="" type="image/jpeg" length="10000"/>
and am using the following to parse through it

<c:import var="xmlfile" url="" />
<x:parse var="doc" xml="${xmlfile}"/>
<table border="0" cellspacing="0" cellspacing="0">
<x:forEach select="$doc//item">
<tr><td><strong><a href='<x:out select="link"/>'><x:out select="title"/></a></strong><br>
<em><x:out select="pubDate"/></em><br>
<x:out select="description"/>
<c:out value="${enclosure}"/></td></tr>

My only problem is - how do I get the value for the xml tag "enclosure" since it is not in the same format as the others.

I have no control over this xml document as it is an external file - so no suggestions to change it over please :)
Reply With Quote