Note that there are some explanatory texts on larger screens.

plurals
  1. POFileNotFoundException when writing new xsd file
    primarykey
    data
    text
    <p>I have parsed a batch of XML Schema files using a DOMparser. I than added several annotations, which are essential for the application I am creating. I then want to write these new "preprocessed" files to a new location, and I get a FileNotFound exception (access denied).</p> <p>Here's the snippet of code where I am writing the file:</p> <pre><code>Transformer tFormer = TransformerFactory.newInstance().newTransformer(); // Set output file to xml tFormer.setOutputProperty(OutputKeys.METHOD, "xml"); // Write the document back to the file Source source = new DOMSource(document); File preprFile = new File(newPath(xmlFile)); // The newPath function is a series of String operations that result in a new relative path try { // Create file if it doesn't already exist; preprFile.mkdirs(); preprFile.createNewFile(); } catch (Exception e) { e.printStackTrace(); } Result result = new StreamResult(preprFile); tFormer.transform(source, result); </code></pre> <p>And the error I am getting is the following:</p> <pre><code>java.io.FileNotFoundException: absolutePathHere (Access is denied) </code></pre> <p>Which points to this line in the above snippet :</p> <pre><code>tFormer.transform(source, result); </code></pre> <p>I'm using a Windows machine (read somewhere that that can be the source of this error), and I've already tried turning UAC off, but no success. </p> <p>I was thinking maybe the createNewFile() method doesn't release the file after it's been made, but was unable to find more information about that.</p> <p>Here's hoping StackOverflow can come to my rescue once again.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload