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. XML / XSL
  4. How to embed images in to xml file?

How to embed images in to xml file?

Scheduled Pinned Locked Moved XML / XSL
xmlhelptutorialquestion
6 Posts 3 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.
  • C Offline
    C Offline
    chandrusofts
    wrote on last edited by
    #1

    Hi friends, I am newbie to xml, i am writing xml file using xmlTextWriter Class of System.Xml namespace. i am able to write the contents in to an xml file but the problem here is that i want to embed images in to xml file. right now i am using <img src="path"/> but this will give u the link but i want to embed images directly in to xml file Please share ur ideas Thanks in advance

    G 1 Reply Last reply
    0
    • C chandrusofts

      Hi friends, I am newbie to xml, i am writing xml file using xmlTextWriter Class of System.Xml namespace. i am able to write the contents in to an xml file but the problem here is that i want to embed images in to xml file. right now i am using <img src="path"/> but this will give u the link but i want to embed images directly in to xml file Please share ur ideas Thanks in advance

      G Offline
      G Offline
      Ghydo
      wrote on last edited by
      #2

      You can Base64 encode the image and put the encoded string between the tags:

      Encoded string

      Be aware that Base64 encoding causes an increment of the file size of about 33%, so you should only embed small images inside the XML.

      A 1 Reply Last reply
      0
      • G Ghydo

        You can Base64 encode the image and put the encoded string between the tags:

        Encoded string

        Be aware that Base64 encoding causes an increment of the file size of about 33%, so you should only embed small images inside the XML.

        A Offline
        A Offline
        ammaippan
        wrote on last edited by
        #3

        hi me too having the same problem and tried converting the image to base64. But still the image didn't displayed in the final Output. I want display an image in xml Spreadsheet.any suggestions? Thanks in advance.

        G 1 Reply Last reply
        0
        • A ammaippan

          hi me too having the same problem and tried converting the image to base64. But still the image didn't displayed in the final Output. I want display an image in xml Spreadsheet.any suggestions? Thanks in advance.

          G Offline
          G Offline
          Ghydo
          wrote on last edited by
          #4

          What is your problem? What language are you using? In C# it's simple to convert a byte[] to a base64 string:

          string result = System.Convert.ToBase64String(source);

          Then you can assign the string to the InnerText property of your XmlElement.

          A 1 Reply Last reply
          0
          • G Ghydo

            What is your problem? What language are you using? In C# it's simple to convert a byte[] to a base64 string:

            string result = System.Convert.ToBase64String(source);

            Then you can assign the string to the InnerText property of your XmlElement.

            A Offline
            A Offline
            ammaippan
            wrote on last edited by
            #5

            Actually i want to display an image in XML spreadsheet. Will this work in XML spreadsheet?

            G 1 Reply Last reply
            0
            • A ammaippan

              Actually i want to display an image in XML spreadsheet. Will this work in XML spreadsheet?

              G Offline
              G Offline
              Ghydo
              wrote on last edited by
              #6

              Are you trying to insert images into an Excel (XML Spreadsheet) file? I don't know how to do it, try to look at the documentation[^].

              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