私はこのようなファイルへのXMLデータのチャンクを記述しようとしています:XmlWriterがこのコードでエラーをスローするのはなぜですか?
using (XmlWriter writer = XmlWriter.Create("D://project//data//" + i + ".xml"))
が、それは次のようなエラー与える:私はXmlReader
を使用してXMLを読んでいたときに、しかし
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
'.
を:
XmlReader reader = XmlReader.Create("d://project//data.xml");
シームレスにリーダーを作成し、エラーは発生しません。なぜか分からない。
EDIT:申し訳ありません、両方のフォルダパスは同じであり、正しいものをd://project//data.xml
フォルダーは異なります。おそらくd:// project_elysian /は存在しますが、D:// project // dataは存在しません。 –
あなたの質問で例外がクリアされているようです:ディレクトリが存在しない、 – Schwarzie2478