JSTL XML XPath Select : XML « JSTL « Java






JSTL XML XPath Select

<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %><%@ taglib uri="http://java.sun.com/jstl/xml" prefix="x" %>
<html>
  <head>
    <title>Reading RSS</title>
  </head>

  <body>
    <c:import var="news"
    url="http://www.wired.com/news_drop/netcenter/netcenter.rdf" />

    <x:parse var="doc" xml="${news}" />

    <table border="1" width="100%">
      <tr bgcolor="blue">
        <td align="center">
          <font color="white" size="+2">
            <b>
              <x:out select="$doc/rss/channel/title" />
            </b>
          </font>

          <br />

          <font color="white" size="-2">
            <x:out select="$doc/rss/channel/pubDate" />
          </font>
        </td>
      </tr>

      <tr>
        <td valign="top">
          <x:out select="$doc/rss/channel/description" />
        </td>
      </tr>

      <x:forEach var="story" select="$doc/rss/channel/item">
        <tr bgcolor="blue">
          <td align="center">
            <a href="&lt;x:out select=">"&gt; 
            <font color="white">
              <x:out select="title" />
            </font>
            </a>
          </td>
        </tr>

        <tr>
          <td valign="top">
            <x:out select="description" />
          </td>
        </tr>
      </x:forEach>
    </table>
  </body>
</html>



           
       








JSTL-XML-XPath-Select.zip( 6,553 k)

Related examples in the same category

1.JSTL XML Foreach
2.JSTL XML Map Value
3.JSTL XML Output
4.JSTL XML Parse
5.JSTL XML XPath
6.JSTL XML XPath Choose
7.JSTL XML XPath: Wired New
8.JSTL: parse XML document