commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philippe Poulard <Philippe.Poul...@sophia.inria.fr>
Subject [VFS] have the RefleX ! apply XPath expressions on your file system
Date Wed, 07 Dec 2005 16:07:12 GMT
hi,

I have been released RefleX, an application that uses intensively VFS :
RefleX is available for download here :
http://reflex.gforge.inria.fr/

RefleX is a Java tool that allow to design programs entirely in XML.
XML programs -called also Active Tags programs- are using intensively 
XPath to cross objects other than XML objects.

for example : a file object

a file object exposes its properties as XML content and attributes, so 
it is easy to select a set of files, for example :

-consider that one creates a property named myDir which value is given 
by the XPath function :
io:file( 'file:///path/to/repository ')

-then you can apply other XPath expressions on it :
$myDir/@io:exists
$myDir/@io:is-file
$myDir/@io:is-directory
$myDir/@io:length
$myDir/@io:encoding
$myDir/@io:path
name( $myDir )
$myDir//*
   to select the files and directories in the entire subtree
$myDir//*[@io:is-file]
   to select the files in the entire subtree
$myDir//*[@io:is-file][@io:extension='xml']
   to select the XML files in the entire subtree
$myDir/..
   to select the parent directory, if any
$myDir/../@io:length

etc...

to use single files and a set of files, the following active sheet (that 
is to say an Active Tags program) shows how to transform all XML files 
from a repository to HTML :

<xcl:active-sheet
     xmlns:io="http://www.inria.fr/xml/active-tags/io"
     xmlns:xcl="http://www.inria.fr/xml/active-tags/xcl"
 >
     <xcl:logic>
         <!-- the same stylesheet for all XML files -->
         <xcl:parse-stylesheet name="xslt" 
source="file:///path/to/myStylesheet.xsl"/>
         <xcl:set name="myXMLFiles"
  value="{io:file( '/path/to/my/xml/docs' 
)//*[@io:is-file][@io:extension='xml']}"/>
         <xcl:for-each name="file" select="{$myXMLFiles}">
             <xcl:parse name="xml" source="{$file}"/>
             <xcl:transform name="html" output="{substring-before( 
$file/@io:path, '.xml' )}.html"
  source="{$xml}" stylesheet="{$xslt}"/>
         </xcl:for-each>
     </xcl:logic>
</xcl:active-sheet>

as the files are handled by VFS, all the file systems supported are also 
available in RefleX ; for its own functioning, RefleX also provides some 
add-ons :

the xmldb scheme to access to files that are stored within XML native 
databases :
xmldb:provider://user:pwd@host:port/path/to/file.xml
the ldap scheme
the web scheme, which allows to access to files within a servlet :
web:///WEB-INF/web.xml

Have fun !

-- 
Cordialement,

            ///
           (. .)
  -----ooO--(_)--Ooo-----
|   Philippe Poulard    |
  -----------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message