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

  • Home
  • SEARCH
  • 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 7494097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T17:18:54+00:00 2026-05-29T17:18:54+00:00

I am trying to write a chunk of XML data to a file like

  • 0

I am trying to write a chunk of XML data to a file like this:

using (XmlWriter writer = XmlWriter.Create("D://project//data//" + i + ".xml"))

but it gives the following error:

Server Error in ‘/’ Application.

Could not find a part of the path ‘D:\project\data\1.xml‘.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.DirectoryNotFoundException: Could not
find a part of the path ‘D:\project\data\1.xml‘.

However, when I am reading an XML using an XmlReader:

XmlReader reader = XmlReader.Create("d://project//data.xml");

it creates the reader seamlessly and gives no error. I don’t understand why.

EDIT: sorry both the folder paths are same and the correct one is d://project//data.xml

  • 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-05-29T17:18:57+00:00Added an answer on May 29, 2026 at 5:18 pm

    I’ve spotted two things that are wrong here.

    XmlReader reader = XmlReader.Create("d://project_elysian//data.xml"); 
    

    and

    using (XmlWriter writer = XmlWriter.Create("D://project//data//" + i + ".xml")) 
    

    The top Create uses a directory called project_elysian and the second is using project.

    Also, you are creating a file called data.xml and the other you are using data as a directory. If you are looking at incrementing the file, then you will need to remove the foward slash before the i variable

    using (XmlWriter writer = XmlWriter.Create("D:/project/data" + i + ".xml")) 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a sizable chunk of data to a file that is
I'm trying to write a secure transfer file program using Python and AES and
So I'm trying to write a large string to a .txt file, but am
Trying to write a couple of functions that will encrypt or decrypt a file
Im trying to write a single byte at a certain location in a file.
I am trying to upload text files to a specified location, but the file
I'm trying to flush a socket before sending the next chunk of the data:
I'm trying to write a glue function between two data types and I can't
I'm trying to write a regex in python to parse a Newick tree, but
I am trying to achieve something like this: while (ifstream has not been entirely

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.