Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8750227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:49:47+00:00 2026-06-13T12:49:47+00:00

I have parsed a batch of XML Schema files using a DOMparser. I than

  • 0

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).

Here’s the snippet of code where I am writing the file:

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);

And the error I am getting is the following:

java.io.FileNotFoundException: absolutePathHere (Access is denied)

Which points to this line in the above snippet :

tFormer.transform(source, result);

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.

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.

Here’s hoping StackOverflow can come to my rescue once again.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:49:48+00:00Added an answer on June 13, 2026 at 12:49 pm

    I found the solution:

    File preprFile = new File(directory1/directory2/directory3/file.xsd);
    File directory = new File(directory1/directory2/directory3/);
    
    try {
    // Create file if it doesn't already exist;
        directory.mkdirs();
        preprFile.createNewFile();                              
    } catch (Exception e) {
        e.printStackTrace();
    }
    

    Thanks for the help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have parsed XML file into objects, in which each object has a 1:1
Our application is required to take client data presented in XML format (several files)
Hi i have parsed a online xml containing images, I got stuck on parsing
I have a thousands of data parsed from huge XML to be inserted into
I have an atomfeed with which is succesfully getting parsed. All the articles are
I have a CSV file supplied from a client which has to be parsed
Hey there. I have a c# application that parses txt files and imports the
I have an xml as <?xml version=1.0 encoding=UTF-8?> <Batch checksum=4f4e96dc724aa38965a75121b654a49830fc6a46f927f1b1803cdd22a40f1e27> <UpdateCache incremental=false cleanCache=true> <PayLoad>
I'm wondering if it's possible to convert batch files to executables using C++? I
I have a web application where users enter arbitrary sql queries for later batch

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.