Re: servlet response = xml document
"Natalia Shilenkova" <[email protected]> Fri, 16 Feb 2007 12:08:46 -0500
| Newsgroups | gmane.text.xml.xindice.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Iñaki, On 2/15/07, Iñaki Salinas Bueno <[email protected]> wrote: > Hello, > > I'm working with XForms and Xindice through a servlet. I want the servlet > response my XForms application with a XML document (content-type: > application/xml). The code for getting a document from a collection may look like this: Resource res = col.getResource(docName); if (res != null) { response.setContentType("application/xml"); String doc = (String) res.getContent(); response.getOutputStream().print(doc); } else { // document not found } where col is the collection you are trying to access and docName is a document key. Also, it might help to take a look at org/apache/xindice/tools/XMLTools.java class from Xindice source code. This class allows you to execute different commands on Xindice database, such as adding, retrieving, deleting documents and so on. Every supported command is implemented as a separate java class, and all of those classes can be found under org/apache/xindice/tools/commands. Regards, Natalia