Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to store & retrieve Paragraph Data using XmlSerializer in XML

How to store & retrieve Paragraph Data using XmlSerializer in XML

Scheduled Pinned Locked Moved C#
csharpxmltutorialquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Andy Rama
    wrote on last edited by
    #1

    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

    C 1 Reply Last reply
    0
    • A Andy Rama

      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

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      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

      A 2 Replies Last reply
      0
      • C Christian Graus

        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

        A Offline
        A Offline
        Andy Rama
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • C Christian Graus

          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

          A Offline
          A Offline
          Andy Rama
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups