If a XML file name is passed as a String to the xml attribute of x:parse an error is thrown: javax.servlet.ServletException: Document root element is missing. at org.apache.jasper.runtime.PageContextImpl.handlePageException (PageContextImpl.java:463) at org.apache.jsp.review_0005fproj_0005fxml_0005f01$jsp._jspService (review_0005fproj_0005fxml_0005f01$jsp.java:180) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service (JspServlet.java:201) at org.apache.jasper.servlet.JspServlet.serviceJspFile (JspServlet.java:381) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:260) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex t(StandardPipeline.java:633) at org.apache.catalina.core.StandardPipeline.invoke (StandardPipeline.java:470) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex t(StandardPipeline.java:633) at org.apache.catalina.core.StandardPipeline.invoke (StandardPipeline.java:470) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke (StandardContext.java:2349) at org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java:180) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex t(StandardPipeline.java:633) at org.apache.catalina.valves.ErrorDispatcherValve.invoke (ErrorDispatcherValve.java:170) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex t(StandardPipeline.java:631) at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:171) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex t(StandardPipeline.java:631) at org.apache.catalina.core.StandardPipeline.invoke (StandardPipeline.java:470) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java:174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex t(StandardPipeline.java:633) at org.apache.catalina.valves.AccessLogValve.invoke (AccessLogValve.java:469) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex t(StandardPipeline.java:631) at org.apache.catalina.core.StandardPipeline.invoke (StandardPipeline.java:470) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.coyote.tomcat4.CoyoteAdapter.service (CoyoteAdapter.java:223) at org.apache.coyote.http11.Http11Processor.process (Http11Processor.java:381) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnectio n(Http11Protocol.java:325) at org.apache.tomcat.util.net.TcpWorkerThread.runIt (PoolTcpEndpoint.java:495) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run (ThreadPool.java:516) at java.lang.Thread.run(Thread.java:536) ================================================================================ This works however if a c:import is used to import the xml file. The XML File in question is in the same directory as the jsp.
Prasad - this doesn't sound right. At least, it's not as general as the bug's subject suggests. I'd need to see the specific String you're trying to use to debug; if you could print it out with <c:out>, that would help. x:parse does work with String in the general case. It just sounds like you're feeding x:parse an imcomplete document. Are you accidentally feeding it a URL for the 'xml' attribute? That's no longer allowed...
I suspect the same misunderstanding behind bug 8432 is at the root of this report too; I've closed it out, but feel free to reopen if there's really a problem.
<x:parse xml="activity.xml" var="xmlDoc" /> My line of code looks like this. From the spec I could not gather that specifying the xml attribute as a URL to the file is Invalid. Though I do see a reference about the use of c:import in case of working with URLs
Well, the spec doesn't list all the things you CAN'T do. :-) The spec for x:parse's 'xml' attribute says: "Source XML document to be parsed. (If exported by <x:set>, it must correspond to a well-formed XML document, not a partial document.)" It's not a "URL to a source XML document". There used to be an 'xmlUrl' attribute, but this was removed in favor of an explicit mechanism for setting the 'systemId' of a string representing a document to be parsed.