Adobe 65009333 Scripting Guide - Page 77
XML, Overview, The best approach to scripting XML in InCopy, Scripting XML Elements
UPC - 883919155852
View all Adobe 65009333 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 77 highlights
8 XML Extensible Markup Language, or XML, is a text-based mark-up system created and managed by the World Wide Web Consortium (www.w3.org). Like Hypertext Markup Language (HTML), XML uses angle brackets to indicate markup tags (for example, or ). While HTML has a predefined set of tags, XML allows you to describe content more precisely by creating custom tags. Because of its flexibility, XML increasingly is used as a format for storing data. InCopy includes a complete set of features for importing XML data into page layouts, and these features can be controlled using scripting. We assume you already read Chapter 2, "Getting Started" and know how to create, install, and run a script. We also assume you have some knowledge of XML, DTDs, and XSLT. Overview Because XML is entirely concerned with content and explicitly not concerned with formatting, making XML work in a page-layout context is challenging. InCopy's approach to XML is quite complete and flexible, but it has a few limitations: ➤ Once XML elements are imported into an InCopy document, they become InCopy elements that correspond to the XML structure. The InCopy representations of the XML elements are not the same thing as the XML elements themselves. ➤ Each XML element can appear only once in a layout. If you want to duplicate the information of the XML element in the layout, you must duplicate the XML element itself. ➤ The order in which XML elements appear in a layout depends largely on the order in which they appear in the XML structure. ➤ Any text that appears in a story associated with an XML element becomes part of that element's data. The best approach to scripting XML in InCopy You might want to do most of the work on an XML file outside InCopy, before importing the file into an InCopy layout. Working with XML outside InCopy, you can use a wide variety of excellent tools, like XML editors and parsers. When you need to rearrange or duplicate elements in a large XML data structure, the best approach is to transform the XML using XSLT. You can do this as you import the XML file. Scripting XML Elements This section shows how to set XML preferences and XML import preferences, import XML, create XML elements, and add XML attributes. The scripts in this section demonstrate techniques for working with the XML content itself; for scripts that apply formatting to XML elements, see "Adding XML elements to a story" on page 83. 77