Atomik Roundtrip 2.1: Tutorials << >>

Chapter 7 Tutorial 4 : Using XML image references in Atomik Roundtrip

In this tutorial you will learn about using references to images within an XML file in Atomik Roundtrip.

The key stages in this tutorial are:

  1. Importing an image from an XML file
  2. Exploring the image section of the Ruleset palette

Objective

The objective of this tutorial is to provide an overview of how image files can be imported into QuarkXPress from an XML file generated by another application.

Whilst an XML file is simply in a text format, many XML files contain references to image files, which have relevance to the content of the XML file. In fact, XML files can contain references to many kinds of file, but as QuarkXPress is a desktop publishing application, we’re only interested in those files which QuarkXPress will be able to read.

<!-- XML note -->
There are two usual manners in which images will be presented as part of an XML file. The first is as an attribute. So far, these tutorials have only dealt with XML elements, as it is from these which Roundtrip primarily extracts its data. Elements are the data which appears between the tags : for example :
<Body>This is an element</Body>
An attribute is an additional piece of data which can be added to an element. They are usually used for storing metadata; information about the content, as opposed to the content itself. For example:
<Body Author=”Fred Flintstone” PublicationDate=”1963 BC”> This is an element</Body>

As you can see, the attribute is enclosed in the opening tag of an element. Now, when we’re dealing with images, then the image itself is not going to be included in the XML, as it’s not text, instead we’re going to include a reference to the file itself. As this reference is information about the element, rather than the actual image (i.e. the image data), then it’s logical to include it as an attribute. Commonly, this will lead to an element with no actual content, just attributes - known as an empty element. The format for notating an empty element is as follows:
<Image imageLocation=”Images/Picture1.tif” />
Notice the closing slash - this removes the requirement for a closing tag for this element.
The other manner in which images are presented is as an unparsed entity. An entity is like a shortcut to a value : so, for example, say you don’t want to have to type the text ‘imageLocation=”ServerVolume:UserFolders:MyFolder:Files:Images:CorporateLogos:MyLogo.TIF” ‘ every time you specify a commonly used image file, you can simply refer to it by a previously defined entity reference, for example:
<Image imageLocation=”&myLogo;” />, which is a lot easier both to write and to read, makes the XML less complex, and allows you to move the image file around and change it’s name without having to change all the XML which refers to it.
An entity is declared in the DTD, and so unparsed entities can only be used in valid XML files. In the DTD, our entity would be defined as
<!ENTITY myLogo SYSTEM “ServerVolume:UserFolders:MyFolder:Files:Images:CorporateLogos:MyLogo.TIF” NDATA TIFF>
We will discuss using only image path references in this tutorial.

  1. Open up the document “RT_Tutorial4.qxp” from the Tutorials folder.
  2. Import the XML file “RT_Tutorial4.xml”, as you have for previous tutorials, making sure that the “Easy_Magazine_Tut4.rls” ruleset is selected.
  3. Draw a rectangular picture box on the page.
  4. In the XML tab of the XML palette, choose one of the ‘Graphic’ elements, which are children of ‘Review’. You’ll notice, if you expand these, that they have a child element called ‘link’ (and sometimes another child element called ‘Caption’). You’ll notice that this is an empty element with a single ‘imgPath’ attribute.
  5. Drag & drop the ‘link’ element from your chosen ‘Graphic’ element into the picture box. The image will appear in the box.
  6. Go to the ‘DTD’ tab of your XML palette, find the reference to ‘link’ and double click it. The Ruleset palette will be displayed.
  1. You’ll see that there are 3 settings for images in the Ruleset palette.
  2. The ‘Element is an image’ checkbox needs to be checked in order to define that the element refers to an image. If this is not set, the image can’t be imported.

The first item, Tag Name, is a pop-up menu that allows you to select which attribute contains the path to the image file, as it’s possible to have multiple attributes to the element. The contents of this pop-up will be all of the attributes which can be applied to this element - in the sample files there is only one attribute defined, ‘imgPath’.

The next option, Box Type, allows you to select the type of action which Import will perform when dragging an item to the page. If this is ‘Use existing box’, then Import will only let you drag the image to a picture box which has been drawn on the document. Should the box type be set to ‘Create Anchored Box’, then Roundtrip will allow you to drop the element into a text box, either on its own, or, more usually, as part of a parent element, and an anchored or inline picture box will be created, into which the picture will be imported. You can specify the size and other facets of this anchored box by clicking the ‘modify’ button in this dialog. Finally, if box type is set to ‘Create Floating Box’, then whenever you drag the parent element of an image into a text box, a new picture box will be drawn (one for each picture element which is a child of that parent element), and the picture imported into it.

The last option, Placement allows you to select how the image will be positioned or fit inside the picture box.

  1. Try setting different values for the box type and placement options, and then importing further images from your XML. Don’t forget to click ‘Add’ (when you create a new rule) or ‘Save’ (when you change an existing rule) to save your changes.

Note that you can import XML images into any kind of picture box, it doesn’t have to be a rectangular picture box.

Summary

In this tutorial we have:

  1. Imported an image into QuarkXPress from an XML file
  2. Edited ruleset definitions relating to images