Daniel S wrote:
Quote:
XmlReaderSettings settings = new XmlReaderSettings();
settings.ConformanceLevel = ConformanceLevel.Document;
settings.CheckCharacters = false;
settings.IgnoreComments = true;
settings.IgnoreProcessingInstructions = true;
settings.IgnoreWhitespace = true;
settings.ProhibitDtd = false;
System.IO.FileStream stream = new System.IO.FileStream(path,
FileMode.Open, FileAccess.Read, FileShare.Read);
XmlReader reader = XmlReader.Create(stream, settings);
Why don't you simply use
XmlReader reader = XmlReader.Create(path, settings);
?
Quote:
XmlDocument myDocument = new XmlDocument();
try
{
myDocument.Load(reader);
}
catch (Exception e)
{
...
>
The code works if "path" refers to a UTF-8 encoded XML file. If it
refers to a UTF-16 encoded file, myDocument.Load(reader) throws an
exception. Also, if I replace myDocument.Load(reader) with
myDocument.Load(path), the code works for both UTF-8 and UTF-16, but I
can't do that because I need the XmlReaderSettings.
>
The message and stack trace are:
>
An error has occurred while opening external DTD 'file:///C:/Documents
and Settings/myName/folder1/.../folder6/folder7/someFileName.dtd':
Could not find a part of the path 'C:\\Documents and Settings\\myName\
\folder1\\...
That message does not look in any way to be related to the encoding of
the XML document.
Quote:
This exact tag appears in UTF-8 encoded XML files in an identical
directory structure, and they don't produce this error.
I will try to reproduce that, can't currently believe that the encoding
should have any effect on URL resolution.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/