2 Replies Latest reply on Feb 13, 2006 4:50 AM by Ashwin

    displaying XML in poerlet jsp

    Ashwin Newbie

      Hi,
      I want to display a formatted-XML string in portlet-jsp page. its goiving an exception:

      13:35:12,546 INFO [STDOUT] [Fatal Error] jstl::1:1: Content is not allowed in prolog.
      13:35:12,546 ERROR [CommandFilter] Exception in command invocation
      javax.servlet.ServletException: javax.servlet.jsp.JspException: Content is not allowed in prolog.


      the code i wrote is :

      <%@ page language="java" import="javax.portlet.*,java.util.*;" contentType="text/html; charset=ISO-8859-1"
       pageEncoding="ISO-8859-1"%>
      
      <%@taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
      
       <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
       <%@ taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x" %>
      
      <portlet:defineObjects />
      <c:set var="someXML">
       <record>
       <name>Ashwin</name>
       <phone>040-23456789</phone>
       <fax>040-23456789</fax>
       <website>www.ashwin.com</website>
       <address1>Hyderabad</address1>
       <address2>Banjara Hills</address2>
       <address3>India</address3>
       </record>
      
       </c:set>
      
       <x:parse doc="${someXML}" var="test"/>
      
       <x:forEach select="$test/record">
       <x:out select="name" /><br>
       <x:out select="phone" /><br>
       <x:out select="website" /><br>
       <x:out select="address1" /><br>
       <x:out select="fax" /><br>
       <br>
       </x:forEach>


      The same code works in stand-alone jsp.

      Thanks ,
      Ashwin.