Hi,

is there anyone using BaseX in an Apache Ant scenario?

I have the following target for XQuery Updating some files (no database 
access), but I am too dumb to make an apply task that reads every file in a 
fileset.
Usually you place the <srcfile/> where you need it to be in your external 
command, but unfortunately the BaseX command-line syntax won't allow this to be 
easily placed: the filename is supposed to follow directly suffixed to "-i" 
where I cannot use an element, of course.

  <target name="xquery_update_default">
    <echo level="info" message="XQuery Update (Default): 
${param.xquery-update-uri}"></echo>
    <apply executable="java" > 
      <arg value="-cp"/> 
      <arg value="BaseX95.jar"/> 
      <arg value="org.basex.BaseX"/>
      <arg line="-u"/>
      <arg line="-w"/>
      <arg line="-c'set exporter omit-xml-declaration=no,indent=no'"/>
      <arg line="-b'path=${param.folder}'"/>
      <arg line="-i${dummy.xml}"/>
      <srcfile/> 
      <fileset dir="../${dir.xquery}" includes="${param.xquery-update-uri}"/>
    </apply>
  </target>

As a workaround, I set a dummy.xml for input and bind the current folder as a 
parameter and in my Query I can use file:list() which then is updating all 
files in the directory, but this makes the Query dependent on the parameter, 
and updates are obviously not written back unless all files have been processed 
in memory. I would prefer to have a standalone query operating only on the 
current document-uri (so I can better reuse it elsewhere).

Can someone give me a hint if it is possible in plain Ant to apply a CCL-BaseX 
to any file in a given fileset?
Other than that, BaseX performs well as a file processor (if you ignore the 
time related to file handling).

Thanks, Daniel

Reply via email to