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

Code:
<item>
<title>Ali G Interviews The Beckhams</title>
<link>http://www.break.com/articles/aligbeckhams.html</link>
<pubDate>Tue, 24 Jan 2006 21:25:27 CST</pubDate>
<description>Ali G Interviews The Beckhams</description>
<enclosure url="http://media1.break.com/dnet/media/content/aligbeckhams.jpg" type="image/jpeg" length="10000"/>
</item>
and am using the following to parse through it

Code:
<c:import var="xmlfile" url="http://www.break.com/rss/rss20.asp" />
<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>
</x:forEach>

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