Corel WordPerfect - 9 XML User’s Guide

WordPerfect 9 XML
Copyright © 1999 COREL CORPORATION and COREL CORPORATION LIMITED. All rights reserved.
For more complete copyright information please refer to the About section in the Help menu of the
software.

Table of contents

Chapter 1 Working with SGML and XML .............5
Chapter 2 Developing XML projects ..............11
Compiling a Document Type Definition (DTD) ...........13
Defining the layout for an XML document ............21
Chapter 3 Working with catalog files .............27
Chapter 4 Creating and saving XML documents ...........41
Chapter 5 Formatting XML documents .............53
Formatting the page layout ..............58
Formatting text .................65
Numbering elements in XML documents ............72
Chapter 6 Working with elements ..............79
Chapter 7 Editing XML documents ..............89
Editing elements and attributes ..............90
Finding and replacing elements, tags, and text...........92
Using text and file references ..............94
Chapter 8 Working with tables, macros, and graphics .........99
Chapter 9 Managing documents ..............107
Chapter 10 Checking for errors ...............113
Chapter 11 Customizing the XML environment ...........117
Setting the WordPerfect DTD Compiler preferences ..........122
Setting the WordPerfect XML Project Designer preferences ........124
Table of contents iii
WORKING WITH SGML AND
XML 1
You can use the word processing power of WordPerfect 9 to create, edit, retrieve, validate, and save documents created with the Standard Generalized Markup Language (SGML) or eXtensible Markup Language (XML). Although the user interface is now XML oriented, all the SGML functionality that was available in WordPerfect 8 is available in WordPerfect 9.
WordPerfect supports SGML and XML through
the XML editing component within WordPerfect itself — lets you create,
edit, retrieve, and save SGML or XML documents
the WordPerfect DTD Compiler — lets you create a WordPerfect template
(.WPT) from a Document Type Definition (DTD). The compiler is available from within the WordPerfect XML Project Designer
the WordPerfect XML Project Designer — lets you assign formatting to
SGML/XML elements while they are being edited in WordPerfect
Within the WordPerfect XML editing environment, the XML tree view provides an easy-to-read document structure. When you edit SGML or XML documents, you can perform any task that you normally perform on WordPerfect documents while still having the ability to validate and save documents in an SGML or XML format.
The XML components of WordPerfect are included in a Typical Installation. After you have installed WordPerfect, you can
define an XML project
Working with SGML and XML 5
compile your Document Type Definition and create a WordPerfect
template
create a layout for the XML document
work within the WordPerfect XML editing environment to create an XML
document
To install the XML components of WordPerfect when WordPerfect is already installed on your personal computer, do a Custom Installation, then select the XML components.
Using SGML with Word Perfect 9
All the SGML functionality that was available in WordPerfect 8 is available in WordPerfect 9. When you work with SGML documents, you can
open, edit, validate, and save documents
format documents
add bulleted or numbered lists
add graphics
create cross-references and tables of contents
While the user interface has been updated to be XML oriented, all menu commands and dialog boxes can still be used with SGML. Although the Document Type feature used in previous versions of WordPerfect is no longer needed in WordPerfect 9, the control information contained in the Document Type can still be accessed when you are working with previous version SGML documents. To update a previous version SGML document, you can copy the Document Type information to a WordPerfect template.
For more information about Document Types, see “Understanding Document Types” on page 9 and “Copying Document Type entries to a WordPerfect template” on page 9.
Learning more about XML
You can use the WordPerfect XML Tutorial to learn more about creating and working with XML documents. To access the tutorial, open the WordPerfect XML Project Designer, then click Help, XML Tutorial.
For more information
For information about SGML and XML, see the following:
“What are SGML and XML?” on page 7
“Why use SGML or XML?” on page 8
6 WordPerfect 9 XML: Chapter 1
“Understanding Document Types” on page 9
“Copying Document Type entries to a WordPerfect template” on page
What’s new
Following is a brief description of the changes you will notice when creating XML documents.
New look
The interface is XML oriented, while the WordPerfect XML Project Designer has replaced the Layout Designer of WordPerfect 8. Not only can you create your layout files using the WordPerfect XML Project Designer, but you can also access the WordPerfect DTD Compiler.
New functionality
The SGML functionality that was present in WordPerfect 8 has been enhanced to support XML (both UTF8 and UTF16 encodings). Document handling has been simplified so that a single WordPerfect template contains the compiled DTD, the layout file, and the Alias file. This makes it much easier to distribute XML documents. Also, processing instructions and marked sections are now supported in the editing environment.
New getting started process
The process of creating XML documents has been streamlined to let you launch the WordPerfect XML Project Designer from within WordPerfect. A new wizard guides you through the process of creating an XML project.
What are SGML and XML?
What is SGML?
SGML is an open international standard (ISO 8879) issued by the International Organization for Standardization (ISO). The SGML standard provides a platform and application-independent environment for defining document architecture and document markup.
Because SGML isolates the formatting from the document content, you can transfer both the document text and its associated formatting across platforms and between applications. In SGML, elements form the structural building blocks of a document. For example, the structure of a book can be broken down into elements, such as a title page, a table of contents, chapters, appendices, a glossary, and an index.
Working with SGML and XML
7
The SGML standard provides a method for defining each element in the content of a document. This allows advanced formatting to be applied to the SGML document so that the same content can be printed multiple ways without changing or converting the content. For example, you can print a book as a hard bound version and as a paperback version, which uses a smaller page size, font and different margins without changing the content file. Similarly, the same content can be published to the Internet or manipulated by a computer application to suit a specific purpose.
What is XML?
XML is a simplified version of SGML. XML is an open international standard issued by the World Wide Web Consortium (W3C). Like SGML, XML provides a platform and application-independent environment for defining document architecture and document markup. XML gives you the power of SGML without the complexity.
Why use SGML or XML?
There are many advantages to using SGML or XML. Both do the following:
eliminate the problem of having to visually search a document to find a
specific type of information, such as keywords or prices. With SGML or XML, complex searches can be done on minute elements of information, such as “all titles” or “the preface,” in the document structure.
standardize information by formalizing and enforcing document structure.
The document structure is specified in the Document Type Definition (DTD) associated with an SGML or XML document. The SGML or XML document is validated in accordance with the rules laid out in the DTD.
allow you to create your own DTDs or author to existing DTDs to
structure the information for specific purposes. Many organizations have developed or are in the process of developing DTDs to allow the exchange of information to take place in XML. This ensures information file formats that are not proprietary.
make information reuse and distribution easier because the document
content is separated from the document formatting. For example, an order form document might contain item names, order dates, part numbers, prices, quantity ordered, the selling agent’s name, and other information for a company. The shipping department needs to know order dates, part numbers, and quantity, but doesn’t require the prices or the agent’s name. On the other hand, the accounting department needs the name, quantity, prices, and agent’s name, but has no use for the part numbers or order dates. In this case, both departments can use the same document and simply extract only the information that they require.
8 WordPerfect 9 XML: Chapter 1
allow you to add meaning to document information. Whereas HTML
(HyperText Markup Language) is a fixed markup language, SGML and XML are both flexible markup languages. For example, a document created in HTML uses a fixed set of tags such as <h1>, <h2>, <h3>, and <p>.
On the other hand, SGML and XML provide the flexibility to create your own tags. By using descriptive tags, you add meaning to the document information. For example, a document created in XML could use the tags <model>, <year>, <color>,<mileage>, and <price>.
Adding meaning to document information allows complex queries to be performed on specific document elements. For example, “Find all Mercury Tracers with less than 100 000 kilometers that are selling for $3000 or less.” It also allows calculations to be performed on specific document elements.
Understanding Document Types
Document Types were used in previous versions of WordPerfect to describe the control information for the editing of SGML documents. They were also used to store the logic file (.LGC), the Alias file (.LNM), and associated layout files (.LSI) that you needed to create or view an SGML document. The Document Type information was stored in the registry with the full path file names of the files to be used. The Document Type information was also saved with the SGML document. When an SGML document was opened in WordPerfect, the Document Type information stored with the document was compared against the Document Type information in the registry. If the registry did not contain a matching entry then a new Document Type entry was created in the registry.
In WordPerfect 9, the Document Type information is still read and compared to the Document Type information in the registry when you open a WordPerfect SGML document. As before, if a matching entry does not exist in the registry one is created.
When you import an SGML document created with a previous version of WordPerfect, WordPerfect uses the Document Type information stored with the document to access the LGC, LSI, and LNM files.
Copying Document Type entries to a WordPerfect template
When importing SGML documents created with previous versions of WordPerfect, you need to first copy the Document Type entries to a WordPerfect template. WordPerfect uses this information to access certain key files such as the Alias and logic files before opening the document.
Working with SGML and XML
9
To copy Document Type entries to a WordPerfect template
1 Click the Start button on the Windows taskbar, then click Programs,
WordPerfect Office 2000, Utilities, WordPerfect XML Project Designer.
2 Click File, Document Types.
3 Choose a Document Type from the Types list box.
4 Click one of the following buttons:
Create — creates a new project, category, and template based on the
Document Type information of the Document Type selected in step 3.
Copy — copies Document Type information from the Document Type
selected in step 3 to the project selected in the Categories/Projects box.
Older versions of WordPerfect cannot access the template data nor
Document Type information when this information is created using WordPerfect 9.
Before you begin
Before you begin working with XML in WordPerfect, you should
have mastered the basics of WordPerfect
be familiar with the function and role of markup languages
be familiar with the structure of XML documents
If this is the first time you’ve used XML with WordPerfect, you should complete the WordPerfect XML tutorial, which will guide you through the creation of a simple XML document. To access the tutorial, go to the WordPerfect XML Project Designer, then click Help, XML Tutorial.
10 WordPerfect 9 XML: Chapter 1
DEVELOPING XML PROJECTS 2
There are seven steps involved in creating XML documents using WordPerfect.
Choosing a Document Type Definition (DTD)
Before you can create an XML project, you must decide which DTD you will be using.
Many industries have developed DTDs specific to their needs. The Department of Defense has created DTDs to support the CALS initiative. The Internet Engineering Task Force has created several versions of DTDs used to create documents for the World Wide Web. These DTDs and others are included with WordPerfect. When you develop an XML project, you must include a compiled DTD or an existing logic file.
Defining an XML project
Each XML document is associated with a category and project. If you open an existing XML document that is not associated with a project, you will be prompted to define the category and project names. Every XML project consists of a category name, a project name, a WordPerfect template, and a catalog file.
Creating a WordPerfect template
Each XML project consists of a WordPerfect template that incorporates a compiled DTD, a layout file (.LSI), an Alias file, a character mapping file, and a catalog file. SGML projects also include an SGML Declaration file. You can

