Structuring documents for XML. Adobe InDesign CS5, InDesign CS5.5
বিজ্ঞাপন
বিজ্ঞাপন
USING INDESIGN
XML
A tagged frame and, within it, tag markers.
❖ Do any of the following:
• To display color-coded tagged frames, choose View
• To hide the color-coding of tagged frames, choose View
• To display color brackets around tagged text, choose View
• To hide color brackets around tagged text, choose View
To minimize the risk of accidentally deleting a tag marker, edit tagged text in Story Editor, where tag markers are more visible.
More Help topics
“ Use the Story Editor ” on page 154
“ Working with markers ” on page 338
Delete tags
• To delete a tag from the Tags panel, drag it to the Delete icon at the bottom of the panel. If the tag has been
• To delete all unused tags, choose Select All Unused Tags from the Tags panel menu, and then click the Delete icon at the bottom of the panel.
Note: Tags that were loaded with a DTD file cannot be deleted until the DTD file is deleted.
Structuring documents for XML
For detailed information and instructions, click the links below.
Structure pane overview
The Structure pane displays, in hierarchical form, items in a document that have been marked with XML tags. These items are called elements . You can move elements in the Structure pane to define the order and hierarchy of items. An element consists of an icon indicating the element type and a tag name.
Last updated 11/16/2011
586
USING INDESIGN
XML
D
A B C
Structure pane
A.
Triangle to expand or collapse elements
B.
Element
C.
Text snippet
D.
Attribute
Additionally, elements may provide this information:
Blue diamond A blue diamond on an element icon means that the element is attached to an item on the page; the absence of a blue diamond means that the element has not been attached to a page item.
Underline The tag name is underlined if the item on the page to which the element corresponds is selected. For example, if you select text to which you assigned the Title tag, the word Title in the text’s element is underlined in the
Structure pane. Underlining shows you whether selected items on the page and elements in the Structure pane correspond.
Text snippet The first 32 characters of tagged text, called a text snippet, can appear to the right of the element. These snippets help you identify the page item to which an element corresponds.
Dot and attribute Attributes provide metadata information about an element. If attributes are attached to an element, a black dot along with attribute names and values appear below the element.
Use the Structure pane
• To open the Structure pane, choose View
• To close the Structure pane, choose View
• To expand or collapse an element (and display or hide any of its child elements), click the triangle next to the element.
• To adjust the size of the Structure pane, drag the splitter button.
• To expand or contract an element as well as all elements contained within it, hold down Ctrl (Windows) or
• To show or hide text snippets, choose Show Text Snippets or Hide Text Snippets from the Structure pane menu.
Structure pane icons
The following icons appear in the Structure pane:
587
Last updated 11/16/2011
USING INDESIGN
XML
Icon Name
Root element
Story element
Text element
Graphic element
Unplaced text element
Unplaced graphic element
Table element
Header cell element
Body cell element
Footer cell element
Empty element
Attribute
Comment
Processing instruction
DOCTYPE element
Use
Each document includes one root element at the top, which can be renamed but cannot be moved or deleted.
Represents tagged stories (one or more linked frames).
Represents tagged text within a frame.
Represents a tagged frame that includes a placed image. Each graphic element includes an href attribute that defines the path or URL to the linked file.
Unplaced text element not yet associated with a page item.
Unplaced graphic element not yet associated with a page item.
Represents a table.
Represents a cell in the header row of a table.
Represents a cell within the body of a table.
Represents a cell in the footer row of a table.
An empty frame is associated with this element.
Includes metadata, such as keywords or location of a linked image (HREF attribute).
Includes comments that appear in the XML file, but not the InDesign document.
Includes an instruction that triggers an action in applications that can read processing instructions.
Tells InDesign which DTD file to use when validating the XML file.
Rearrange structured elements
You can change the order and hierarchical rank of elements in the Structure pane. However, observe these rules:
• An XML document is required to have a single root element at the top of the structure. The root element contains and is the parent to all other elements. Only the DTD (appearing as a DOCTYPE element), comments, and processing instructions may appear above the root element in the Structure pane.
• Changes to the XML hierarchy structure may affect the appearance of tagged items on InDesign pages. For example, making a text element the child of an element elsewhere in the structure also moves the text in the layout.
• You cannot drag a table cell element into a table element or move elements into a table element.
❖ In the Structure pane, do one of the following:
• To move an element, drag it to a new location within the structure. A line appears when you drag to indicate where you are inserting the element. The width of the line marks the level within the hierarchy.
• To make an element a child of another element, either position it over the parent element to highlight it or place it amongst the parent’s other child elements, and then release the mouse button.
• To demote an element by one level in the hierarchy, drag it just above another parent element and move it to the left slightly until the line indicating its placement spans the width of the parent element.
• To copy or cut an element, select the element or elements in the Structure pane, and then choose Edit > Copy or
Edit > Cut. Select the element directly above where you want to insert the element, and choose Edit > Paste.
588
Last updated 11/16/2011
USING INDESIGN
XML
Note: When you cut an element, the element and contents are cut to the clipboard, but the frame remains intact.
More Help topics
“ Keys for working with XML ” on page 699
Insert a parent element
Insert a parent element in the Structure pane to maintain the proper XML structure or organize content better. Before you can insert a new parent element, you must select the elements that will be the children of the new parent. When the new parent element is inserted, the selected child elements are demoted by one rank in the structural hierarchy.
589
With child elements selected (left); a newly inserted parent element includes the child elements (right).
1 In the Structure pane, select the elements that will be child elements to the new parent element you want to insert.
Note the following:
• You can’t select the Root or a root-level element.
• The elements must be on the same level of the structural hierarchy.
• The elements must be contiguous.
• The selection must not include table cells or attributes.
2 choose New Parent Element.
3 Select a tag for the new parent element and click OK.
Insert a new parent element quickly by selecting Add Tag in the Tags panel and then clicking a tag in the panel. You can also right-click (Windows) or Control-click (Mac OS) an element you selected in the Structure pane, choose New
Parent Element, and then choose an element.
Work with attributes
An attribute provides additional information about an XML element. Each attribute consists of a name and a value.
Attributes appear in the Structure pane; they are not placed in the document or used as content in the document.
Include attributes with elements for the benefit of files and applications that will use the XML files you create in
InDesign.
When you tag an image, InDesign automatically creates an href attribute with a value that defines the on-disk location of the image file. This href attribute allows other files and applications to locate the image on disk so it can be displayed.
Last updated 11/16/2011
USING INDESIGN
XML
An attribute includes a name (href, in this case) and a value.
You can add attributes to any element except the DOCTYPE element (a DTD file), comments, and processing instructions. For example, to include keywords for searching in a downstream application, you can create an attribute called keywords . You could also create attributes to indicate substituted text, track article titles, and record other content-related information.
If you are using a DTD file, view its contents to see which attributes it allows. Attribute names, like tag names, must conform to the DTD.
Note: InDesign recognizes special namespace attributes that can specify paragraph or character styles, tables and table cell styles, as well as control whitespace. For more information, see the XML technical reference and other resources at www.adobe.com/go/learn_id_XMLscript .
More Help topics
Add an attribute
1 Select an element.
2 Do one of the following:
• Click the Add An Attribute button .
• Choose New Attribute on the Structure pane menu.
• Right-click (Windows) or Control-click (Mac
3
Show or hide attributes in the Structure pane
❖ Choose Show Attributes or Hide Attributes from the Structure pane menu.
You may need to click the triangle icon next to an element to display its attributes.
Edit or delete an attribute
1 Select an attribute in the Structure pane.
2 Do one of the following:
• To edit the attribute, double-click it or choose Edit from the Structure pane menu.
• To delete the attribute, click the Delete icon or choose Delete from the Structure pane menu.
Last updated 11/16/2011
590
USING INDESIGN
XML
Edit href attributes
InDesign creates href attributes automatically to handle image files. The href attribute defines the on-disk location of the image file so that the image file can be displayed. When you tag a placed image, InDesign creates an href attribute value that lists the image’s path and filename.
The path can be an absolute link, a relative link to the same folder as the XML file, or a relative link to the Images subfolder of the folder where the XML file is located. Relative paths are specific to the path where the document is saved.
• An href attribute with an absolute link looks like the following (in Windows and the Mac href=file:///C:/Images/Meadow.psd
href=file:///Users/abhayc//Desktop/abc.jpg
• An href attribute to an image file in the same folder as the XML file looks like the following: href=file:Meadow.psd
• An href attribute to an image file in the Images subfolder looks like the following: href=file:///Images/Meadow.psd
You can edit the href attribute to specify a new link to an image. For example, you can edit an absolute link to make it a relative link, thereby making the image file accessible when you export the file.
1 In the Structure pane, double-click the href attribute. (You may need to click the triangle icon next to the image element to display the attribute.)
2
Add comments and processing instructions
Using InDesign, you can include comments and processing instructions in an XML file. Enter a comment to include descriptive information about an element. Comments can be viewed in web browsers and text editors. They help others understand XML structure and XML tags. A processing instruction is a special, application-specific command.
For example, you can enter a page-break processing instruction so that an application to which you export your XML file understands where to enter a page break. InDesign user-created processing instructions are meant for use in other programs; InDesign itself does not act on processing instructions.
Comments and processing instructions appear in the Structure pane. You can move, edit, and delete comments and processing instructions as you can other elements in the Structure pane. They cannot, however, contain child elements or attributes.
591
A
B
InDesign Structure pane with text snippets showing
A.
Processing instruction
B.
Comment
Last updated 11/16/2011
USING INDESIGN
XML
More Help topics
“ Rearrange structured elements ” on page 588
Add a comment
1 Select the element about which you will comment.
Note: To add a comment to a table, select a table cell element. You can add comments to table cells, not tables.
2
3
Choose New Comment in the Structure pane menu.
Type the comment in the New Comment dialog box.
Add a processing instruction
1 Select an element for the processing instruction.
Note: To add a processing instruction to a table, select a table cell element. You can add processing instructions to table cells, not tables.
2 Choose New Processing Instruction in the Structure pane menu.
3
4
For Target, enter a name that identifies the processing instruction to an application that reads exported XML files.
For Data, enter a value that tells the application what to do with the processing instruction.
View comments and processing instructions
❖ Choose Show Comments or Show Processing Instructions in the Structure pane menu.
Edit comments and processing instructions
1 Select the comment or processing instruction.
2 Do any of the following:
• Double-click the comment or processing instruction.
• Choose Edit on the Structure pane menu.
3 Edit the comment or processing instruction and click OK.
Use DTD files to validate XML
Validating the XML in a document means to compare the structure, element tag names, and attributes against the specifications of a DTD file. To validate against a DTD file, you must first load it into your document in InDesign.
Note: Loading a DTD file imports tag names into the Tags panel. These imported tag names are locked; they can’t be deleted or renamed except by deleting the DTD file from the document.
The DOCTYPE element appears at the top of the Structure pane if a DTD file has been loaded into your document.
(DTDs are sometimes loaded automatically when you import an XML file.) To replace the DTD file in a document, delete the existing DTD and then load a new one.
592
Last updated 11/16/2011
USING INDESIGN
XML
A B
Working with DTD files in InDesign
A.
DOCTYPE element from the DTD file (Structure pane)
B.
Locked tag from the DTD file (Tags panel)
More Help topics
“ About DTD files ” on page 569
Load a DTD file
When you load a DTD file, InDesign embeds the file in the document.
1 Do one of the following:
• In the Structure pane, choose Load DTD from the Structure pane menu.
• In the Tags panel, choose Load DTD from the panel menu.
2 Select a DTD file to import, and click Open.
View a DTD file
DTDs are written in ASCII text. They may contain embedded instructions and explanations that describe how to apply tags and order elements correctly. In InDesign, you can only view a DTD that is loaded in a document.
593
DTD file opened for viewing
❖ Do one of the following:
• In the Structure pane menu, choose View
• Double-click the DOCTYPE element in the Structure pane.
To print a DTD file, copy code from the View DTD window and paste it in a text editor.
Last updated 11/16/2011
ডাউনলোড
বিজ্ঞাপন