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"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<%
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 { }
%>
</body>
</html>
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