Is it possible to embed a .zip file in XML string in C#?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sovitagar
    New Member
    • Apr 2014
    • 8

    Is it possible to embed a .zip file in XML string in C#?

    Hi,
    I am doing a project in C# wherein i need to send a xml string from server to client using TCP connection. The xml string requires to contain some data which the client can parse.My question is whether we can embed/include a .zip file or any other file as a tag value within this xml string ?
    Please help...
    Thanks in advance!!!
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    in principle you cannot embed binary data in XML. of course you can insert the string representation of the binary data or base64 encoded data into the XML code. whether the XML parser on the other side can work with that is another question.

    and of course you dramatically increase the XML’s file size doing that.

    Comment

    • sovitagar
      New Member
      • Apr 2014
      • 8

      #3
      Thanks Dormilich!!!
      You mean to say that we cannot insert any data apart from the string representation of the binary data into the xml string?
      So there's no way to insert even a text file into a xml string?

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        it shouldn’t be too difficult to get the string representation of a plain text file’s text.

        Comment

        • sovitagar
          New Member
          • Apr 2014
          • 8

          #5
          So can you help me out with embedding string representation of the binary data in a xml?
          Like I don't know as to how can we embed the same in a xml...

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

            #6
            I’d try file_get_conten ts()

            Comment

            • sovitagar
              New Member
              • Apr 2014
              • 8

              #7
              Well if you could help me out with something in C#....
              Coz my project is in C#
              Thanks So much!!!

              Comment

              • Dormilich
                Recognized Expert Expert
                • Aug 2008
                • 8694

                #8
                I don’t know C#. just JavaScript and PHP.

                Comment

                • sovitagar
                  New Member
                  • Apr 2014
                  • 8

                  #9
                  Anyways...Thank s a ton!!! :)

                  Comment

                  Working...