Wednesday, February 23, 2011

Embedding Images in XML

One of the really cool and oft-requested new features in XMLSpy 2011r2 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.

The Insert / Encoded External File command is available in Text View and Grid View.

insert-encoded-file

 

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.

 

 encoded-image

 

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.

 

image-base64

 

This is just one of the many new features added in Release 2 of XMLSpy 2011! If you haven't tried the latest version, you can update here or download a free trial.

No comments: