R
Robert Dickow
Hi,
My XML files created with XmlTextWriter routines has been resulting in
working files, but they include three bytes of garbage at the start of
the file.
The bytes are: $EF $BB $BF (I think it always outputs these)
I am using VS 2002 and C#.
My coding involves opening a file stream, then the XmlTextWriter...
------CODE FRAGMENT------------------
string xmlpath = Server.MapPath("../xmldata");
myXmlFile = System.IO.File.Create(xmlpath + "\\" + "myxmlfile.xml");
if (myXmlFile.CanWrite)
{
myXmlFile.Lock(0,4000);
myXmlFile.Flush(); // added to try a workaround for the 'bug'
myXmlFile.Position = 0; // reposition to start, workaround.
myXml = new XmlTextWriter(myXmlFile, System.Text.Encoding.UTF8);
myXml.Formatting = System.Xml.Formatting.Indented;
myXml.Indentation = 1;
myXml.IndentChar = (char) 9;
myXml.WriteStartDocument();
// _XmlNL();
myXml.WriteStartElement("Board");
----END FRAGMENT---------------------------
Actually, the files with the garbage display fine as raw files in IE on
Windows and in FireFox on Mac, but IE on Mac chokes on the file, giving
an error about the garbage.
Anybody know if this is a bug in the C# routines in .NET 1.1, or is it
just me?
Bob Dickow
My XML files created with XmlTextWriter routines has been resulting in
working files, but they include three bytes of garbage at the start of
the file.
The bytes are: $EF $BB $BF (I think it always outputs these)
I am using VS 2002 and C#.
My coding involves opening a file stream, then the XmlTextWriter...
------CODE FRAGMENT------------------
string xmlpath = Server.MapPath("../xmldata");
myXmlFile = System.IO.File.Create(xmlpath + "\\" + "myxmlfile.xml");
if (myXmlFile.CanWrite)
{
myXmlFile.Lock(0,4000);
myXmlFile.Flush(); // added to try a workaround for the 'bug'
myXmlFile.Position = 0; // reposition to start, workaround.
myXml = new XmlTextWriter(myXmlFile, System.Text.Encoding.UTF8);
myXml.Formatting = System.Xml.Formatting.Indented;
myXml.Indentation = 1;
myXml.IndentChar = (char) 9;
myXml.WriteStartDocument();
// _XmlNL();
myXml.WriteStartElement("Board");
----END FRAGMENT---------------------------
Actually, the files with the garbage display fine as raw files in IE on
Windows and in FireFox on Mac, but IE on Mac chokes on the file, giving
an error about the garbage.
Anybody know if this is a bug in the C# routines in .NET 1.1, or is it
just me?
Bob Dickow