Exception When trying to Format XML using JSTL
Hi all
I m trying to display content of XML in a .jsp page using JSTL ,
When i try to dispaly the content it is thowing an exception :
org/saxpath/SAXPathException
Can any one please help ....
i m usingjstl1.0.6.jar andstandard-1.0.6.jar
Code Snppet Used:
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml" %>
<c:set var="someXML">
<name>Sri</name>
</c:set>
<x:parse var="parsedDocument" xml="${someXML}" />
<x:out select="$parsedDocument/name" />
Thanks in Advance
[697 byte] By [
Vasa] at [2007-10-2 15:42:10]

Just guessing, but maybe in your <x:out> element, $parsedDocument refers to the root element of the XML document (which is a "name" element) and therefore $parsedDocument/name tries to find a "name" element which is a child of that. But I don't know why that should be an exception, I would expect it to just return nothing like JSTL usually does when you do something meaningless. Does the exception come with any accompanying text?
Thank for reply
I had even tried with this code:
<c:set var="someXML">
<person>
<name>Joe</name>
<age>30</age>
</person>
</c:set>
<x:parse varDom="parsedDocument" xml="${someXML}" />
<x:set var="name" select="$parsedDocument/person/name" />
<c:out value="${name}" />
even then i m getting the same exception:
Message: org/saxpath/SAXPathException
Vasa at 2007-7-13 15:29:46 >
