0

I'm chaining a few xslt Transformations in a jar using saxon 9 ee as a library. In my char I wan't to create the ouput directory which I do like this:

int timestamp = (int) System.currentTimeMillis();
File inputfolder = new File("input_ll_" + Math.abs(timestamp));
inputfolder.mkdir();

Then I tell Saxon to use that folder as output:

//output last transformation to file
transtemp.setDestination(getSerializer(inputfolder.toString()));
//start transformation
trans1.transform();

transtemp and trans one are both XsltTransformer Objects.

When I run my main method i get this:

Exception in thread "main" net.sf.saxon.s9api.SaxonApiException: java.io.FileNotFoundException: C:\Users\blabla\workspace\Tests\input_ll_1718557701 (Access Denied)

Any ideas ?

Update:

If i try to create a file there myself:

File check = new File(inputfolder.toString() + "/check.txt");
check.createNewFile();

it works, so it seems it's a problem with saxon ?

Update 2:

Yeah, classic me being stupid. I have to pass a path to a file not just to a directory.

4

2 回答 2

0

我想你已经回答了你自己的问题。传递给 getSerializer() 的文件不能是目录。

于 2013-07-01T12:01:53.937 回答
0

你应该使用:

inputfolder.setWritable(true) 
于 2013-07-01T09:44:32.043 回答