How to store & retrieve Paragraph Data using XmlSerializer in XML
-
Hi to all, I am writting a C# Windows Application in which it uses XML to store & retrieve Student Data (like Name, Addres, DOB, Educational Details, Economical Conditions, etc). To store & retrieve data from XML, I am using XmlSerializer class. But some student data are in form of paragraph (like Educational Details, Economical Conditions, ..). How to store & retrieve that data using same XmlSerializer class? Thanks & Regards, Aniket A. Salunkhe
-
Hi to all, I am writting a C# Windows Application in which it uses XML to store & retrieve Student Data (like Name, Addres, DOB, Educational Details, Economical Conditions, etc). To store & retrieve data from XML, I am using XmlSerializer class. But some student data are in form of paragraph (like Educational Details, Economical Conditions, ..). How to store & retrieve that data using same XmlSerializer class? Thanks & Regards, Aniket A. Salunkhe
It's just XML. You can put carriage returns inside the data.
Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
-
It's just XML. You can put carriage returns inside the data.
Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
Thanks for reply. Where & How to put carriage return? If I am getting a value for an attribute as "Test Line1\nTest Line 2\nTest Line3" from XML; then do u mean to convert it to "Test Line1\r\nTest Line 2\r\nTest Line3". Thanks & Regards, Aniket A. Salunkhe
-
It's just XML. You can put carriage returns inside the data.
Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
Following is working properly, without taking care of carriage return. Here I am using XmlTextReader & XmlTextWriter instead of FileStream. //XML to .NET Object (Reading XML) using (XmlTextReader xtr = new XmlTextReader(new StreamReader(sXmlPath))) { XmlSerializer xserObject = new XmlSerializer(typeof(Child)); objChild = (Child)xserObject.Deserialize(xtr); //objChild = xserObject.Deserialize(xtr) as Child; xtr.Close(); } //.NET Object to XML (Writting XML) using (XmlTextWriter xtw = new XmlTextWriter(new StreamWriter(sXmlPath))) { XmlSerializer xserObject = new XmlSerializer(typeof(Child)); xserObject.Serialize(xtw, objChild); xtw.Flush(); xtw.Close(); } Once again thanks for your support.