Though API is not officially provided, you can use an internal
API: xbird.client.command.ImportDocument#loadDocument.
Or, you can use a XQuery function:
ext:import-document(docPath as xs:string, colPath as xs:string) as
document().
> My second question is related to the database inconsistency I
> experienced. I attempted to do the following:
> 1) Write a class called MyInvoker, which is almost identical to
> CommandInvoker, except that the run() function is public, so that I
> can call it from my program.
> 2) Whenever my application (a server) receives an XML piece from a
> client, write to a temporary file.
> 3) Call MyInvoker to store the XML file.
> 4) When my application receives a delete command, I simply remove the
> file on the disk.
>
> It works okay to add a file. However, I found that this approach
> leaves the database in an inconsistent state. If I add an XML then
> delete it immediately, the file cannot be deleted. After a while, if I
> try deletion again, it works. Similarly, if I run a get_count xquery
> immediately after the xml is added, the count does not increment.so,
> how to avoid the data inconsistency issue? Is there a better strategy?
You have to explicitly call IDocumentTable#close() because
the embedded database system holds loaded XML documents in the cache
as long as they are used in applications.
The system cannot recognize whether an XML document is used or not
without explicit acknowledgment from clients.
> java.io.IOException: Unable to delete file:
C:\DOCUME~1\xqian\LOCALS~1\Temp\xbird\xstreamTest\0.xml.dtms
> at xbird.util.io.FileUtils.cleanDirectory(FileUtils.java:171)
I am aware of this problem.
XBirdCollectionStrategyTest does not properly work on windows.
Makoto YUI