Altova XMLSpy 2024 Professional Edition

Images can be displayed directly in Grid View (see screenshot below). In order to do this, the image must be inserted in its Base64-encoding.

XSXMLGridViewImages

There are two ways to insert a Base64-encoded image in a Grid View cell:

 

Create a node that is of type Formula. In the formula expression cell (see screenshot above), enter the following XPath expression to convert an image to its Base64 encoding: unparsed-text("<Image-URL>", "x-binarytobase64"). The XPath function unparsed-text converts the image to Base64 encoding. The image will be rendered below the cell containing the formula expression.

Place the cursor in the cell into which you want to add the image. For example, in the screenshot above, the image is added as content of the second Image element by selecting the Image element. Then select Edit | Insert | Encoded External File. In the dialog that appears: (i) enter the path to the image you want (local or internet), (ii) select Base 64, (iii) select Create Text. The image will be converted to its Base64 encoding, and the encoded text will be entered in the cell. You can see the encoded text in Text View. However, in Grid View, you will see, not the encoding, but a rendering of the image in the cell (see screenshot above).

 

Image URLs can be given in the following forms, including as relative paths:

 

http://httpbin.org/image/png

file:///c:/LocalPig.png

C:/LocalPig.png

LocalPig.png

 

Most of the image formats that are commonly used are supported. These include PNG, JPEG, BMP, and animated GIFs. SVG is read as an XML document; in Grid View, the image is displayed as the last child of the <svg> element.

 

Save a Base64-encoded string as an image

To save a Base64-encoded string in its image format, right-click the image or its cell and select the command Save as Image. (Note that the image is actually encoded as a Base64 string in the active file but is displayed in Grid View as an image.) In the dialog that appears, select the location where you want to save the image and enter a name for the image file. The extension of the image file (.png, .gif, .svg, etc) will be auto-detected from the Base64 encoding and will appear in the Save dialog. Click Save when done.

 

This action can also be carried out via the Edit | Save as Image menu command.

 

© 2017-2023 Altova GmbH