Project

Profile

Help

Saxon and virtual file systems

Added by Michael Staal-Olsen over 5 years ago

Yesterday I came across a Google project named JimFS (https://github.com/google/jimfs) which provides one with the ability of making a virtual file system using the abstract file system APIs in java.nio.file which were introduced in Java 7. The package allows one to store equivalents of files in-memory, which may in certain cases provide some performance improvements over having to read/write data from a disk.

If I associate an XSLT file in a Path object of this kind, will Saxon then support correct referencing within the JimFS file system? For instance, if I import/include an XSLT file using href, will Saxon then look for the file inside of the virtual file system?

I ask because I am considering making a setup, where XSLTs can be stored in a database and then be accessed from a Java app which at runtime then stores the file in a virtual file system. This way, I would be able to deploy a java package, and then during run time modify the XSLTs on which the application depends. Furthermore, if applied correctly, I suspect that the performance of a virtual file system would outperform the native file system.


Replies (3)

Please register to reply

RE: Saxon and virtual file systems - Added by Michael Kay over 5 years ago

If the virtual file system supports all the same interfaces as the real file system, then of course it will work with Saxon. If its behaviour differs from the real file system, then -- well, it depends on how it differs.

But I very much doubt it will make much difference to bottom-line performance. I think XSLT is usually CPU-limited rather than I/O-limited. That's particularly true as regards the stylesheets: reading a stylesheet from disk is a very small part of the cost of stylesheet compilation.

RE: Saxon and virtual file systems - Added by Michael Staal-Olsen over 5 years ago

Thanks! But will it require passing an UriResolver to the TransformerFactory configuration?

RE: Saxon and virtual file systems - Added by Michael Kay over 5 years ago

All depends on the detail. If they do something like creating a custom URI scheme and registering a protocol handler for that scheme with the Java VM, then URIs using that scheme should work with Saxon out of the box. Otherwise, you might well need a custom URIResolver.

    (1-3/3)

    Please register to reply