From: Michael B. <mbe...@mb...> - 2005-07-27 16:24:25
|
> how ( with java application )can I extract a document from a collection and store in a directory an xml file? > > I store a new resource on db like this: > [...] > > But I'd like to have also the possibility to store a "real" xml file. In effect, just reverse what you did above. Retrieve your desired document from a collection as an XMLResource object. Then use the getContent() method of that resource to get the serialized document into a string, and store that string into the filesystem as your "real" file in the normal way. Or look at /samples/org/exist/examples/xmldb/Retrieve.java in your exist tree, and substitute a filesystem write for the System.out.println(res.getContent()); call near the end of that example. Michael Beddow |