To create a placeholder from an element type in this DTD, drag that elementtype to a QuarkXPress text box.. For example, if you dragged the element type to a text box, it would look like
Trang 1QuarkXTensions Software
Trang 2©2001 Quark Technology Partnership and Quark, Inc as to the content and arrangement
of this material All rights reserved
©1999–2001 Quark Technology Partnership, Quark, Inc., and their licensors as to thetechnology All rights reserved U.S and foreign patents pending
Information in this document is subject to change without notice and does not represent
a commitment on the part of Quark Technology Partnership or its licensee, Quark, Inc.Use of the Quark Products is subject to the terms of the end user license agreement orother applicable agreements for such product/service In the event of a conflict betweenagreements and these provisions the relevant agreements shall control
Quark Products and materials are subject to the copyright and other intellectual propertyprotection of the United States and foreign countries Unauthorized use or reproductionwithout Quark’s written consent is prohibited
Quark, QuarkXPress, QuarkXTensions and QuarkXPress Passport are trademarks ofQuark, Inc and all applicable affiliated companies, Reg U.S Pat & Tm Off and inmany other countries Avenue.quark and the Quark logo are trademarks of Quark, Inc.and all applicable affiliated companies
All other trademarks are the properties of their respective owners
Trang 4I N T R O D U C T I O N
XML Import QuarkXTensions™software lets you place content from XML files
in a QuarkXPress™or QuarkXPress Passport™document for print, HTML, orPDF output
1 Quit QuarkXPress or QuarkXPress Passport
2 Copy the “XML Import” file into the “XTension” folder within yourQuarkXPress or QuarkXPress Passport application folder
3 Launch QuarkXPress or QuarkXPress Passport to access the features ofXML Import
F O R W I N D O W S
1 Exit QuarkXPress or QuarkXPress Passport
2 Copy the “XML Import.xnt” file into the “XTension” folder within yourQuarkXPress or QuarkXPress Passport application folder
3 Launch QuarkXPress or QuarkXPress Passport to access the features ofXML Import
U N D E R S TA N D I N G P L A C E H O L D E R S
Placeholders let you take content stored in XML format and automatically insertand format that content in a QuarkXPress document This vastly simplifies theprocess of generating large quantities of QuarkXPress documents that use thesame template
H O W P L A C E H O L D E R S W O R K
Let’s say you create a weekly newspaper in QuarkXPress, and the newspapercontains a weekly column listing the top fifty paperback books, including eachbook’s title, author name, and publisher name Each week you receive this
Trang 5information by e-mail, and you copy and paste it into your magazine, ting each title, author name, and publisher name individually Wouldn’t it benice if you could automate this process?
format-XML Import software lets you do exactly that Instead of creating the samecolumn week after week, you can create it once, populate it with formattedplaceholders, and then automatically import the list of books each week.Before you can understand how placeholders work, you need to understandhow XML and DTDs work
C O N T R O L L I N G S T R U C T U R E
Note also that the title, author name, and publisher name are all enclosedbetween an opening <book> tag and a closing </book> tag This is an example
of how XML lets you control the structure of information.
A DTD (document type definition) is a sort of blueprint that lets you specifythe structure of an XML document For our example, a “booklist” DTD mightspecify that each <book>element must contain a <title>element, an <author>element, and a <publisher>element, in that order It might also define a
<booklist>element, which could contain a number of <book>elements
A DTD is used as a guideline for creating a particular type of XML file.For example, the DTD described above could be used to create a number ofXML files, each containing an appropriately tagged title, author name, andpublisher name
To create DTDs, see A Guide to avenue.quark.
Trang 6∫ If an XML file follows the rules set by a DTD, it is said to be a valid XML file.
E L E M E N T PAT H S
Every element in an XML file has a path that specifies where it is in the structure
of the XML document For example, in the following fragment of XML, the path
of the bold <author>element is <booklist>& <book>& <author>.
In a DTD, a particular type of information is called an element type The DTD for
our book list includes element types for <booklist>, <book>, <title>, <author>,and <publisher> When you use XML Import QuarkXTensions software to viewthis “booklist” DTD, it looks like this:
The DTD from a “booklist” XML file, displayed in the Placeholders palette.
Trang 7To create a placeholder from an element type in this DTD, drag that elementtype to a QuarkXPress text box For example, if you dragged the <title>element type to a text box, it would look like this:
A placeholder representing the <title> element type
The word “title” — corresponding to the <title>element type — is the holder in this picture The two gray icons are brackets; for now, all you need toknow is that they display on either side of a placeholder
place-Now, what if the DTD you’re using has both <book>elements and <magazine>elements, and both contain <title>elements? How do you know which kind
of <title>element a placeholder refers to?
To find out, click the Show Markers button in the Placeholders palette.
This button displays labeled gray markers that represent the parent elements
of the placeholder By looking at the markers in the following screen shot,for example, you can determine that the path of the <title>placeholder is
<booklist>& <book>& <title>:
A placeholder representing the <title> element type, with markers displayed
P L A C E H O L D E R S F O R M U LT I P L E E L E M E N T T Y P E S
To create the book list, you need placeholders for each book’s title, author name,and publisher name To display the placeholders, drag the whole <book>element
type from the Placeholders palette to the text box The results look like this
(with markers showing):
Placeholders for the <title>, <author>, and <publisher> element types
Trang 8Now that you have your placeholders, you can format them First, you’llinsert hard returns after the <title>, <author>, and <publisher>placeholders.Then you can format all three placeholders the way you want to The resultsmight look something like this:
Formatted placeholders for the <title>, <author>, and <publisher> element types
∫ Why are the returns inside the brackets? Anything inside a placeholder’s brackets
is displayed only if there is content to match the placeholder So if you replacethese placeholders with a <book>element that does not contain a <publisher>element, neither the <publisher>element nor the return inside its brackets
displays If you put the return after the <publisher>element’s closing bracket,that return would display regardless of whether there was content to match
the <publisher>placeholder, and you might end up with a blank line
Now that you’ve formatted your placeholders, putting an actual book name
into the text box is as easy as clicking a button on the Placeholders palette and
pointing to a well-formed XML file that contains matching <title>, <author>,and <publisher>elements Then just click the Toggle Placeholders/Content
button, and XML Import QuarkXTensions software replaces the placeholderswith every instance of corresponding content from the XML file, resulting
in something like this:
XML content that has been placed using the formatted placeholders
Trang 9∫ A well-formed XML document begins with an XML declaration and has a root
element that contains all of the other elements; each element in the document
is also required to have a corresponding end tag For information about
well-formed XML documents, see A Guide to avenue.quark.
C O N T R O L L I N G P L A C E H O L D E R O R D E R
You can think of placeholders as search parameters that tell XML Import to grabspecific kinds of content from an XML file and put that content in a text box in
a specific order
In the example you’ve dealt with so far, the set of placeholders tells XML Import
to look for all occurrences of <title>, <author>, and <publisher>elementsnested within <book>elements that are inside <booklist>elements The <book>and <booklist>markers are necessary because there might be occurrences
of <title>, <author>, and <publisher>elements in other parts of the DTD,and you may not want those occurrences
The example also tells XML Import the order in which to display the <title>,
<author>, and <publisher>elements, but you don’t have to leave them in thatorder if you don’t want to For example, you could place <author>before
<title>and remove <publisher>entirely, simply by moving the placeholderand markers for <author>(by cutting and pasting) and deleting the placeholderand markers for <publisher> The result might look something like this:
Rearranged placeholders for the <author> and <title> element types, with the <publisher>placeholder removed
Markers are displayed in the picture above to emphasize the fact that you canrearrange placeholders only within the branch where they belong For example,you can put the <author>placeholder anywhere between the <book>markers,but you can’t put it between the <booklist>marker and the <book>marker,because the DTD doesn’t allow <author>elements as direct children of
<booklist>elements
Trang 10∫ “Parent” and “child” (or “children”) refer to the hierarchical order of the
ele-ments The parent element always contains the subset of the children eleele-ments
If you want to use sets of placeholders like the one in this example, be sure
to drag the parent element, rather than dragging the child elements overone at a time In the above example, you dragged the <book>element type,which contains the <author>and <title>element types If you had draggedthe <author>and <title>element types separately, you would have gottensomething like this:
If you drag element types over separately, all matches for each are inserted
R E A D I N G M A R K E R S
One purpose of markers is to show you the path that XML content must have
in order to match a placeholder Let’s consider a marker based on a DTD that
looks like this in the Placeholders palette:
A sample DTD, viewed in the Placeholders palette.
Let’s say that when you create a placeholder for the <item>element type, itlooks like this:
Trang 11Keeping in mind that markers always come in pairs, you can determine all ofthe following from the set of markers shown above:
• Because the placeholders here are X and Y, you know that only <X>or <Y>elements can match these placeholders
• The two outermost “root” markers tell us that in order to match one of theseplaceholders, an element’s path must begin with <root>
• The “item” markers tell us that to match one of these placeholders, an element’spath must begin with <root>and <item>
• The sets of “A” and “B” markers, joined in the middle by a vertical line, tell usthat to match one of these placeholders, an element’s path must begin witheither <root>and <item>and <A>, or <root>and <item>and <B> (You can’tinsert text between the closing “A” marker and the opening “B” marker becausethe DTD doesn’t allow an <item>element to contain more than one child.)
is an OR relationship between the elements on either side This means anXML element may contain either what’s on one side of the merged brackets
or what’s on the other Therefore, it would not make sense to put text between
these two placeholders
The placeholders inside the “A” markers tell us that to qualify as a match,
an element’s path may be either <root>and <item>and <A>, or <root>and
<item>and <A>and <X>
The placeholders inside the “B” markers tell us that to qualify as a match,
an element’s path may be either <root>and <item>and <B>, or <root>and
<item>and <B>and <Y>
So, for example, the following <A>element is a match:
Trang 12å If you’re curious, the actual DTD looks like this (For information on how to
read a DTD, see A Guide to avenue.quark.)
<!ELEMENT root (item+)>
<!ELEMENT item (A|B)>
The Placeholders palette lets you view the DTD from an XML file, drag
placeholders from that DTD into a QuarkXPress document, and populatethe document with content from XML files that adhere to that DTD
To view the Placeholders palette, choose View & Show Placeholders.
Trang 13S H O W M A R K E R S , H I D E M A R K E R S ( B U T T O N S )
V i e w & S h o w P l a c e h o l d e r s
mark-ers on and off Click the Show Markmark-ers button if you want to see the full tree
structure of the placeholders in the active QuarkXPress document
S E L E C T X M L F I L E ( B U T T O N )
V i e w & S h o w P l a c e h o l d e r s
The Select XML File button displays the Select XML File dialog box,
which lets you select an XML file for use with the active QuarkXPressdocument’s placeholders
S E L E C T X M L F O L D E R ( B U T T O N )
V i e w & S h o w P l a c e h o l d e r s
The Select XML Folder button displays the Select XML Folder dialog
box, which lets you select a folder containing XML files When you click the
Toggle Placeholders/Content button , content from the first XML file inthe folder is placed in the active QuarkXPress document, as indicated by anyplaceholders you have created
placeholders or XML content are displayed in the active QuarkXPress document
• If placeholders are displayed, the button fills them with the appropriate contentfrom the selected XML file
• If XML content is displayed, the button removes that content and showsthe placeholders
Trang 14C O N V E R T P L A C E H O L D E R S T O T E X T ( B U T T O N )
V i e w & S h o w P l a c e h o l d e r s
placeholders in the active document with text from the XML file identified in
the File Name field.
F I L E N A M E ( F I E L D )
V i e w & S h o w P l a c e h o l d e r s
The File Name field displays the name of the selected XML file If no XML file
is selected, this field is blank
File Name field
D T D T R E E ( L I S T )
V i e w & S h o w P l a c e h o l d e r s
The DTD Tree list displays the structure of the selected DTD You can display
and hide the contents of element types by clicking the > and ‚ disclosuretriangles (Mac OS) or the and disclosure boxes (Windows) You candrag element types from the list into a QuarkXPress text box or text path
to create placeholders
DTD Tree list
∫ If an element in the DTD Tree list is bold, that means it can contain text and
may be dragged to a text box or text path to be used as a placeholder