Developing XML projects 11

easily e-mail XML documents to others by sending the WordPerfect template and the XML document.
Compiling a Document Type Definition
The structure of an XML document is typically based on the rules defined in the DTD. These rules are incorporated into a WordPerfect template.
Defining the layout for an XML document
The format for an XML document is defined by rules you create using the WordPerfect XML Project Designer. These rules are incorporated into a WordPerfect template. You can also choose to create a generic layout that makes XML documents more readable when you are working in the WordPerfect XML editing environment.
Specifying a catalog file
You must specify a catalog file for the WordPerfect template. This catalog file contains references to external information that is required by the XML document. Two catalog files are supplied with WordPerfect: Compile.cat and Import.cat.
Compile.cat is the file that the WordPerfect DTD Compiler will try to
use if you do not supply a different file
Import.cat is the default catalog file used when importing SGML/XML
documents. It contains entries that match up the PUBLIC and SYSTEM identifiers in the DTD and/or the root element name to the appropriate WordPerfect Template file
Creating the XML document in WordPerfect
You create XML documents within the WordPerfect XML editing environment.
Defining an XML project
When you create a new XML document, you first define the category in which you want the XML document classified. You must also define a name for the project template upon which the XML document will be based. When you open an XML document that is not associated with a project, you will be prompted for a category and project name.
To define an XML project for a new document
1 Click the Start button on the Windows taskbar, then click Programs,
WordPerfect Office 2000, WordPerfect 9.
12 WordPerfect 9 XML: Chapter 2
2 Click File, New XML Document.
3 Click the New button.
4 Follow the prompts to create an XML project.
To define an XML project using an existing XML document
1 Click the Start button on the Windows taskbar, then click Programs,
WordPerfect Office 2000, WordPerfect 9.
2 Click File, Open.
3 Choose the drive where the document is stored from the Look In list box.
4 Double-click the folder where the document is stored.
5 Double-click the document name.
If you know where a file is located, you can type the full path and filename
in the File Name text box.
To select from a list of recently opened files, click the arrow located next
to the File Name text box.
Compiling a Document Type Definition (DTD)
Document Type Definitions (DTDs) define the components and structure of a document. WordPerfect uses DTD information to tag and validate documents. But DTDs are normally stored as ASCII text files for SGML documents or UNICODE files for XML documents, which WordPerfect cannot access efficiently. To use the DTD information, the WordPerfect DTD Compiler compiles the DTD into a logic file (.LGC) and creates a WordPerfect template that incorporates the compiled DTD, the layout file (.LSI), and the Alias (.LNM) files.
When you use the WordPerfect DTD Compiler, you must
compile your DTD file or WordPerfect will not be able to use it
specify a catalog file if external entities are referenced in the DTD you are
using (or if they are referenced with PUBLIC identifiers in the SGML declaration). You need to create a catalog file before you compile the DTD to a WordPerfect template. SYSTEM external entities, for which the SYSTEM identifier is a filename or full path name, may have a matching entry in a catalog file but do not require one.
For more information about catalog entry files and other mapping files, see “Working with mapping files” on page 15.
Developing XML projects
13
You can run the WordPerfect DTD Compiler as a standalone application by creating a shortcut to D2LWIN9.EXE located in the \PROGRAM FILES\COREL\WORDPERFECT OFFICE 2000\PROGRAMS folder.
If the SGML declaration you are using contains more than one BASESET
definition, your catalog entry file must contain a PUBLIC entry with an identifier matching that of the BASESET. For more information about BASESET mappings, see “Mapping 8-bit ASCII characters to WordPerfect characters” on page 17.
As part of the compiling process, WordPerfect checks the DTD for syntax
errors. The WordPerfect DTD Compiler will not create a WordPerfect template if it finds any errors in the DTD. Compiling errors are displayed in the WordPerfect DTD Compiler Log window. For more information on an error, double-click the error in the Log window.
By default, the WordPerfect DTD Compiler creates WordPerfect
templates in the \PROGRAM FILES\COREL\WORDPERFECT OFFICE 2000\TEMPLATE\CUSTOM WP TEMPLATES\XML folder. To access the WP templates files in WordPerfect, you can specify this location as the default folder in the file settings. For more information about file settings, see “Setting the WordPerfect DTD Compiler preferences” on page 122.
Compiling a Document Type Definition (DTD)
When you compile a Document Type Definition (DTD), the WordPerfect DTD Compiler reads the DTD you specify and creates a logic file (.LGC). The logic file is incorporated into a WordPerfect template along with the other required files you specify. WordPerfect then uses the information in the template to validate your documents.
To compile a DTD
1 Click the Start button on the Windows taskbar, then click Programs,
WordPerfect Office 2000, Utilities, WordPerfect XML Project Designer.
2 Click File, DTD Compile.
3 Enable any of the following check boxes:
Compile DTD As XML — specifies that the DTD be compiled as XML
Interpret ‘-’ Character As [- Hyphen] — specifies that the ‘-’ character
is interpreted as a hyphen rather than a non-wrapping dash character
4 Locate the files in each of the following boxes:
14 WordPerfect 9 XML: Chapter 2
DTD (Input) File — lets you specify the name and location of the DTD
file upon which the document structure is based
WP Template (Output) File — lets you specify the name and location of
the WordPerfect template
SGML Declaration File — lets you specify the name and location of the
SGML Declaration file. This box is not available when you are compiling as XML.
WP Char Mapping File — lets you specify the name and location of the
character mapping file. This box is not available when you are compiling as XML.
5 Click the Compile button.
The active catalog files specified in the Catalog File Manager
automatically appear in the Catalog Files box of the WordPerfect DTD Compiler. Catalog files contain references to external information needed to create the XML document.
DTDs for SGML documents are stored as ASCII text files while DTDs for
XML documents are stored as UNICODE files.
Working with mapping files
When you compile a DTD, you must include mapping files if your XML or SGML document contains information that is available only through external entities references.
WordPerfect contains the following mapping files:
WordPerfect character mapping files that map characters defined in the
DTD. This type of mapping file is not used when you compile a DTD as XML.
BASESET mapping files. This type of mapping file is not used when you
compile a DTD as XML.
Catalog files.
The WordPerfect character mapping files and the BASESET mapping files are located in the folder \PROGRAM FILES\COREL\WORDPERFECT OFFICE 2000\XML\DTD\MAPFILES. The catalog files are located in the \PROGRAM FILES\COREL\WORDPERFECT OFFICE 2000\XML\DTD folder.
You can use these files directly, or you can use them as examples for creating your own external mapping files.
Developing XML projects
15
Mapping WordPerfect characters to SGML entities
You can use a WordPerfect character mapping file to map WordPerfect characters (also called Corel symbols) and certain WordPerfect function codes to SGML entity names.
This character-mapping capability lets you place WordPerfect characters such as á or ö in your documents. You do not have to replace these characters with entity references when you save your documents. For example, if you map á to the entity name aacute, you can insert an “á” into your documents. When you save your documents to XML format, this character is output as the entity reference áDT_.
If you do not use WordPerfect character mapping, you must replace all non-ASCII WordPerfect Characters with their corresponding entity references or enclose the characters in WP DATA codes.
Understanding WordPerfect character mapping
The WordPerfect character mapping file defines which WordPerfect Characters correspond to the character entities defined in the DTD. The file is in an ASCII format and contains one or more character mapping entries. Each character mapping entry corresponds to a particular entity name in a set of character entities and specifies the following two fields of information in this order:
Field 1: WordPerfect Character Number or WordPerfect Function Name
Field 2: Entity Name
For example, here are three declarations from the public “Added Latin 1" character set.
<!ENTITY aacute SDATA —small a, acute accent—>
<!ENTITY AELIg SDATA —capital AE diphthong (ligature)—>
<!ENTITY ouml SDATA —small o, dieresis or umlaut—>
Here are the corresponding character mapping entries in a WordPerfect character mapping file:
1,27 aacute —small a, acute accent—
1,36 AELig —capital AE diphthong (ligature)—
1,63 ouml —small o, dieresis or umlaut mark—
In this example, WordPerfect character 1,27 corresponds to the entity name aacute; DT_ character 1,36 corresponds to AElig; DT_ and so on.
16 WordPerfect 9 XML: Chapter 2
Character mapping entries and their individual fields may be separated by any combination of spaces, tabs, carriage returns, line feeds, or SGML comments.
WordPerfect function names
WordPerfect character mapping is used when compiling DTDs as SGML and allows you to map entity names to the WordPerfect functions listed below. If the DTD you are using references automatic ISO entity mapping for the ISOnum set, the three entities listed in the ISO Entity Name column will automatically be mapped to the associated WordPerfect function.
WordPerfect Function Mapping Name ISO Entity Name
[HPg] HARDPAGE --
[HSpace] HARDSPC nbsp
[- Hyphen] HYPHEN hyphen
[HyphSRt] HYPHSRT --
[- Soft Hyphen] SOFTHYPH Shy
Because XML is based on UNICODE, WordPerfect character mapping files are not used when you compile DTDs as XML. The following WordPerfect functions are automatically mapped to the UNICODE characters listed below.
WordPerfect Function UNICODE character
[HSpace] 0x00A0
[- Hyphen] 0x2010
[- Soft Hyphen] 0x00AD
Mapping 8-bit ASCII characters to WordPerfect characters
The CHARSET section in the SGML declaration provides a way to map 8-bit ASCII characters (characters 129-255) to WordPerfect characters (also called Corel symbols). If you map these characters, WordPerfect substitutes the correct 8-bit ASCII character for a WordPerfect character when a document is saved in SGML format. WordPerfect also substitutes the correct WordPerfect character for the 8-bit ASCII character when you retrieve an SGML file.
Developing XML projects
17
WordPerfect characters are mapped to the corresponding 8-bit characters beginning in the BASESET and DESCSET portion of the SGML declaration. The following is a sample BASESET section of an SGML declaration:
BASESET
“ISO Registration Number 100//CHARSET ECMA-94 Right Part of Latin Alphabet Nr. 1//ESC 2/13 4/1"
DESCSET
128 32 UNUSED
160 94 160
254 1 255
255 1 UNUSED
The numbers in the third column of the DESCSET portion refer to character positions in the specified BASESET. The BASESET must be mapped in the catalog entry file as a PUBLIC entity of type CHARSET. This entity must be in the form of a BASESET mapping file.
The WordPerfect DTD Compiler does not allow the BASESET and
DESCSET portion of the SGML declaration to modify characters 0-127 in the document character set. These characters are always declared as defined in ISO 8879.
Entity files and mapping files included with WordPerfect
WordPerfect contains the following entity declaration files, WordPerfect character mapping files, catalog entry files, and BASESET mapping files that you can use with the WordPerfect DTD Compiler:
The SGML Entity Declaration files, the WordPerfect character mapping files, and the BASESET Mapping files are located in the folder \PROGRAM FILES\COREL\WORDPERFECT OFFICE 2000\XML\DTD\MAPFILES. The catalog files are located in the \PROGRAM FILES\COREL\WORDPERFECT OFFICE 2000\XML\DTD folder.
You can use these files directly or you can use them as examples for creating your own external mapping files.
18 WordPerfect 9 XML: Chapter 2
SGML entity declaration files (*.ENT)
Use the ISO*.ENT files to access the public ISO character entity sets described in section D.4 of the SGML standard, ISO 8879-1986(E). The WP*.ENT files can be used to access the WordPerfect character entity sets included with WordPerfect. You can use these files directly or as examples for creating your own external entity files.
ISOAMSA.ENT ISOLAT1.ENT
ISOAMSB.ENT ISOLAT2.ENT
ISOAMSC.ENT ISONUM.ENT
ISOAMSN.ENT ISOPUB.ENT
ISOAMSO.ENT ISOTECH.ENT
ISOAMSR.ENT WPSET1.ENT
ISOBOX.ENT WPSET3.ENT
ISOCYR1.ENT WPSET4.ENT
ISOCYR2.ENT WPSET5.ENT
ISODIA.ENT WPSET6.ENT
ISOGRK1.ENT WPSET7.ENT
ISOGRK2.ENT WPSET8.ENT
ISOGRK3.ENT WPSET9.ENT
ISOGRK4.ENT
WordPerfect character mapping files (*.WPC)
The *.WPC files contain the WordPerfect character entity sets and ISO character entity sets. You can use these files directly or as examples for creating your own WordPerfect character entity sets.
Allchars.wpc Isodia.wpc
Iso8879.wpc Isogrk1.wpc
Isoamsa.wpc Isogrk2.wpc
Isoamsb.wpc Isogrk3.wpc
Isoamsc.wpc Isogrk4.wpc
Isoamsn.wpc Isolat2.wpc
Isoamso.wpc Isonum.wpc
Isoamsr.wpc Isopub.wpc
Developing XML projects
19
Isobox.wpc Isotech.wpc
Isocyr1.wpc Wpchars.wpc
Isocyr2.wpc
Catalog files (.CAT)
IMPORT.CAT
COMPILE.CAT
BASESET mapping files (*.SET)
BASESET mapping files are activated in an SGML declaration and are not used in XML. A BASESET mapping file is an ASCII file that describes a BASESET of characters in terms of WordPerfect Characters. This file contains one or more BASESET mapping entries. Each BASESET mapping entry corresponds to a particular character in the BASESET being described and specifies the following two fields of information:
The decimal number representing the character’s position in the
BASESET.
The character set and character number of the WordPerfect character that
most closely matches the BASESET character.
For example, the following three entries are from ECMA94.SET, the BASESET mapping file describing the ECMA-94 Latin 1 BASESET:
161 4,7
162 4,19 —Cent—
163 4,11
Any character not described by a BASESET mapping entry is assumed to be mapped to WordPerfect character 0,0 and is considered UNUSED.
BASESET mapping entries and their individual fields may be separated by any combination of spaces, tabs, carriage returns, line feeds, or SGML comments.
You can use the *.SET files (BASESET mapping files) to map 8-bit ASCII characters to WordPerfect Characters (also called Corel Symbols). The CP*.SET files correspond to IBM code pages. ECMA94.SET corresponds to the ECMA-94 Latin 1 BASESET defined by the European Computer
20 WordPerfect 9 XML: Chapter 2
—Inverted
Exclamation Point—
—Pound/Sterling—
Manufacturers Associations and used in the sample SGML declaration in ISO
8879.
CP333.SET CP8601.SET
CP437.SET CP861.SET
CP850.SET CP863.SET
CP851.SET CP865.SET
CP8510.SET CP866.SET
CP852.SET CP8660.SET
CP853.SET CP895.SET
CP860.SET CP897.SET
CP8600.SET ECMA94.SET
If a WordPerfect character is mapped to both a BASESET character and an
entity name, the BASESET mapping will take precedence when a document is validated or saved to SGML. In other words, the WordPerfect character is treated as an 8-bit SGML character rather than an entity reference.
Defining the layout for an XML document
You use the WordPerfect XML Project Designer to define one or more layouts for an XML document by creating element rules that associate formatting with each element in your document. This determines how an XML document displays and prints.
WordPerfect includes several sample template files with a defined layout. You can use these template files and the associated layouts, or you can use them as examples for creating your own templates and layouts.
The sample templates are installed in the \PROGRAM FILES\COREL\WORDPERFECT OFFICE 2000\TEMPLATE\CUSTOM WP TEMPLATES\XML folder.
You can associate as many as ten layout files with an XML document so that you can change the look of a document without changing the actual XML markup.
When you work with layout files, you can
create a generic layout that makes it easier to read XML documents in the
WordPerfect XML Editor
Developing XML projects
21
format an XML document by creating a new document layout
copy element rules from one layout file to another
choose and apply layout files
edit layout files
edit and move formatting codes
If you associate a new layout file with an existing XML document that
contains elements that are not defined in the current WordPerfect template, these elements appear as unknown elements in the Element list (for example, [Unknown] Memo). Elements with invalid parent elements, attributes, or attribute values appear as invalid elements in the Element list (for example, [Invalid]).
Creating a generic layout
You can create a generic layout that makes it easier to read XML documents in the WordPerfect XML Editor. For example, when the following XML document:
<Book><Chapter><Title>Learning about the World Wide Web<\Title><Para>You will find a lot of information on the World Wide Web</Para><Para>It is <emphasis>really</emphasis> cool!</Para></Chapter></Book>
is displayed in the WordPerfect XML Editor with a generic layout, it appears as:
<Book>
<Chapter>
<Title>Learning about the World Wide Web<\Title>
<Para>You will find a lot of information on the World Wide Web</Para>
<Para>It is <emphasis>really</emphasis> cool!</Para>
</Chapter>
</Book>
To create a generic layout
1 Create an XML document.
2 Click the XML button on the Property Bar, then choose Edit Layout.
22 WordPerfect 9 XML: Chapter 2
3 Click Tools, Create Generic Rules.
4 Click File, Save.
5 Type a name for the generic layout in the Layout Name box, then click the
Save button.
6 Click File, Exit.
If the Save command is unavailable, click File, Save As. The XML
document already has a layout file associated with it.
You must save the XML document with the new generic layout and
reopen the XML document in the WordPerfect XML Editor to see the changes.
You can also create a generic layout when you create an XML document
using the wizard.
You can also access the WordPerfect XML Project Designer by clicking
the Edit Layout button.
Creating a new document layout
You can create a new layout for an XML document without changing the XML markup. You must open or define an XML project before creating a new document layout.
To create a new document layout
1 In the WordPerfect XML Project Designer, click File, New, Layout.
2 Click the Elements button on the Property Bar, then choose an element.
3 Format the element.
For more information, see “Formatting XML documents” on page 53.
4 Repeat steps 2 and 3 until all the elements you require are in the Edit
Rule List box.
You can also create a new document layout by clicking the Layout button.
Developing XML projects
23
Copying layout definitions from one layout file to another
You can quickly create new layout files by copying element rules that associate formatting with each element in an XML document from one layout file to another.
To copy layout definitions from one layout file to another
1 In the WordPerfect XML Project Designer, open an existing layout file.
2 Click File, Retrieve.
3 Choose the Category and Project from the Categories/Projects list box.
4 Type the name of the WordPerfect template in the File Name box.
5 Click the Retrieve button.
To add the Retrieve button to the toolbar, click Tools, Settings, Toolbar
Edit. From the File category, choose Retrieve, then click the Add button.
Choosing a layout and applying it to an XML document
You can select a layout and apply it to your document. You must have an XML document opened to access the XML button on the Property Bar.
To select a layout and apply it to an XML document
1 In WordPerfect, click the XML button on the Property Bar, then click
Layouts.
2 Choose a layout from the Layouts box, then click the Select button.
Editing a document layout
You can define or modify element rules that associate formatting with each element in an XML document. You must have an XML document opened to access the XML button on the Property Bar.
To edit a document layout
1 In WordPerfect, click the XML button on the Property Bar, then click Edit
Layout.
2 Double-click the layout file you want to edit.
3 Choose an element from the Elements list box, then click Edit, Edit Rule.
24 WordPerfect 9 XML: Chapter 2
4 Define a format of the element.
For more information, see “Formatting XML documents” on page 53.
You can also access the WordPerfect XML Project Designer from
WordPerfect by clicking the Edit Layout button on the toolbar.
You can also open a layout file in the WordPerfect XML Project Designer
using the File, Open command.
Editing, moving, and deleting formatting codes
Formatting codes are applied to the selected element in the order that they appear in the Rule Entry boxes of the WordPerfect XML Project Designer. You can change this order by moving formatting codes up or down. You cannot edit all formatting codes.
To edit formatting codes
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Choose an element from the Element Rule List box, then click Edit, Edit
Rule.
3 Choose the code you want to edit from the Rule Entry For Start Tag box,
the Rule Entry For End Tag (Before Revert) box, or the Rule Entry For End Tag (After Revert) box.
4 Click the Edit Rule button.
5 Make your changes.
You can also edit a formatting code by double-clicking on the code or by
choosing the formatting code and clicking the Edit Entry button.
To move formatting codes
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Choose an element from the Element Rule List box, then click Edit, Edit
Rule.
Developing XML projects
25
3 Choose the code you want to move from the Rule Entry For Start Tag box,
the Rule Entry For End Tag (Before Revert) box, or the Rule Entry For End Tag (After Revert) box.
4 Click one of the following buttons:
Move Up — moves the code up one place in the list
Move Down — moves the code down one place in the list
To delete formatting codes
1 Choose a formatting code from the Rule Entry For Start Tag box, the Rule
Entry For End Tag (Before Revert) box, or the Rule Entry For End Tag (After Revert) box.
2 Click the Delete Entry button.
Exiting the WordPerfect XML Project Designer
When you exit the WordPerfect XML Project Designer, you are prompted to save changes to the project file unless there have been no changes since the last time you saved it.
To exit the WordPerfect XML Project Designer
Click File, Exit.
To add the Exit button to the toolbar, click Tools, Settings, Toolbar Edit. In
the File categories, select Exit, then click Add Button.
26 WordPerfect 9 XML: Chapter 2
WORKING WITH CATALOG
FILES 3
Catalog files provide a method for locating external information referenced from a DTD or document. DTDs reference information such as markup declarations for elements, entities, and attributes. Documents often reference external blocks of text, or non-textual information such as graphics and sound.
The format of the catalog file is defined by the Organization for the Advancement of Structured Information Standards (OASIS). The most common catalog file entries map a PUBLIC or SYSTEM identifier to a file on your system. WordPerfect 9 uses the proprietary keywords WPT_PUBLIC, WPT_SYSTEM and WPT_ROOT to locate the appropriate WordPerfect template file using the information from a document’s DOCTYPE declaration.
For more information about catalog files, see the following:
“What is a catalog file” on page 28
“Learning about catalog entries and proprietary catalog entry types” on
page 28
“Performing a catalog lookup” on page 35
“How the WordPerfect DTD Compiler uses catalog files” on page 38
“How WordPerfect 9 uses catalog files” on page 38
Working with catalog files 27
What is a catalog file?
A catalog file is a text file that links an entity’s name or external identifier to a filename on a particular system. When an SGML or XML processor encounters an external entity reference in a DTD or document instance, it must have a way to locate the entity’s content. The catalog file provides an application-independent way to map a PUBLIC or SYSTEM identifier to the actual file containing an entity’s content.
The format of a catalog file is defined by the Organization for the Advancement of Structured Information Standards (OASIS), an industry consortium formerly known as SGML Open. For more information, see the OASIS Technical Resolution on “Entity Management” at http://www.oasis-open.org/html/a401.htm on the OASIS web site.
Learning about Catalog Entries
A catalog file consists of one or more catalog entries. The catalog file format defines the following catalog entry types:
PUBLIC
The PUBLIC catalog entry type is the one most commonly used. It maps a public identifier to a filename. For example:
PUBLIC “ISO 8879:1986//ENTITIES Added Latin 1//EN”
“isolat1.ent”
This catalog entry would match an entity declared and referenced in the following manner:
<!ENTITY % ISOlat1 PUBLIC “ISO 8879:1986//ENTITIES Added Latin
1//EN”>
%ISOlat1;
A catalog entry of type PUBLIC may also be used to match the public identifier associated with the BASESET, CAPACITY, and SYNTAX portions of an SGML declaration, and with the public identifier (if any) specified in a DOCTYPE declaration.
ENTITY
The ENTITY catalog entry type maps an entity name to a filename. For example:
ENTITY “%WPtable”
“wptable.dtd”
28 WordPerfect 9 XML: Chapter 3
This catalog entry would match an entity declared and referenced in the following manner:
<!ENTITY % WPtable SYSTEM>
%WPtable;
The ENTITY catalog entry type is used for entities that are declared as “external” by virtue of the SYSTEM keyword, but for which no explicit system identifier is provided.
Notice that the entity name present in the catalog entry begins with the ‘%’ character. This catalog entry will only match a parameter entity with the name “WPtable”. The corresponding catalog entry for a general entity with the same name would omit the leading ‘%’ character:
ENTITY “WPtable”
“wptable.dtd”
SYSTEM
The SYSTEM catalog entry type maps a system identifier to a filename. For example:
SYSTEM “mychars.ent”
“c:\MyFiles\mychars.ent”
This catalog entry would match an entity declared and referenced in the following manner:
<!ENTITY % FunChars SYSTEM “mychars.ent”>
%FunChars;
A catalog entry of type SYSTEM may also be used to match the system identifier (if any) specified in a DOCTYPE declaration.
A matching SYSTEM catalog entry takes precedence over a matching
PUBLIC or ENTITY catalog entry. For example, an external entity is declared and referenced as follows:
<!ENTITY % ISOlat1 PUBLIC “ISO 8879:1986//ENTITIES Added Latin
1//EN” “junk.ent”>
%ISOlat1;
And, the following catalog entries existed in the catalog file:
PUBLIC “ISO 8879:1986//ENTITIES Added Latin 1//EN”
Working with catalog files
29
“isolat1.ent”
ENTITY “%ISOlat1"
“isolat1.txt”
SYSTEM “junk.ent”
“c:\autoexec.bat”
Although all three catalog entries match the information from the entity declaration, the SYSTEM catalog entry has the highest priority. Thus, the application will try to process the “autoexec.bat” file in place of the %ISOlat1; reference.
DOCTYPE
The DOCTYPE catalog entry type maps the document type name found in a document type declaration to a filename. For example:
DOCTYPE “book”
“book.dtd”
This catalog entry would match the external subset referenced in the following manner:
<!DOCTYPE book SYSTEM>
The external identifier may also include explicit public and/or system
identifiers, in which case the DOCTYPE entry would only be tested after searching for a matching SYSTEM entry and PUBLIC entry.
Partially supported catalog entry types
The following catalog entry types are not currently used in WordPerfect 9:
NOTATION
LINKTYPE
SGMLDECL
DTDDECL
DOCUMENT
DELEGATE
CATALOG
30 WordPerfect 9 XML: Chapter 3
Loading...
+ 104 hidden pages