Deserialize from a string

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Samuel

    Deserialize from a string

    Hi

    Instead of deserializing (to XML object) from a file I would like to do the
    same from a string where the data is already.

    Thank you,
    Samuel


  • Tom Shelton

    #2
    Re: Deserialize from a string

    On 2008-06-18, Samuel <samuel.shulman @ntlworld.comwr ote:
    Hi
    >
    Instead of deserializing (to XML object) from a file I would like to do the
    same from a string where the data is already.
    >
    Thank you,
    Samuel
    >
    >
    Your going to have to be a little more explicit with your question... You say
    that the data is already in a string? How did it get there? What is the
    format of the string? etc.

    --
    Tom Shelton

    Comment

    • Cor Ligthert[MVP]

      #3
      Re: Deserialize from a string

      Samual,

      As the file is a text file, then it is a string, so what is the real
      problem?

      Cor

      Comment

      • Samuel

        #4
        Re: Deserialize from a string

        Currently I pass the XML Deserializer the FileStram that is 'connected' to
        the file. What I need is a stream connected to the string

        Thank you,
        Samuel



        "Cor Ligthert[MVP]" <notmyfirstname @planet.nlwrote in message
        news:3BC754EA-D7A5-4FCB-B89D-53DEA0BE3018@mi crosoft.com...
        Samual,
        >
        As the file is a text file, then it is a string, so what is the real
        problem?
        >
        Cor
        >

        Comment

        • Samuel

          #5
          Re: Deserialize from a string

          The string contains the XML content instead of reading it from the XML file




          "Tom Shelton" <tom_shelton@co mcastXXXXXXX.ne twrote in message
          news:WOadnSW1_a HBBMTVnZ2dnUVZ_ r7inZ2d@comcast .com...
          On 2008-06-18, Samuel <samuel.shulman @ntlworld.comwr ote:
          >Hi
          >>
          >Instead of deserializing (to XML object) from a file I would like to do
          >the
          >same from a string where the data is already.
          >>
          >Thank you,
          >Samuel
          >>
          >>
          >
          Your going to have to be a little more explicit with your question... You
          say
          that the data is already in a string? How did it get there? What is the
          format of the string? etc.
          >
          --
          Tom Shelton

          Comment

          • Chris Dunaway

            #6
            Re: Deserialize from a string

            On Jun 19, 8:33 am, "Samuel" <samuel.shul... @ntlworld.comwr ote:
            Currently I pass the XML Deserializer the FileStram that is 'connected' to
            the file. What I need is a stream connected to the string
            >
            Thank you,
            Samuel
            >
            "Cor Ligthert[MVP]" <notmyfirstn... @planet.nlwrote in message
            >
            news:3BC754EA-D7A5-4FCB-B89D-53DEA0BE3018@mi crosoft.com...
            >
            Samual,
            >
            As the file is a text file, then it is a string, so what is the real
            problem?
            >
            Cor
            Use a StringStream instead of a FileStream. That should work.

            Chris

            Comment

            • Andrew Morton

              #7
              Re: Deserialize from a string

              Samuel wrote:
              Instead of deserializing (to XML object) from a file I would like to
              do the same from a string where the data is already.
              Would an XMLTextReader do?


              Andrew


              Comment

              • Chris Dunaway

                #8
                Re: Deserialize from a string

                On Jun 19, 8:33 am, "Samuel" <samuel.shul... @ntlworld.comwr ote:
                Currently I pass the XML Deserializer the FileStram that is 'connected' to
                the file. What I need is a stream connected to the string
                >
                Thank you,
                Samuel
                >
                "Cor Ligthert[MVP]" <notmyfirstn... @planet.nlwrote in message
                >
                news:3BC754EA-D7A5-4FCB-B89D-53DEA0BE3018@mi crosoft.com...
                >
                Samual,
                >
                As the file is a text file, then it is a string, so what is the real
                problem?
                >
                Cor
                I meant StringReader, not StringStream. You can pass an instance of
                a StringReader into the Deserialize method of the XmlSerializer.

                Chris

                Comment

                • Cor Ligthert[MVP]

                  #9
                  Re: Deserialize from a string

                  Samuel,

                  Based on a message from Tom Shelton



                  Cor

                  "Samuel" <samuel.shulman @ntlworld.comsc hreef in bericht
                  news:ukRH4Eh0IH A.4084@TK2MSFTN GP05.phx.gbl...
                  The string contains the XML content instead of reading it from the XML
                  file
                  >
                  >
                  >
                  >
                  "Tom Shelton" <tom_shelton@co mcastXXXXXXX.ne twrote in message
                  news:WOadnSW1_a HBBMTVnZ2dnUVZ_ r7inZ2d@comcast .com...
                  >On 2008-06-18, Samuel <samuel.shulman @ntlworld.comwr ote:
                  >>Hi
                  >>>
                  >>Instead of deserializing (to XML object) from a file I would like to do
                  >>the
                  >>same from a string where the data is already.
                  >>>
                  >>Thank you,
                  >>Samuel
                  >>>
                  >>>
                  >>
                  >Your going to have to be a little more explicit with your question...
                  >You say
                  >that the data is already in a string? How did it get there? What is the
                  >format of the string? etc.
                  >>
                  >--
                  >Tom Shelton
                  >
                  >

                  Comment

                  Working...