One of the really cool features added to XMLSpy a few years ago based on customer requests is the ability to embed external files – such as images – directly in an XML document as encoded text. This gives you the option to package all required data from various external files together in one large XML document.
Let’s take a look at how easy it is to accomplish this in the XML editor in just a few steps.
Embed Images in XML
First, click the Insert / Encoded External File command, which is is available in Text View and Grid View.
Browse to select the file to embed, and then choose either Base 16 or Base 64 encoding. If you wish to enclose the encoded text in an element, check the Create Element check box and specify the name to use.
In this example, we’re creating a new element called <photo>. If the Create Element check box is not checked, the encoded text will be inserted directly at the cursor location.
When we click OK, the encoded text of the image file we specified is inserted in the <photo> element and is now a part of our XML document.
And that’s all there is to it! This feature is available in XMLSpy versions 2011 and higher. If you’re not already a customer, you can download a free, 30-day trial to check it out.