F
FabSW
hi all, i've to save to xml some data stored in sqlserver database,
i've to use iso-8859-1 encoding.
if i write text into xml attributes,
there is some characters that make invalid xml (for example " (147))
xmltextwriter replace character (147) with doublequote (34)
when i write this text into xml attrribute the double quote into text
is interpreted by writer like an xml attribute
delimiter.
this is my code:
using (FileStream fs = new FileStream(sOutputFile,
FileMode.CreateNew, FileAccess.Write))
{
using (XmlTextWriter writer = new
XmlTextWriter(fs, Encoding.GetEncoding(_XmlEncoding)))
{
XmlDoc.Save(writer);
writer.Flush();
writer.Close();
}
fs.Close();
}
XmlDoc is XMLDocument
_XmlEncoding is string ="ISO-8859-1"
i've to use iso-8859-1 encoding.
if i write text into xml attributes,
there is some characters that make invalid xml (for example " (147))
xmltextwriter replace character (147) with doublequote (34)
when i write this text into xml attrribute the double quote into text
is interpreted by writer like an xml attribute
delimiter.
this is my code:
using (FileStream fs = new FileStream(sOutputFile,
FileMode.CreateNew, FileAccess.Write))
{
using (XmlTextWriter writer = new
XmlTextWriter(fs, Encoding.GetEncoding(_XmlEncoding)))
{
XmlDoc.Save(writer);
writer.Flush();
writer.Close();
}
fs.Close();
}
XmlDoc is XMLDocument
_XmlEncoding is string ="ISO-8859-1"