Problem displaying original XML Tree structure in JSP page
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Thursday, July 22, 2010 03:33 AM

JSP Page Hi I have a small issue with displaying xml document when tried retriving in jsp page. This is the complete code: <%@ page import="java.io.*" %> <%@ page import=" org.xmldb.api.base.*" %> <%@ page import=" org.xmldb.api.modules.*" %> <%@ page import=" org.xmldb.api.*" %> <%@ page import=" javax.xml.transform.OutputKeys" %> <%@ page import=" javax.servlet.jsp.*" %> <%@ page import=" javax.servlet.jsp.tagext.*" %> <%@page contentType="text/html"%> <%@page pageEncoding="UTF-8"%>    More>>
JSP Page

Hi

I have a small issue with displaying xml document when tried retriving in jsp page.

This is the complete code:
<%@ page import="java.io.*" %>
<%@ page import=" org.xmldb.api.base.*" %>
<%@ page import=" org.xmldb.api.modules.*" %>
<%@ page import=" org.xmldb.api.*" %>
<%@ page import=" javax.xml.transform.OutputKeys" %>
<%@ page import=" javax.servlet.jsp.*" %>
<%@ page import=" javax.servlet.jsp.tagext.*" %>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>








<%
Collection col = null;
XMLResource res = null;
try {
Class cl = Class.forName("org.exist.xmldb.DatabaseImpl");
Database database = (Database) cl.newInstance();
DatabaseManager.registerDatabase(database);
col = DatabaseManager.getCollection("xmldb:exist://localhost:8080/exist/xmlrpc/db/NeuroML/Level1");
col.setProperty(OutputKeys.INDENT, "no");
res = (XMLResource)col.getResource("rest.xml");
out.println(res.getContent());
}
catch (Exception e)
{ out.println("hererere");
out.println(e);
e.printStackTrace();
} finally { }
%>



It gives me content on the file, in my case contents of "rest.xml", but what i need is to display the original xml tree structure in the browser, not just the contents present between tags.
What i am missing in the code to make it happen??

Thanks
Sidharth

   <<Less
About | Sitemap | Contact