From: Adam R. <ad...@ex...> - 2010-07-22 10:13:05
|
Erm so you have a JSP page that puts out some html and in the middle of that a XML document is injected from eXist-db. Am I correct in thinking that you just want the XML document? On 22 July 2010 07:49, Sidharth Agarwal <sag...@as...> wrote: > 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 > > > > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > _______________________________________________ > Exist-open mailing list > Exi...@li... > https://lists.sourceforge.net/lists/listinfo/exist-open > > -- Adam Retter eXist Developer { United Kingdom } ad...@ex... irc://irc.freenode.net/existdb |