J
jumblesale
Hello,
I have a console app that converts fields from a database into xml
files and am having problems with 'Greater Than' and 'Less Than'
symbols being converted into their html equivalents (</ >
automatically. I need them to stay as < > so that HTML controls render
correctly when the XML file is XSLT transformed in the consuming web
app.
At the moment, I am building the XML file like this:
MemoryStream msQuestion = new MemoryStream();
StreamReader myReader = new StreamReader(msQuestion);
XmlTextWriter xtwQuestion = new XmlTextWriter(msQuestion,
Encoding.UTF8);
string strQuestion = "";
DataRow myBody = dsQA.Tables[0].Rows[0];
DataRow myRow;
xtwQuestion.WriteStartDocument();
xtwQuestion.WriteStartElement("questions");
xtwQuestion.WriteElementString("question",
myBody["question"].ToString());
....
xtwQuestion.WriteEndElement();//question
xtwQuestion.WriteEndDocument();
xtwQuestion.Flush();
msQuestion.Position = 0;
strQuestion = myReader.ReadToEnd();
msQuestion.Flush();
The problem is that when inspected, the string 'strQuestion' contains
</ > instead of < >
I've checked and the database value contains < >, so the conversion
must be done automatically somewhere.
Is there anyway to stop this conversion and leave the symbols as they
are?
Thanks for your time,
J
I have a console app that converts fields from a database into xml
files and am having problems with 'Greater Than' and 'Less Than'
symbols being converted into their html equivalents (</ >
automatically. I need them to stay as < > so that HTML controls render
correctly when the XML file is XSLT transformed in the consuming web
app.
At the moment, I am building the XML file like this:
MemoryStream msQuestion = new MemoryStream();
StreamReader myReader = new StreamReader(msQuestion);
XmlTextWriter xtwQuestion = new XmlTextWriter(msQuestion,
Encoding.UTF8);
string strQuestion = "";
DataRow myBody = dsQA.Tables[0].Rows[0];
DataRow myRow;
xtwQuestion.WriteStartDocument();
xtwQuestion.WriteStartElement("questions");
xtwQuestion.WriteElementString("question",
myBody["question"].ToString());
....
xtwQuestion.WriteEndElement();//question
xtwQuestion.WriteEndDocument();
xtwQuestion.Flush();
msQuestion.Position = 0;
strQuestion = myReader.ReadToEnd();
msQuestion.Flush();
The problem is that when inspected, the string 'strQuestion' contains
</ > instead of < >
I've checked and the database value contains < >, so the conversion
must be done automatically somewhere.
Is there anyway to stop this conversion and leave the symbols as they
are?
Thanks for your time,
J