Please help - "\r\n Problem in OracleXmlType " [message #248814] |
Mon, 02 July 2007 02:34 |
prasadaknair
Messages: 1 Registered: July 2007
|
Junior Member |
|
|
Dear All,
I have to fix the issue with the following code. I'm
going to create an xml in memory and writing some data in
to it. Here is the code
MemoryStream memStream = new MemoryStream();
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
settings.OmitXmlDeclaration = true;
settings.NewLineHandling = NewLineHandling.Entitize ; //
it will replace "\r\n" with "&#D;&#A;"
writer = XmlWriter.Create(memStream,settings);// it will
write xml in memory stream
writer.WriteStartElement("order");
writer.WriteStartElement("book");
riter.WriteString("4\r\n6"); // here is the problem
line
writer.WriteEndElement();
writer.WriteEndElement();
writer.Flush();
Thus I successfully created xml. It will look like
<order>
<book>4\r\n6</book>
</order>
Now im going to read the xml with "XmlReader" class and
converting it to OracleXmlType class
Here is the code;
XmlReader xmlReader=XmlReader.Create(memStream); // Here
xmlReader object only used as arg to OracelXmlType class.
ie i have not used this object to read xml.
OracleXmlType objXmlType=new OracleXmlType
(orclConnection,xmlReader); // I have oracle connection
object named "orclConnection";
Now the issue comes. When I tried to watch the value of
"objXmlType" ( by QuickWatch) i found "\r" missing from
attribute value of "book". Xml look like
<order>
<book>4\n6</book> // where is "\r" ??????????
<order>
But when I tried to read that xml with XmlReader object
like;
xmlReader.Read();
xmlReader.ReadStartElement("order");
xmlReader.ReadStartElement("book"); // "4\r\n\6"
can be viewed by debug point at this line
xmlReader.ReadEndElement();
xmlReader.ReadEndElement();
I noticed that there is no problem ie it shows "\r" ,
but when converting it with OracelXmlType, it ("\r")
disappears.
I think now you have clear idea of the issue. Can you
find any solution to this problem?
Or is this bug of "OracelXmlType" class ?
Regards
Prasad A.K
|
|
|