beautypg.com

About merging, Import and append xml data – Adobe InDesign CS5 User Manual

Page 578

background image

572

USING INDESIGN

XML

Last updated 11/16/2011

Note: InDesign recognizes special namespace attributes that can specify paragraph or character styles in XML. For more
information, see the XML technical reference guide and other resources at

www.adobe.com/go/learn_id_XMLscript

.

About merging

You can place XML data in a document using merge mode or append mode. Merging mode allows you to automate
the placement of content. You can also filter data in the XML file to place only certain parts of the content.

Merge incoming XML content when:

The document contains placeholder frames and you want to fill them with imported XML content.

The document contains XML content and you want to replace it with imported XML content.

The document doesn’t contain any XML structure, and you want InDesign to replace the default root with the root
of the incoming XML file.

Merge mode compares incoming XML data to elements already in the document. It moves through the file, element
by element, comparing incoming elements to existing elements in the following manner:

1.

InDesign begins comparing at the root element

If the root elements of the imported XML file and InDesign document don’t match and the Structure pane contains
no existing structure, InDesign replaces the root of the InDesign document with the root of the incoming XML file
and imports the file.

If the root elements don’t match and the Structure pane already contains elements, InDesign appends the file at the
end of the existing structure.

If the root elements do match, the merge (and matching) process moves forward.

2.

InDesign moves to the element under the root

Starting with the element just beneath the root in the incoming XML file, InDesign searches for a matching element
in the Structure pane. For a match to occur, the incoming XML element must have the same name as an existing
element in the Structure pane, and the two elements must exist at the same level in the hierarchy.

If InDesign finds a matching element in the Structure pane, it replaces the element in the Structure pane with the
element from the incoming XML file.

If InDesign doesn’t find a match, it inserts the incoming element in the Structure pane at the starting point of the
search. For example, if the search begins just below the root and a match isn’t found, the incoming element is placed
just below the root.

3.

InDesign continues to compare elements

Element by element, InDesign continues to compare the incoming XML against the existing structure. The starting
point for the search in the Structure pane changes as the search progresses, with each search beginning just below the
last element inserted or replaced. InDesign always moves down from the current location; it never places elements
above the previous element it inserted or replaced.

Import and append XML data

When you import XML content, the new elements appear in the Structure pane. From there, you can drag elements to
place them in your document.

1 Open an InDesign document or create a new document to receive the XML content.

2 Open the Structure pane. (Choose View

> Structure > Show Structure.)