Hi Tom,
can you shortly tell me how the DocumentCache works??
does it caches the XML document structure (speaking strictly about elements)
or the XML document structure PLUS the values of the elements??
because, in my understanding if the second approach is used, then there
could
be one chance out of million that i will have EXACTLY the same structure
with EXACTLY
the same values for two XML documents..
i mean, in real case situation, when can it happen that i can receive
two requests that contains EXACTLY the same XML??
can you clarify me a little??
thanx in advance and regards
marco
> -----Original Message-----
> From: ext Tom Amiro [mailto:[EMAIL PROTECTED]]
> Sent: 11. June 2001 18:16
> To: [EMAIL PROTECTED]
> Subject: Re: XSLTC DOMImpl class
>
>
> Marco,
>
> The following snippet of code from a servlet may help. It
> produces output.
>
> Tom
>
> public final class Transform extends HttpServlet {
> private static DocumentCache cache = new DocumentCache(32);
> public void doPost(HttpServletRequest request,
> HttpServletResponse response)
> throws IOException, ServletException {
> response.setContentType("text/html");
> PrintWriter out = response.getWriter();
> String className = request.getParameter("class");
> String documentURI = request.getParameter("source");
> String stylepath = getServletContext().getRealPath(className);
> String xmlpath = "file:" +
> getServletContext().getRealPath(documentURI);
> translet.setDOMCache(cache);
> DOMImpl dom = cache.retrieveDocument(xmlpath, 0, translet);
> DefaultSAXOutputHandler saxHandler =
> new DefaultSAXOutputHandler(out);
> translet.transform(dom, new TextOutput(saxHandler));
> }
> }
>
> [EMAIL PROTECTED] wrote:
>
> > hi mr jorgensen,
> > i am having initial problems iwth the DocumentCache
> that comes with
> > xalan.
> > i wrote the following code but nothing goes to output
> >
> > DocumentCache dcache = new DocumentCache(100);
> > DOMImpl dom = dcache.retrieveDocument("test.xml",1,_translet);
> > System.out.println(_writer.toString());
> >
> > can u give me any hints?
> >
> > thanx in advance and regards
> > marco
> >
> > > -----Original Message-----
> > > From: ext Morten Jorgensen [mailto:[EMAIL PROTECTED]]
> > > Sent: 06. June 2001 15:42
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: XSLTC DOMImpl class
> > >
> > >
> > > Marco,
> > >
> > > It is of course possible to add a clearDOM() method to the DOMImpl
> > > class, but I doubt that it would help you much. The DOM takes long
> > > to build because the input document has to be parsed and because
> > > the DOMImpl$DOMBuilder inner class to populate the DOMImpl. The
> > > time spent instanciating the DOMImpl class is minute in
> comparison.
> > > I would rather focus on DOM caching (if feasible) and try to come
> > > up with a decent implementation of the DOMCache interface. Sun's
> > > alpha5 release and the latest Xalan release both contain a sample
> > > implementation (dom/DocumentCache) of the DOMCache interface, but
> > > it is not very flexible or efficient.
> > >
> > > Morten
> > >
> > >
> > > [EMAIL PROTECTED] wrote:
> > > >
> > > > hi all,
> > > > is it possible to add a method 'clearDOM()' (if
> > > someone hasn't
> > > > already done it) so that the DOMImpl class
> > > > can be reused all the time??
> > > >
> > > > thanx in advanc and regards
> > > > marco
> > >
>