| Author |
Query on StreamResult object for storing transformed xml doc
|
Colm Dickson
Ranch Hand
Joined: Apr 04, 2009
Posts: 84
|
|
Hi all,
I was puzzled recently as to why the code I had was throwing an IO FileNotFound error when I had
but worked when I simply used
There is a constructor for Streamresult that takes a File object which I though was correct in the first example. can someone explain what is happeneing here. I would have expected the file to be created with the transformed data in my C drive using example one ...Also , would it be right to say that the second example which works is using the constructor for StrreamResult that takes a string (Construct a StreamResult from a URL.)...becasue such a constructor exists?
Thanks
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16479
|
|
|
That second example is surely the constructor which expects a URL in String form. What you posted there isn't a URL, so I'm surprised that it worked. I'm also surprised that the first example didn't. My conclusion from all of that is that you have got your tests backwards; the first example should work (assuming that file exists) and the second should not.
|
 |
Colm Dickson
Ranch Hand
Joined: Apr 04, 2009
Posts: 84
|
|
Thanks for replying.
Yes it's strange and I checked again and the new File argument does indeed fail and the String URL one works and creates a file with that name in my project directory yet specifying new File("C:\\filename") causes an IO error and this location is fully writable.
Trying this method below however does work
Colm
|
 |
g tsuji
Ranch Hand
Joined: Jan 18, 2011
Posts: 357
|
|
If you're still using jdk 1.3.1 or about, you should consider update jdk. There was a bug on 1.3.1 for constructor StreamResult(File).
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5052510
It should have been fixed in 1.5 or higher.
|
 |
 |
|
|
subject: Query on StreamResult object for storing transformed xml doc
|
|
|