Read XML Taglib and JSTL in JSP


samle.xml

 <?xml version="1.0" encoding="ISO-8859-1"?>
 <weather ver="2.0">
   <loc id="INXX0096">
     <dnam>New Delhi, India </dnam>
     <tm>3:30 PM </tm>
   </loc>
   <cc>
     <tmp>75 </tmp>
     <bar>
       <r>29.94 </r>
       <d>steady </d>
     </bar>
   </cc>
 </weather>

--------------------------------
xml_read.jsp

<%@ page contentType="text/html; charset=iso-8859-1" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<c:import url="http://localhost:8080/XML/samle.xml" var="xml"/>
<x:parse xml="${xml}" varDom="dom"/>
<html>
<head>
<title>Read XML through taglib JSTL</title>
</head>

<body>
      <x:forEach select="$dom/weather/cc/tmp" var="tmp">
        <x:out select="$tmp" />
    </x:forEach>

    <br>

    <x:forEach select="$dom/weather/cc/bar/d" var="d">
        <x:out select="$d" />
    </x:forEach>
</body>
</html>

5 comments:

Anonymous said...

Excellent, what a website it is! This webpage presents valuable
information to us, keep it up.

My blog post bmi calculator for females

Anonymous said...

What's up to all, the contents present at this site are in fact amazing for people knowledge, well, keep up the good work fellows.

Look into my blog ... cellulite treatment

Anonymous said...

Good article! We will be linking to this particularly great post on our site.
Keep up the great writing.

My homepage www.moodyjews.net

Anonymous said...

For the reason that the admin of this web page is working, no doubt very soon it will be renowned, due to its quality
contents.

Also visit my website how to make money from forex

Anonymous said...

What's up, this weekend is pleasant for me, for the reason that this point in time i am reading this great informative article here at my home.

Feel free to visit my website; forex system review

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|