For more complete copyright information please refer to the About section in the Help menu of the
software.
Table of contents
Chapter 1Working with SGML and XML .............5
Chapter 2Developing XML projects ..............11
Compiling a Document Type Definition (DTD) ...........13
Working with mapping files ...............15
Defining the layout for an XML document ............21
Chapter 3Working with catalog files.............27
Chapter 4Creating and saving XML documents ...........41
Chapter 5Formatting XML documents .............53
Formatting the page layout..............58
Formatting text .................65
Numbering elements in XML documents ............72
Chapter 6Working with elements ..............79
Chapter 7Editing XML documents ..............89
Editing elements and attributes ..............90
Finding and replacing elements, tags, and text...........92
Using text and file references ..............94
Chapter 8Working with tables, macros, and graphics .........99
Chapter 9Managing documents..............107
Chapter 10Checking for errors ...............113
Chapter 11Customizing the XML environment ...........117
Setting the WordPerfect DTD Compiler preferences ..........122
Setting the WordPerfect XML Project Designer preferences ........124
Table of contentsiii
WORKING WITH SGML AND
XML1
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 XML5
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
6WordPerfect 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.
8WordPerfect 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.
10WordPerfect 9 XML: Chapter 1
DEVELOPING XML PROJECTS2
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 projects11
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.
12WordPerfect 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:
14WordPerfect 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 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.
16WordPerfect 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 FunctionMapping NameISO Entity Name
[HPg]HARDPAGE--
[HSpace]HARDSPCnbsp
[- Hyphen]HYPHENhyphen
[HyphSRt]HYPHSRT--
[- Soft Hyphen]SOFTHYPHShy
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 FunctionUNICODE 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
12832UNUSED
16094160
2541255
2551UNUSED
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.
18WordPerfect 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.ENTISOLAT1.ENT
ISOAMSB.ENTISOLAT2.ENT
ISOAMSC.ENTISONUM.ENT
ISOAMSN.ENTISOPUB.ENT
ISOAMSO.ENTISOTECH.ENT
ISOAMSR.ENTWPSET1.ENT
ISOBOX.ENTWPSET3.ENT
ISOCYR1.ENTWPSET4.ENT
ISOCYR2.ENTWPSET5.ENT
ISODIA.ENTWPSET6.ENT
ISOGRK1.ENTWPSET7.ENT
ISOGRK2.ENTWPSET8.ENT
ISOGRK3.ENTWPSET9.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.wpcIsodia.wpc
Iso8879.wpcIsogrk1.wpc
Isoamsa.wpcIsogrk2.wpc
Isoamsb.wpcIsogrk3.wpc
Isoamsc.wpcIsogrk4.wpc
Isoamsn.wpcIsolat2.wpc
Isoamso.wpcIsonum.wpc
Isoamsr.wpcIsopub.wpc
Developing XML projects
19
Isobox.wpcIsotech.wpc
Isocyr1.wpcWpchars.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:
1614,7
1624,19—Cent—
1634,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
20WordPerfect 9 XML: Chapter 2
—Inverted
Exclamation Point—
—Pound/Sterling—
Manufacturers Associations and used in the sample SGML declaration in ISO
8879.
CP333.SETCP8601.SET
CP437.SETCP861.SET
CP850.SETCP863.SET
CP851.SETCP865.SET
CP8510.SETCP866.SET
CP852.SETCP8660.SET
CP853.SETCP895.SET
CP860.SETCP897.SET
CP8600.SETECMA94.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.
22WordPerfect 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.
24WordPerfect 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.
26WordPerfect 9 XML: Chapter 2
WORKING WITH CATALOG
FILES3
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 files27
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”
28WordPerfect 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
30WordPerfect 9 XML: Chapter 3
OVERRIDE
BASE
Although these types are considered valid, and are preserved, they are not
otherwise acted upon.
For more information on these catalog entry types, see the OASIS
documentation mentioned above.
Proprietary catalog entry types
The OASIS catalog file specification allows for non-standard catalog entry
types. WordPerfect 9 makes use of 3 proprietary catalog entry types to
streamline the opening of XML and SGML documents:
WPT_PUBLIC
The WPT_PUBLIC catalog entry type maps the public identifier from a
document’s DOCTYPE declaration to the filename of a WordPerfect template
(.WPT) file:
WPT_PUBLIC “-//Corel//DTD Book Model//EN”
“book.wpt”
This catalog entry would match the public identifier in situations similar to
one of the following:
<!DOCTYPE book PUBLIC “-//Corel//DTD Book Model//EN”>
<book>[...]</book>
<!DOCTYPE book PUBLIC “-//Corel//DTD Book Model//EN” [
[Local markup declarations]
]>
<book>[...]</book>
This catalog entry type is used when opening an XML or SGML
document in the WordPerfect editor, and not when parsing a DTD.
WPT_SYSTEM
The WPT_PUBLIC catalog entry type maps the system identifier from a
document’s DOCTYPE declaration to the filename of a WordPerfect template
(.WPT) file. For example:
WPT_SYSTEM “book.dtd”
Working with catalog files
31
“book.wpt”
This catalog entry would match the system identifier in situations similar to
one of the following:
<!DOCTYPE book SYSTEM “book.dtd”>
<book>[...]</book>
<!DOCTYPE book SYSTEM “book.dtd” [
[Local markup declarations]
]>
<book>[...]</book>
This catalog entry type is used when opening an XML or SGML
document in the WordPerfect editor, and not when parsing a DTD.
WPT_ROOT
The WPT_ROOT catalog entry type maps the document type name (the
name of the “root” element) from a document’s DOCTYPE declaration to the
filename of a WordPerfect template (.WPT) file. For example:
WPT_ROOT “book”
“book.wpt”
This catalog entry would match the document type name in situations similar
to one of the following:
<!DOCTYPE book PUBLIC “-//Corel//DTD Book Model//EN”>
<book>[...]</book>
<!DOCTYPE book SYSTEM “book.dtd”>
<book>[...]</book>
<!DOCTYPE book [
...local markup declarations...
]>
<book>[...]</book>
This catalog entry type is used when opening an XML or SGML
document in the WordPerfect editor, and not when parsing a DTD.
32WordPerfect 9 XML: Chapter 3
Examples of external entities and catalog entries
Here are examples of external entities, and catalog entries that could be used
to locate the matching files on the system:
Entity Declaration with PUBLIC identifier
<!ENTITY % ISOlat1 PUBLIC “ISO 8879:1986//ENTITIES Added Latin
1//EN”>
Catalog Entry
PUBLIC “ISO 8879:1986//ENTITIES Added Latin 1//EN”
“ISOlat1.ent”
Entity Declaration with SYSTEM identifier
<!ENTITY graph1 SYSTEM “windmill.bmp”>
Catalog Entry
SYSTEM “windmill.bmp”
“c:\myfiles\graphics\windmill.bmp”
If a filename has no path, or a relative path, an attempt is made to locate
the file relative to the folder containing the catalog file in which the
matching entry was found.
If no SYSTEM catalog entry matches the SYSTEM identifier in the entity
declaration, the catalog lookup will return the SYSTEM identifier itself as
the possible filename. This works well if the SYSTEM identifier is a full
pathname, but full pathnames do not normally work well from one system
to the next.
Entity Declaration with both PUBLIC and SYSTEM identifiers
PUBLIC “-//Corel//ENTITIES WP 6.1 Characters (Non-ISO 8879)//EN”
“c:\corel\suite9\xml\dtd\mapfiles\wpchars.ent”
SYSTEM “wpchars.ent”
Working with catalog files
33
“c:\corel\suite9\xml\dtd\mapfiles\wpchars.ent”
Entity Declaration with SYSTEM keyword but no SYSTEM identifier
<!ENTITY module SYSTEM>
Catalog Entry
ENTITY “module”
“c:\windmill.bmp”
BASESET section in the SGML Declaration
BASESET “Upper half of IBM code page 437 (US, English)”
Catalog Entry
PUBLIC “Upper half of IBM code page 437 (US, English)”
“Cp437.set”
For information about WordPerfect character mapping, see Understanding
WordPerfect character mapping
CAPACITY section in the SGML Declaration
CAPACITY PUBLIC “ISO 8879:1986//CAPACITY WordPerfect 9//EN”
Catalog Entry
PUBLIC “ISO 8879:1986//CAPACITY WordPerfect 9//EN”
“WP9.cap”
When an XML / SGML document is opened by WordPerfect 9, a catalog
lookup is done to locate the matching WordPerfect template. Following are
some of the types of information that are found at the beginning of XML /
SGML documents, and catalog entries that could be used to locate the
template:
DOCTYPE statement with a PUBLIC identifier
<!DOCTYPE book PUBLIC “-//Corel//DTD Book declarations//EN”>
Catalog Entry
WPT_PUBLIC “-//Corel//DTD Book declarations//EN”
“book.wpt”
34WordPerfect 9 XML: Chapter 3
DOCTYPE statement with a SYSTEM identifier
<!DOCTYPE book SYSTEM “Corel Book DTD”>
Catalog Entry
WPT_SYSTEM “Corel Book DTD”
“book.wpt”
DOCTYPE statement with neither a PUBLIC nor a SYSTEM identifier
<!DOCTYPE book [ (local declarations) ]>
Catalog Entry
WPT_ROOT “book”
“book.wpt”
No DOCTYPE statement, but first start tag represents the root
element
<book><titlepage><author>...
Catalog Entry
WPT_ROOT “book”
“book.wpt”
If the filename has no path or a relative path, the file is considered to be
relative to the \COREL\WORDPERFECT OFFICE
2000\TEMPLATE\CUSTOM WP TEMPLATES\XML folder created when
the XML component was installed.
Performing a catalog lookup
When a catalog lookup is performed, the first catalog file in the list of
“active” catalogs is searched for a matching catalog entry. If more than one
catalog entry type may be considered to match, the same catalog file may be
searched multiple times before the lookup moves to the next active catalog
file. The lookup process stops as soon as a match is found.
For example, suppose the following declaration and reference are
encountered in a DTD being processed by the DTD Compiler:
Working with catalog files
35
<!ENTITY % test PUBLIC “-//Corel//ENTITIES Entity test set//EN”
“testenty.ent”>
%test;
When the parameter entity reference “%test;” is encountered, the DTD
Compiler will perform a catalog lookup to determine the name of the file
containing the replacement text of the “test” entity.
Assuming that no match is found in the first active catalog file, the catalog file
will be searched three times:
once for a SYSTEM entry with the system identifier “testenty.ent”,
once for a PUBLIC entry with the public identifier “-//Corel//ENTITIES
Entity test set//EN”, and
once for an ENTITY catalog entry with the entity name “%test”.
Then the catalog lookup will proceed to the subsequent active catalog files (if
any) and perform the same three searches in each one until a match is found
or the list is exhausted. If a matching ENTITY entry is found in the first
catalog file, the lookup will stop without searching any other catalog files.
This is true even if a subsequent catalog contains a higher-priority entry that
would match the PUBLIC or SYSTEM identifier.
How the WordPerfect DTD Compiler uses catalog files
As installed, the WordPerfect DTD Compiler has only one active catalog file
in its list: COMPILE.CAT. The list of catalog files to be registered with
and/or used by the WordPerfect DTD Compiler can be modified in the
Catalog Files dialog accessible from the File menu (Settings command). The
COMPILE.CAT file contains entries matching each of the installed files that
can be used while compiling a DTD.
A catalog lookup is performed by the WordPerfect DTD Compiler in the
following situations:
For each BASESET in the SGML declaration, except the first one. The
WordPerfect DTD Compiler assumes the public identifier of the first
BASESET to be either:
“ISO 646-1983//CHARSET International Reference Version (IRV)//ESC
2/5 4/0", or
“ISO 646:1983//CHARSET International Reference Version (IRV)//ESC
2/5 4/0".
No catalog lookup is performed for these public identifiers because they
represent the default character set used by the WordPerfect DTD
Compiler.
36WordPerfect 9 XML: Chapter 3
Since the only information available is a public identifier, the catalog
lookup will only examine PUBLIC catalog entries.
For the public identifier (if any) associated with the CAPACITY clause in
the SGML declaration, unless the public identifier is either:
“ISO 8879-1986//CAPACITY Reference//EN”, or
“ISO 8879:1986//CAPACITY Reference//EN”.
No catalog lookup is performed for these public identifiers because they
represent the default capacity set used by the DTD Compiler.
Since the only information available is a public identifier, the catalog
lookup will only examine PUBLIC catalog entries.
For the public identifier (if any) associated with the SYNTAX clause in the
SGML declaration, unless the public identifier is one of the following:
“ISO 8879-1986//SYNTAX Reference//EN”
“ISO 8879:1986//SYNTAX Reference//EN”
“ISO 8879-1986//SYNTAX Core//EN”
“ISO 8879:1986//SYNTAX Core//EN”
No catalog lookup is performed for these public identifiers because they
represent the default concrete syntax used by the WordPerfect DTD
Compiler.
Since the only information available is a public identifier, the catalog
lookup will only examine PUBLIC catalog entries.
For the system identifier, public identifier, and/or entity name associated
with an external parameter entity. Searches will be done for matching
entries of type SYSTEM, then PUBLIC, then ENTITY. (See the example
under “Performing a catalog lookup.”)
For an external declaration subset. An external declaration subset is
assumed to exist when the DOCTYPE declaration specifies a public
and/or system identifier:
<!DOCTYPE book PUBLIC “-//Corel//DTD Book Model//EN” “book.dtd”
[local markup declarations]>, or
<!DOCTYPE book PUBLIC “-//Corel//DTD Book Model//EN” [local
markup declarations]>, or
<!DOCTYPE book SYSTEM “book.dtd” [local markup declarations]>
Searches will be done for matching entries of type SYSTEM (if
applicable), then PUBLIC (if applicable), then DOCTYPE. Catalog entries
of type ENTITY are not considered in this situation.
Working with catalog files
37
If a match is found, the WordPerfect DTD Compiler will attempt to open
the file specified in the matching entry. If the filename has a relative path,
or no path, the file will be assumed to be relative to the path containing
the catalog file. If the file cannot be found or opened, an error is displayed
and the compile process halts.
If no matching entry is found during the catalog lookup process, the
WordPerfect DTD Compiler will attempt to use the system identifier from
the entity declaration as a filename. If the system identifier is a full path, it
will be used as-is. Since “testenty.ent” has no specified path, the
WordPerfect DTD Compiler will determine the location of the file
containing the entity reference and try to open a file named “testenty.ent”
in the same folder.
How WordPerfect 9 uses catalog files
The WordPerfect 9 word processor only performs catalog lookups when
opening an XML or SGML file. As installed, WordPerfect 9 has only one
active catalog file in its list: IMPORT.CAT. The list of catalog files to be
registered with and/or used by the WordPerfect Editor can be modified in the
Files Settings dialog box (XML tab) accessible from the Tools menu (Settings
command). The IMPORT.CAT file contains entries matching each of the
installed XML/SGML documents that can be opened in WordPerfect.
WordPerfect performs a catalog lookup to determine which WordPerfect
template file should be used for the XML/SGML document instance being
opened. For example, suppose the file being opened begins like this:
<!DOCTYPE book PUBLIC “-//Corel//DTD Book Model//EN” “book.dtd”
[local markup declarations]>
<book>[...]</book>
In this case, the catalog lookup will perform searches for matching entries of
type WPT_PUBLIC (if applicable), then WPT_SYSTEM (if applicable), then
WPT_ROOT. The public identifier is given a higher priority than the system
identifier. This is because the system identifier in this situation should
identify a file containing an actual DTD markup declaration subset. Since
WordPerfect is using the document type information to find a WordPerfect
template file, and not an actual DTD subset, the public identifier is given
priority as a more indirect reference to the DTD subset.
If no DOCTYPE declaration appears at the beginning of the XML/SGML
document instance, an attempt is made to locate the first start tag in the
document. If one is found, a catalog lookup will be performed to search for a
matching WPT_ROOT entry.
If a match is found, WordPerfect will attempt to use the file specified in the
matching entry as the base template for the imported document instance. If
38WordPerfect 9 XML: Chapter 3
the filename includes a full path, it will be used as-is. If the filename has a
relative path, or no path, the file will be assumed to be relative to XML
template folder. This folder is installed by default as [drive]:\Program
Files\Corel\WPO2000\Suite9\template\Custom WP Templates\XML". The
location of XML templates can be checked or modified in the Files Settings
dialog box (XML tab) accessible from the Tools menu (Settings command).
If no matching entry is found during the catalog lookup process, WordPerfect
will NOT attempt to use the system identifier from the entity declaration as a
filename. This is because the system identifier refers to a file containing part
of an actual DTD, and not to a WordPerfect template.
Working with catalog files39
CREATING AND SAVING XML
DOCUMENTS4
The WordPerfect XML editing environment is an extension of the familiar
WordPerfect word processing environment. Specific XML toolbars and menu
commands are only available within the WordPerfect XML editing
environment. The WordPerfect XML editing environment provides
a structured view of the document with a page view of the document on
one side and a tree view on the other
improved graphics support so a graphic and the markup associated with
the graphic can be imported and exported with the XML document
automatic mapping of ISO characters during the compiling process for
SGML documents so that multinational characters are mapped to the
appropriate characters in the editor. Characters that do not fall within the
ISO character sets can still be mapped manually.
improved importing and exporting that handles white space in XML
documents better
When you work with XML documents, you can create and open documents,
insert elements or text, view the document structure, and save the
documents in XML.
Creating and saving XML documents41
Creating or opening an XML document
You use the WordPerfect XML Editor to create or open XML documents.
When you open an XML file created using the HTML DTD, it opens in the
Web Editor rather than in the WordPerfect XML Editor.
Inserting elements or text
An element is a specific component of a document that is surrounded by
markings (markup). Although XML provides shorthand methods to represent
markup, most elements have a start and end tag. For example, the start tag
for the element title is <title> and the end tag is </title>. The forward
slash in the end tag distinguishes it from the start tag.
In the WordPerfect XML editing environment, you can insert elements
manually or you can let WordPerfect guide you through the process of
inserting elements. When automatic insertion of elements is turned on,
WordPerfect checks the WordPerfect template associated with the XML
document to determine how elements are nested. WordPerfect then inserts
all required elements for you. You will be prompted to define attributes
depending on the Option setting in the Elements dialog box.
For example, if you insert an element named <CHAPTER> and the
WordPerfect template requires the <TITLE> element to be the first item in
a <CHAPTER> element, WordPerfect automatically inserts the <TITLE>
element.
Inserting symbols and international characters
You can insert symbols and international characters into your XML
documents. The DTD associated with each WordPerfect template identifies
which characters are valid in an XML document based on that template.
Because XML is based on UNICODE, all symbols are automatically mapped.
This is not the case with SGML documents. When you work with SGML
documents, symbols in the WordPerfect Symbols dialog box that display in
red are properly mapped in the associated WordPerfect template. If a symbol
is mapped as an entity reference, it also displays in red but the Insert As
Character Reference check box is not available. For more information about
mapping symbols, see “Working with mapping files” on page 15.
Inserting new elements not defined in the DTD
You can insert elements into an XML document that are not defined in the
DTD. This lets you use a generic DTD while still being able to customize
your XML document to meet your needs.
42WordPerfect 9 XML: Chapter 4
Inserting marked sections
In an SGML document, marked sections are selected areas of a document
that have been tagged as CDATA, RDATA, IGNORE, or INCLUDE. You can
also create marked sections that combine several or all of these tags. In XML
documents, only CDATA marked sections are valid.
Inserting processing instructions
Processing instructions allow you to bring external information into an XML
document using the PUBLIC or SYSTEM identifiers or by identifying an
external file.
Including information in WordPerfect documents
You can mark sections of an XML document so that the marked information
is included when you save the document in WordPerfect format but is not
included when you save the document as XML. For example, you may insert
a table of contents or a comment that you do not want to include in the final
exported XML document but which you want to include in the WordPerfect
document.
Viewing the document structure
You can view the structure of an XML document using the XML Tree. You
can resize and move the XML Tree to meet your needs.
Saving XML documents
You can save XML documents as XML UTF-16 Big Endian, XML UTF-16
Little Endian, or XML UTF-8. You can also save XML documents in an
SGML format or a WordPerfect format.
When you work with SGML documents in previous versions of
WordPerfect, save and retrieve the documents in the SGML format
(.SGM) to take advantage of the enhancements in WordPerfect 9.
Creating and opening XML documents
With WordPerfect 9, you can create an XML document or you can open XML
or SGML documents.
Creating and saving XML documents
43
To create an XML document
1 Click the Start button on the Windows taskbar, then click Programs,
WordPerfect Office 2000, WordPerfect 9.
2 Click File, New XML Document.
3 Choose or create an XML Project by doing one of the following:
to create a new project, click the New button, then follow the prompts .
to choose an existing XML project, choose an existing project from
the Categories/Projects list box or locate the WP template in the File
Name box, then click the Select button.
You can also double-click in the Categories/Projects list box to choose an
existing XML project.
To create an XML document from a template
1 In WordPerfect, click File, New From Template.
2 Choose the XML category or the category where you store XML
documents.
3 Double-click the project name to open the project and create a blank XML
document.
To open an XML or SGML document
1 In WordPerfect, click File, Open.
2 Choose the drive and folder where the file is stored.
3 Double-click the filename.
You can open XML, SGML, or HTML documents as text when you want
to edit the markup code directly. Enable both the Import HTML
Documents Using The XML Component check box and the Prompt For
File Type When Importing XML/SGML Documents check box on the
XML tab in the Environment Settings dialog box.
44WordPerfect 9 XML: Chapter 4
When you open an existing SGML document, WordPerfect automatically
generates paired tags where they do not exist and inserts omitted tags
required by the WordPerfect template if the required setting is enabled in
the Environment Settings dialog box. For more information, see
“Specifying import options for SGML, and XML documents” on page 118.
You can view the document structure using the XML Tree. For more
information, see “Viewing the structure of an XML document” on page
50.
Inserting elements into an XML document
Once you create an XML document, you can add elements and text. You can
insert elements one at a time or you can insert required elements
automatically. You will be prompted to specify attributes depending on the
Option setting in the Elements dialog box. The automatic insertion of
elements is especially useful when you are creating a new XML document
because it quickly inserts the required elements in the proper order.
To manually insert elements
1 In WordPerfect, click the XML button on the Property Bar, then click
Elements.
2 Disable the Auto-Insert check box.
3 Click one of the following option buttons:
Valid Elements — displays only the elements valid at this point in the
document
All Elements — displays all the elements contained in the associated
template
4 Enable the Inclusions check box to show the optional elements valid at
this point in an SGML document.
This check box is not available for XML documents.
5 To select when the Edit Attributes dialog box appears, click the Options
button and click one of the following commands:
Always Prompt For Attributes — displays the Edit Attributes dialog
box whenever any tag that has attributes is inserted in the document
Never Prompt For Attributes — never displays the Edit Attributes
dialog box
Prompt When Attributes Required — displays the Edit Attributes
dialog box only when a tag containing required attributes is inserted
into the document
Creating and saving XML documents
45
6 Choose an element from the Valid Elements box, then click the Insert
button.
7 Repeat step 6 to insert additional elements.
To automatically insert elements
1 Follow the steps 1 to 5 from the previous procedure.
2 Enable the Auto-Insert check box.
3 Choose an element from the Valid Elements box, then click the Insert
button.
WordPerfect inserts all required tags and their siblings into the document.
4 Repeat step 3 to insert additional elements.
When you use Auto-Insert, the ENTER key no longer inserts hard
returns. You must close the Elements dialog or turn off Auto-Insert to use
the Enter key to insert hard returns. You can also insert hard returns
automatically by creating a draft template with a defined layout that
simply inserts a new line after each end tag (or after both start and end
tags, if you prefer). Use this draft template file with Auto-Insert to
automatically insert hard returns at strategic points throughout your
document without pressing ENTER.
Inserting new elements not defined in the DTD
You can insert new elements that are not defined in the DTD. Upon
document validation, you will be warned when elements are not defined.
These undefined elements will not be validated.
To insert new elements not defined in the DTD
1 In WordPerfect, open or create an XML document.
2 Click the XML button on the Property Bar, then choose Element.
3 In the Element box, do one of the following:
Type the name of the element
Type the name of the element as well as the associated attributes. For
example, type car model="mercury" where car is the element name,
model is the attribute name and mercury is the attribute value.
46WordPerfect 9 XML: Chapter 4
You can also insert new elements by typing the name of the element and
associated attributes in the Valid Elements box on the XML Property Bar
and pressing ENTER.
You can also use CTRL+Etoopen the Element dialog box.
Inserting symbols and international characters
You can use WordPerfect Symbols to insert characters that do not appear on
the keyboard, such as phonetic characters and international characters from
other alphabets, such as á. You can also insert XML characters such as < or
& that might normally be considered part of the XML markup.
To insert symbols and international characters
1 In the WordPerfect XML Project Designer, click the Elements button on
the Property Bar and choose an element.
2 Click Display, Text.
3 Click the Symbols button.
4 Click the Set box, then choose the character set you want.
5 Choose a symbol or international character from the Symbols box.
6 Click the Insert And Close button.
Not all fonts can display all symbols. Symbols not included in the active
document font appear as a hollow box on your screen.
Symbols and international characters that do not have a valid entity
reference appear as black characters in the XML document and generate
an error when the document is validated. To eliminate the error, remove
the character or select it, then mark it with WP DATA codes.
Creating, inserting, editing, and deleting marked sections
You can mark a section of a document with special tags that affect the way
that section is read in XML or SGML. You can insert one of four types of
marked sections into SGML documents or you can create marked sections
that combine several or all of these types. You can only insert CDATA
marked sections into XML documents.
Creating and saving XML documents
47
To create, insert, edit, or delete marked sections in SGML
documents
1 Select the information in the document that you want to mark.
2 Click Insert, Marked Section.
3 Choose one of the following types of marked sections:
IGNORE — ignores the content of the marked information.
Ignored marked sections are presented as hidden text
INCLUDE — includes the content of the marked section in the
document
CDATA — indicates that the content of the marked section contains no
markup
RCDATA — indicates that the only kinds of markup recognized in the
content of the marked section are references and character references
4 Click one of the following buttons:
Insert — inserts the tags for the selected type of marked section into
the document
Create — lets you create a marked section with multiple parameters
Edit — lets you edit an existing parameter definition
Delete — deletes the selected type of marked section
The IGNORE tag has priority over all other tags. If there is no IGNORE
tag, the INCLUDE tag is assumed regardless of whether it is stated or
not. The CDATA tag overrides RCDATA.
The Marked Sections dialog is not accessible when you are working with
an XML document.
You must view hidden text in order to edit an Ignored marked section in
WordPerfect.
To insert a CDATA marked section in XML documents
1 Select the information in the document that you want to mark.
2 Click Insert, CDATA Section.
48WordPerfect 9 XML: Chapter 4
Creating, inserting, editing, and deleting processing instructions
A processing instruction contains data that is not considered part of a
document or DTD. This data may take the form of formatting commands, a
command line for an external process, or any number of other formats.
XML or SGML processors do not act directly on such data but may pass it on
to its intended target. In XML, the first word in each processing instruction
is the name of the intended “target,” which must match the name of a
notation declared in the DTD.
To create, insert, edit, or delete processing instructions
1 Position the cursor at the point where you want the processing instruction
inserted.
2 Click Insert, Processing Instruction.
3 Click one of the following buttons:
Insert — inserts the selected processing instruction
New — lets you define a new process target
Edit — lets you edit the selected processing instruction
Delete — deletes the selected processing instruction
In XML, the content of the processing instruction begins with a target
identifier that is a notation name. In SGML, processing instructions
without target names are supported for the notation name.
Including information in WordPerfect documents
You can mark sections of an XML document so that when you publish the
document in the WordPerfect format, the marked sections are included as
part of the WordPerfect document. The marked information is not part of the
XML document and is not validated or exported.
To include information in WordPerfect documents
1 In WordPerfect, open or create an XML document.
2 Select the text and tags that you want to include.
3 Click XML, WP DATA.
Creating and saving XML documents
49
You can also insert WP DATA codes, then type the text you want included
in the WordPerfect document.
Viewing the structure of an XML document
The XML structured tree view lets you split the screen, with a page view of
the document on one side and a tree view on the other. The tree view
provides a clear view of the structure of the XML document. By
right-clicking on the tree view, you can quickly access XML functionality. You
must have an XML document open to be able to access the XML menu.
To view the structure of an XML document
Click XML, Show XML Tree.
WordPerfect automatically validates the document whenever you move
the insertion point. Markup errors are visibly indicated by a yellow
triangle in the XML Tree. Double-click the yellow triangle in the XML
Tree to display an explanation of the error or to display a solution. For
example, if the solution is to edit an attribute, the Edit Attributes dialog
box appears.
You can also click the XML Tree button to display the XML Tree.
Moving and resizing the XML Tree window
You can make the XML Tree window almost any size you want. You can also
undock the XML Tree window and move it to another location on the screen.
You can resize both docked and undocked XML Tree windows.
To resize a docked or undocked XML Tree window
1 Position the cursor over the left or right edge of the XML Tree window so
that the cursor becomes an arrow.
2 Drag the edge of the XML Tree window.
To dock or undock the XML Tree window
1 Right-click the XML Tree, then click Options.
2 Click one of the following commands:
50WordPerfect 9 XML: Chapter 4
Dock Tree — attaches the XML Tree window to the left side of the
application window
Undock Tree — creates a floating XML Tree window
To move the XML Tree window
Position the cursor over the XML Tree window so that the cursor
becomes a four-way arrow, then drag the XML Tree window to the
location you want.
Saving XML documents
You can save documents to the SGML, XML, or WordPerfect file format.
To save an XML document
1 In WordPerfect, click File, Save As.
2 Choose one of the following file types from the File Type list box:
XML UTF-16 Big Endian
XML UTF-16 Little Endian
XML UTF-8
3 Type a name in the File Name box.
4 Enable any of the following check boxes:
Password Protect — lets you add password security to the document
Embed fonts — embeds fonts in the document
5 Click Save.
6 Enable any of the following check boxes:
Check For Errors Before Saving — validates the XML document
before saving it
Include Document Type Declaration — saves the Document Type
declaration with the SGML document so that it can be viewed without
WordPerfect
Include SGML Declaration — saves the SGML Declaration file at the
top of an SGML document. This check box is not available for XML
documents.
Save Soft Returns In Text As Spaces — saves soft returns you have
manually inserted into the XML document as spaces
Creating and saving XML documents
51
When you save an XML document that you have modified, the save file
format will have the same encoding as when the file was opened.
WordPerfect supports both XML UTF-8 and XML UTF-16 encodings.
When you save the document in XML format, any text between WP DATA
codes is not saved.
If the On Save Keep Document’s Original File Format check box is
enabled (Files Settings dialog box), imported SGML and XML documents
will be automatically saved in their original file formats without user
prompts.
If the logic file was created using an earlier version of the WordPerfect
DTD Compiler (WordPerfect 6.1 or Intellitag), the Include Document
Type Declaration and Include SGML Declaration check boxes are not
available.
You can define the location where graphics are saved in the Files Settings
dialog box accessible from the Tools menu in WordPerfect.
52WordPerfect 9 XML: Chapter 4
FORMATTING XML
DOCUMENTS5
When you use SGML or XML, the content of the document is separated from
the formatting of the document. This is accomplished by creating a separate
collection of rules to determine how each element of an XML document
should look.
For example, instead of entering a Bold code and Center Justification code for
each chapter title when you format an XML document, you create a rule that
automatically inserts this information for each chapter title. Rules are a
powerful SGML and XML feature in WordPerfect. You can create rules in the
WordPerfect XML Project Designer. The WordPerfect XML Project Designer
saves the rules you create in a WordPerfect template. When you create or
edit an XML document in WordPerfect that uses this template, WordPerfect
applies the formatting according to the conditions you specified.
You can create several layouts for one DTD and even change to another
layout while editing an SGML or XML document in WordPerfect.
With WordPerfect, you can
define the layout for a specific element
indent elements
use styles to access a broad range of WordPerfect formatting capabilities
specify the page layout, such as paper size, margins, and page numbering
specify line and text formatting, such as line spacing and font options
Formatting XML documents53
For more information about styles or specific formatting features, such as
Center Page or Columns, see the WordPerfect online Help.
Opening a project layout
You can open existing layouts in the WordPerfect XML Project Designer.
To open an existing layout
1 In the WordPerfect XML Project Designer, click File, Open.
2 Choose the XML category or the category where the layout you want to
open is stored.
3 Double-click a project layout in the Categories/Projects list box.
Specifying the layout for an element
When you specify a layout for an element, you define the rules that specify
the format and content of the element. These rules can take effect at the
element start tag or the element end tag. You can also define when the layout
is applied to the element.
To specify the layout for an element
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
Double-click an element in the Edit Rule List box.
3 Click in the Rule Entry For Start Tag box, then use the Element Rule
menus to insert the codes you want to associate with the start tag for the
element.
4 Click in the Rule Entry For End Tag (Before Revert) box, then use the
Element Rule menus to insert the codes you want to take effect before
WordPerfect exits the element.
5 Click in the Rule Entry For End Tag (After Revert) box, then use the
Element Rule menus to insert any codes you want to take effect after
WordPerfect exits the element.
6 Click OK.
7 Choose one of the following options from the Selected Condition list box
to specify the conditions that an element must meet to display the format
specified in steps 3, 4, and 5:
54WordPerfect 9 XML: Chapter 5
Normal — applies the layout to every element that meets the specified
conditions
First — applies the layout to only the first element that meets the
specified conditions.
If an element meets the conditions of the rule and occurs several times in
a document, the rule is applied to the element the first time it occurs
under a parent element. For example, if the element <PARA> occurred
in the element <BODY> and in the element <PS>, the rule is applied
the first time <PARA> occurred in <BODY> and the first time it
occurred in <PS>, not just the first time <PARA> occurred in the
document.
Because the Element Rule menus are used to insert new codes, the dialog
boxes for the features you select will always display the default settings.
You can also select an element using the Element Selection command
accessible from the Edit menu.
Indenting elements
You can indent text within an element one tab stop to the right. You can also
justify text within an element by indenting one tab stop from both right and
left margins.
To indent elements
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click Paragraph, Indent.
4 Click one of the following commands:
Normal — moves a paragraph one tab stop to the right
Double — moves a paragraph in one tab stop from both the right and
left margins
Formatting XML documents
55
To create a hanging indent, insert an indent code, then insert a back tab
code.
Applying styles
To apply a style using the WordPerfect XML Project Designer, the style must
already be defined in the current WordPerfect template, the default
WordPerfect template, or be a system style.
For information about creating styles, see Creating and applying a text style
in the WordPerfect online Help.
To apply styles
1 In WordPerfect, create the desired style.
2 In the WordPerfect XML Project Designer, open or create an XML
project.
3 Do one of the following:
Click the Elements button on the Property Bar, then choose the
Choose the element to which you want to add a style in the Edit Rule
element you want to which you want to add a style.
List box, then click Edit, Edit Rule.
4 Click in one of the following boxes:
Rule Entry For Start Tag — applies the style at the start tag
Rule Entry For End Tag (Before Revert) — applies the style at the end
tag before a Revert code
Rule Entry for End Tag (After Revert) — applies the style at the end
tag after a Revert code
5 Click Format, Styles.
6 Enable any of the following check boxes:
Current template — shows only those styles defined in the current
template
Default template — shows only those styles defined in the default
template
System — shows only those styles that are system defined
7 Choose the desired style from the Available Styles box.
56WordPerfect 9 XML: Chapter 5
8 Click OK to return to the Element Rule dialog box.
The Style rule appears in the appropriate box. For example,
STYLE=bullets
Saving layout information
After you have formatted all the elements in an XML document, you can
save the layout information (rules) as a layout component of the WordPerfect
template or as text. Saving layout information as text makes it easier for you
to verify element rules.
To save a new layout
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Format elements as required.
3 Click File, Save.
4 Do one of the following:
Type a name for the layout in the Layout Name box.
Choose an existing layout from the Layouts box.
5 Click the Save button.
To save layout information for all elements in a file
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Format elements as required.
3 Click File, Save As.
4 Choose a category from the Category/Project list box.
5 Click the folder icon beside the File Name box.
The Open File dialog box appears.
6 Type a name for the file in the File Name box.
7 Choose WPCSS from the File Type list box.
8 Click the Open button to return to the File Save As dialog box.
9 Click the Save button.
Formatting XML documents
57
The format of the textual output is similar to CSS (Cascading Style
Sheets) and is called WPCSS.
Formatting the page layout
With WordPerfect, you can format XML documents in the following ways:
select the paper size
change document margins for a selected element
center text between the top and bottom margins
set and format page numbers
set, use, and delete tabs
insert a horizontal line
insert a new page
keep text together on one page
preserve white space
Choosing the paper size
You can specify the size and orientation of the paper you want to use.
WordPerfect uses this information to format and print your document.
To choose the paper size
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click Page, Paper Size.
4 Choose the paper definition you want to use, then click Select.
The available paper definitions in the Paper Definitions list box depend on
the printer selected in WordPerfect.
58WordPerfect 9 XML: Chapter 5
To edit a rule for an existing element using a toolbar button, click the
element in the Element Rules List box, then click the Edit Rule button.
Changing document margins
You can change the document margins for a specific element.
To change document margins for a selected element
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click Format, Margins.
4 Specify new settings for Left, Right, Top, or Bottom margins.
To edit a rule for an existing element using a toolbar button, click the
element in the Element Rules List box, then click the Edit Rule button.
Centering text between the top and bottom margins
You can specify that text associated with a specific element be centered
between the top and bottom margins.
To center text between the top and bottom margins
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click Page, Center Page, then choose one of the following commands:
Current Page — centers text on the current page
Current And Subsequent Pages — centers text on all the pages in the
document
No Centering — turns centering off
Formatting XML documents
59
To edit a rule for an existing element using a toolbar button, click the
element in the Element Rules List box, then click the Edit Rule button.
Setting page numbers
You set a new page number for a specific element. Each time this element is
encountered, the page number is reset. You can also increase or decrease a
page number.
To set a new page number
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click Page, Numbering.
4 Type a new number in the New Page Number box.
To increase or decrease a page number
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click Page, Numbering.
4 Type the increment by which you want to increase or decrease the page
number in the Increase/Decrease Existing Page Number box.
To edit a rule for an existing element using a toolbar button, click the
element in the Element Rules List box, then click the Edit Rule button.
Formatting and positioning page numbers
You can format page numbers by choosing a numbering style and by
specifying the text that will accompany numbers. You can also position page
numbers on the page.
60WordPerfect 9 XML: Chapter 5
To position page numbers
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click Page, Numbering.
4 Choose one of the position options from the Position list box.
To set the numbering style
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click Page, Numbering.
4 Choose one of the numbering styles from the Numbering Style list box.
To include text with the page number
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click Page, Numbering.
4 Type the text in the Format and Accompanying Text box.
5 Click the Page Code button to insert the page number in the text you
type.
To edit a rule for an existing element using a toolbar button, click the
element in the Element Rules List box, then click the Edit Rule button.
Formatting XML documents
61
Setting and using tabs
You can set tabs for elements in your document or indent a single line of text.
Tab settings determine where the insertion point stops when you press TAB
or BACK TAB. How much the text is indented depends on the tab settings
you’ve chosen. You can also delete tab settings.
To set tabs
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click Line, Tab Set.
4 Choose a tab type from the Type list box:
Left, Dot Left — sets a tab that remains left; text moves right
Center, Dot Center — sets the text you type centered around the tab
Right, Dot Right — sets the tab that remains right; text moves left
Decimal, Dot Decimal — inserts text before and after a decimal tab
character
5 Type the position for the tab in the Position box.
6 If you want tabs repeated at a specified interval, enable the Repeat Every
check box, then type in the interval at which to repeat the tab.
7 Click one of the following option buttons to position the tabs:
Left Margin (Relative)
Left Edge of Paper (Absolute).
8 Click the Set button.
When you use Dot tabs, dot leaders (a row of dots) appear between the
insertion point and the next tab setting.
To restore the original tab settings, click the Default button.
62WordPerfect 9 XML: Chapter 5
To indent a line of text
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click Line, Tab, then click one of the following types of tabs:
Soft Tab — indents the line according to the tab type defined in the
next tab setting
Back Tab — moves the insertion point to the previous tab setting
Hard Tabs — indents the line according to the position defined in the
next tab setting; hard tabs remain even if you change tab settings
Hard Tabs With Dot Leaders — indents the line with dot leaders to the
next tab setting for one time only; hard tabs remain even if you change
tab settings
You can also indent all the lines of a paragraph using the Indent command
from the Paragraph menu.
To remove a tab setting
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click Line, Tab Set.
4 Choose the tab setting that you want to delete in the Tab Settings box.
5 Click the Clear button.
To delete all tab settings, click the Clear All button.
To restore the default tab settings, click the Default button.
Formatting XML documents
63
Inserting horizontal lines
You can make your documents easier to read by inserting a horizontal line
each time WordPerfect encounters a specific element. In this way, you can
visually group relevant information together.
To insert a horizontal line
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click Insert, Horizontal Line.
Creating a new page
You can force a new page whenever WordPerfect encounters a specific
element.
To create a new page
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click Page, New Page.
Keeping text together on one page
When it is important to keep text together on one page, you can set
widow/orphan protection for the selected element. Widow/orphan protection
is in effect between the start and end tags of the selected element.
To keep text together on one page
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
64WordPerfect 9 XML: Chapter 5
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click Page, Widow/Orphan.
Preserving white space
You can choose to preserve white space within certain elements. By default,
WordPerfect removes all white space (tabs and space characters) where data
(PCDATA, RCDATA, and CDATA) is not allowed in the document.
To preserve white space
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Click Edit, Preserve White Space.
3 Choose the elements in the Element box for which you want white space
preserved.
WordPerfect also converts carriage returns to spaces where data is
allowed when you open an XML document in WordPerfect.
To select all the elements defined in the DTD, click the Select All button
in the Preserve White Space dialog box.
Formatting text
With WordPerfect, there is a full range of features that helps you manage the
spacing, positioning, and look of text. You can format text in the following
ways:
add bulleted or numbered lists
number lines
change line spacing
keep words together on one line
create columns
Adding bulleted lists
To organize information in a useful way, you can add bulleted lists to your
XML document. To create a bulleted list, you need to have list elements
defined in your DTD or defined as a style in the WordPerfect template. For
Formatting XML documents
65
more information about using styles, see “Applying styles” on page 56. You
can choose the type of bullet you want to use in the list.
To add a bulleted list
1 In WordPerfect, open or create an XML document.
2 Click the XML button on the Property Bar, then click Elements.
3 Enable the Auto-Insert check box.
4 Place the cursor where a bulleted list is valid.
5 Double-click the bullet list element in the Elements dialog box.
6 If the Edit Attributes dialog box opens, click the bulleted list button.
7 Continue to add list items.
8 Click somewhere else in your document when you are done.
To define the bullet type
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Double-click the bullet element (such as Item) in the Element Rule List.
3 In the Rule Entry For Start Tag box, click where you want the bullet to
appear.
4 Click Display, Text.
5 Click the Symbols button, choose the symbol you want to display, then
click the Insert And Close button.
Another way to format text as bulleted is to use styles. For more
information, see “Applying styles” on page 56.
Adding numbered lists
To organize information in a useful way, you can add numbered lists to your
XML document. You use counters to count the elements in your document
and format the numbering for the list as numbers, letters, or Roman
numerals. You can create counters with one numbering level or with several
numbering levels (such as I, i, a).
66WordPerfect 9 XML: Chapter 5
To add numbered lists with only one level
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Choose an element from the Element Rule List box.
3 Click Edit, Define Counters, then click the Create button.
4 Type a name for the counter in the Counter Name box.
5 Choose a numbering method from the Single Level Method list box.
To add numbered lists with more than one level
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Choose an element from the Element Rule List box.
3 Click Edit, Define Counters, then click the Create button.
4 Type a name for the counter in the Counter Name box.
5 Type the number of levels you want in the Number of Levels box.
6 Type a level name and choose a numbering method for each level in the
Multi-level Definition section.
The counter number will appear in the Counter list box. You use it to
mark the elements you want to number.
When you increase, decrease, or set a value for one level of a multi-level
counter, the value for all lower levels is reset to 1. For example, a
three-level counter has been increased to 2,4,5. When Level 1 is
increased to 3, Levels 2 and 3 are reset to 1. When all three levels of the
counter are displayed, the numbers will be 3,1,1.
Numbering lines in documents and newspaper columns
To make it easier to find information in your XML documents, you can
automatically number all lines in a document or in newspaper columns.
To number the lines in a document
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Formatting XML documents
67
Click the Elements button on the Property Bar, then choose the
element where you want line numbering to begin.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click Line, Numbering.
4 Enable the Turn Line Numbering On check box.
5 Select and change any of the following options in the Numbering Options
section:
Numbering Method — lets you specify whether line numbers will print
as numbers, letters, or Roman numerals
Starting Line Number — lets you specify the number assigned to the
first line
First Printing Line Number — lets you specify the first line number to
print
Numbering Interval — lets you specify the interval between printed
line numbers
6 Click one of the following option buttons in the Position Of Numbers
section:
From The Left Edge Of Page — lets you specify the distance from the
left edge of the page (or from the center of the space between
columns) to the line number
Left of Margin — lets you specify the distance from the left margin to
the line number
7 Enable any of the following check boxes:
Restart Numbering On Each Page — lets you specify whether line
numbers will begin again with the starting line number at the top of
each page
Count Blank Lines — lets you specify whether blank lines are
counted
To number lines in newspaper columns
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose the
element where you want line numbering to begin.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
68WordPerfect 9 XML: Chapter 5
3 Click Line, Numbering.
4 Enable the Turn Line Numbering On check box.
5 Click the Left Of Margin option button, then type the distance between
the line numbers and the left edge of text in each column.
6 Enable the Number All Newspaper Columns check box.
7 Select and change any other options as needed.
When you specify the distance between the line numbers and the left
edge of text in each column, specify a distance less than the space
between the columns. Otherwise, the line numbers may overlap the text
in the columns.
Changing line spacing
You can change the line spacing for a specific element.
To change the line spacing
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click Line, Spacing, then click one of the following commands:
Single — sets single spacing
Double — sets double spacing
Other — sets a spacing value that you specify
In single-spaced text, the distance from baseline to baseline is one line
height. When you click Other and then specify a new number in the Line
Spacing dialog box, the current line height is multiplied by that number.
Beginning a new line
The new line begins at that point in the document where the element is
inserted.
Formatting XML documents
69
To begin a new line
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click Line, New Line.
Keeping words together on the same line
When it is important that two words be kept together on the same line, you
can add a non-breakable space between words.
To use hard spaces to keep words together on the same line
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click Insert, Hard Space.
Changing font options
You can apply different font types to text and you can change the appearance
of text to make it appear in bold or italic, for example. You can also change
the size of text.
To change font options
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click Format, Font.
4 Select the font style, size, and appearance.
70WordPerfect 9 XML: Chapter 5
To create a subscript or superscript, click the Position button.
To set the relative size of the font, click the Relative Size button.
Aligning text
You can apply different types of justifications such as left, right, center, and
full.
To align text
1 In the WordPerfect XML Project Designer, open or create an XML
2 Do one of the following:
3 Click Paragraph, Justification, then choose one of the following commands:
project.
Click the Elements button on the Property Bar, then choose an element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
Left — left justifies the paragraph
Right — right justifies the paragraph
Center — centers the paragraph
Full — adds space between words to justify text to both margins
All — adds space between words and letters to justify text to both
margins
When you use Full or All justification, spacing between words is expanded
or compressed so that the text fills a line.
Creating and ending columns
Formatting information into columns involves creating a column definition for
a specific element. The column definition specifies the column formatting.
You must also specify when information is no longer to be formatted as
columns.
To create columns
1 In the WordPerfect XML Project Designer, open or create an XML
project.
Formatting XML documents
71
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click Format, Columns.
4 Specify the number of columns in the Columns box.
5 Click one of the following option buttons:
Newspaper — formats text to flow down a column to the bottom of a
page or column break, then continues the text at the top of the next
column
Balanced Newspaper — formats the newspaper columns so that
columns are of equal length
Parallel — groups columns across the page in rows, and starts
subsequent rows below the longest column of the previous row.
Parallel columns are useful for scripts, charts, or lists
Parallel w/Block Protect — formats text in the number of parallel
columns specified. Keeps all rows of the columns together across page
breaks
6 Click in the Spacing Between Columns box to set a default space between
columns, or click in the Line Spacing Between Rows In Parallel Columns
box to change the spaces between rows.
7 Type the width of each column and the space between columns in the
Columns Width section.
8 Enable the Fixed check box to ensure that the width of a column or space
is kept regardless of width or margin changes in other columns.
To end columns
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click Page, Hard Column.
Numbering elements in XML documents
When you want to number elements in your document, you use counters.
Counters can display numbers, letters, and Roman numerals anywhere in
72WordPerfect 9 XML: Chapter 5
your document. Counters are useful when you want to create outlines or
include paragraph numbers.
Numbering elements in XML documents involves:
defining and editing counters
specifying where you want counter numbers displayed
changing the value or numbering method of a counter
specifying where you want to increase or decrease counters
When you create a counter, the counter value starts at 1 (or A, or i). You
must manually increase (or decrease) the counter.
Defining and editing numbering levels
To organize information in a useful way, you can add numbered lists to your
XML document. You use counters to count the elements in your document
and format the numbering for the list as numbers, letters, or Roman
numerals. You can create counters with one numbering level or with several
numbering levels, such as I, i, a.
To define one numbering level
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Choose an element from the Element Rule List.
3 Click Edit, Define Counters, then click the Create button.
4 Type a name for the counter in the Counter Name box.
5 Choose a numbering method in the Single Level Method box.
To define more than one numbering level
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Choose an element from the Element Rule List.
3 Click Edit, Define Counters, then click the Create button.
4 Type a name for the counter in the Counter Name box.
Formatting XML documents
73
5 Type the number of levels you want in the Number of Levels box.
6 Type a level name and choose a numbering method for each level in the
Multi-level Definition section.
The counter number will appear in the Counter list box. You can use it to
mark the elements you want to number.
When you increase, decrease, or set a value for one level of a multi-level
counter, the value for all lower levels is reset to 1. For example, a
three-level counter has been increased to 2,4,5. When Level 1 is
increased to 3, Levels 2 and 3 are reset to 1. When all three levels of the
counter are displayed, the numbers will be 3,1,1.
You can also define counters by editing a WordPerfect template. Counters
that are defined in the WordPerfect template appear in the Counter dialog
box and can be used in element rules.
To edit counters for numbering
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Double-click an existing element in the Element Rule list.
3 Click Display, Counters, then click the Edit button.
Displaying counters used in numbering
You can decide where numbers will be displayed in your document. You
might display a counter in captions or as paragraph numbers.
To display counters using in numbering
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click Display, Counters.
4 Select a counter level from the Counter list box, then click the Display In
Document button.
74WordPerfect 9 XML: Chapter 5
Changing the value and numbering method of counters
You can change the value or numbering method (Roman numerals, numbers,
etc.) of a counter. For example, if the value of a counter in your document is
3, you can change the value to 7. When the counter is next increased, its
value will be 8.
To change the value or numbering method of counters
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click Display, Counters.
4 Choose a counter from the Counter list.
5 Click the Value button and do any of the following:
choose a different method from the Numbering Method list box
type a new value in the Value box
Changes made in the Counter Value And Method dialog box affect
counters only in the selected element, unless the selected element is the
root element in which case changes affect all elements.
Increasing or decreasing counters
You can increase or decrease the value of a counter. Common places to
increase a counter are at the beginning of sections or chapters. Increase (or
Decrease) and Display functions are independent.
To increase or decrease counters
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click Display, Counters.
Formatting XML documents
75
4 Choose a counter level from the Counter list box.
5 Click the Increase or Decrease button.
To increase or decrease and display counters
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click Display, Counters.
4 Choose a counter level from the Counter list box.
5 Click any of the following buttons:
Increase And Display — lets you increase and display the counter
Decrease And Display — lets you decrease and display the counter
If you intend to display a number with a value equal to the starting value
of the counter, you should click Display In Document button before you
increase or decrease the counter. Otherwise, the first number displayed
will have increased or decreased one from the starting value.
Deleting counters
You can delete counters that are no longer needed.
To delete counters
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click Display, Counters.
4 Choose the counter you want to remove from the Counter/Value box, then
click the Delete button.
76WordPerfect 9 XML: Chapter 5
Counter definitions defined in element rules are not deleted when you
delete a counter.
Formatting XML documents
77
WORKING WITH ELEMENTS6
Elements are specific components of a document that have been identified
and marked with SGML or XML tags. When you create an XML document,
you insert elements that are defined in the DTD. You can expand on the basic
rules defined for an element by:
specifying the root element
defining and editing the element hierarchy
adding or deleting attribute constraints
displaying attribute values
creating alias names for elements
associating a WordPerfect feature or macro with an element
inserting text with element content
copying elements
deleting, restoring, and reverting element rules
Specifying the root element
The root element is the element that validation will start from in the active
document. If you do not specify a root element, the root element defined in
the Document Type Declaration is used. You can specify a root element for
every XML document saved in a separate file.
Working with elements79
To specify the root element
1 In WordPerfect, open or create an XML document.
2 Click the XML button on the Property bar, then click Root Element.
3 Choose an element from the Root Element box, then click the Select
button.
To return to the default root element for the selected document type, click
the Original button.
Defining and editing the element hierarchy
When you define a hierarchy, you set conditions that an element must meet
in order for layout codes to be applied to the element. For example, if you
specified the element <PS> as the parent of <PARA> in the Element Rule
dialog box, the layout codes would be applied only to <PARA> elements that
occurred within <PS> elements.
To define the element hierarchy
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click the Hierarchy button.
4 Click one of the following option buttons to define what is displayed in the
Element Parents list box:
Show Parents Only — displays only the elements that are valid parent
elements of the selected element
Show All Elements — displays all the elements defined in the DTD
5 Choose an element from the Element And Parents Selected list box, then
choose a parent element from the Element Parents list box.
6 Click the Add Parent button.
If you choose the Show All Elements option button in step 4, the
WordPerfect XML Project Designer will not validate the elements you
80WordPerfect 9 XML: Chapter 6
insert as parent elements. For example, the WordPerfect XML Project
Designer will allow you to insert <BODY> as a parent element to
<MEMO> even if it is an invalid element order.
If a default attribute value has been defined in the DTD, WordPerfect
highlights the default attribute value displayed in the Element Attributes
Selected box. Otherwise, the first attribute value in the list is highlighted.
You can also choose an element in the Element Parents box by
double-clicking the element.
To edit the element hierarchy
1 In the WordPerfect XML Project Designer, choose an element in the
Element Rule List box.
2 Click Edit, Edit Hierarchy.
Adding or deleting attribute constraints
Attributes qualify the appearance or content of an element and are defined in
the DTD. You cannot add or delete attributes using WordPerfect. You can,
however, use attributes to define the context in which an element rule is
used. For example, you want the class of document to appear on the title
page of all documents that are confidential. You add an attribute constraint (or
value) to an element called status that specifies that the content of status can
be either “public” or “confidential”. When the content is confidential, you
display the document status on the title page.
To add an attribute constraint
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element
with attributes.
Choose an element with attributes in the Edit Rule List box, then click
Edit, Edit Rule.
3 Click the Hierarchy button.
4 Choose an attribute from the Element Attributes box, then click the Add
Attribute button.
5 Type an attribute value in the Attribute Value dialog box.
Working with elements
81
Attributes of the type LIST are displayed in the Attribute Value dialog box
where you can make a selection. All other attributes types must be typed
in.
To add an element, you can also click an element in the Element Rule List
box, then click Edit, Edit Hierarchy.
To delete attribute constraints
1 In WordPerfect, open or create an XML document.
2 Click the XML button on the Property Bar, then click Edit Attributes.
3 Choose the attribute you want to remove in the Attributes section.
4 Click the Delete Attribute button.
The default attribute value defined in the DTD is used when no attribute
value is specified for an element.
Displaying attribute values
You can assign and display an attribute value.
To display attribute values
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element
with attributes.
Double-click an element with attributes in the Edit Rule List box.
3 Click Display, Attribute Value.
4 Choose an attribute from the Attribute box, then click OK.
82WordPerfect 9 XML: Chapter 6
If you want to display the attribute value of a parent for the selected
element, you must first add the parent element in the Hierarchy and
Attributes dialog box. For example, if a DTD contains a <BOOK>
element with an attribute value of “Volume X” and also contains a
<CHAPTER> element, you could display the attribute value for
<BOOK>, “Volume X”, with the <CHAPTER> element. To do so, you
would first use the Hierarchy and Attributes feature to specify <BOOK>
as a parent element of <CHAPTER>.
Creating alias names for elements
You can assign user-friendly names, known as aliases, to the elements
defined in the DTD you are using. The alias names you create are saved in a
WordPerfect template.
To create an alias name for elements
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Choose an element from the Edit Rule List box.
3 Click Tools, Alias.
4 Choose an element from the Associations list box.
5 Type an alias name for the selected element in the Alias box, then click
inside the Associations box to add the alias name to the list of
Associations.
6 Repeat steps 4 and 5 to assign alias names to additional elements.
Alias names are defined once for each template, even if the template
contains multiple layouts.
The alias names you assign for elements will display in place of the
element names in the Application Bar, in Reveal Codes, in error
messages, and in the XML document. When saving an XML document,
the alias names are converted to the actual XML element name.
Associating a WordPerfect feature or a macro with an element
When you associate a WordPerfect feature or macro with an element,
WordPerfect opens the associated feature or runs the macro when you insert
an element that meets the conditions specified in the Element Associate
dialog box. For example, if you select a <BKGROUND> element and then
Working with elements
83
associate it with a Watermark, WordPerfect automatically opens the
Watermark dialog box when you insert a <BKGROUND> tag in your
document.
To associate a WordPerfect feature with an element
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Choose an element with attributes from the Element Rule List box, then
click Edit, Edit Rule.
3 Click Edit, Element Associate.
4 Choose one of the association types from the Association list box.
5 Choose the element that you want to associate a feature with from the
Element list box.
To associate a macro with an element
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Choose an element with attributes from the Element Rule List box.
3 Type the path and name of the macro or click the folder icon next to the
Macro box and locate the macro.
If you retrieve a document containing an element that meets the
conditions specified in the Element Associate dialog box, the feature will
not open nor will the macro run.
Copying elements
Instead of recreating an existing element rule, you can copy element rules
from one element to another.
To copy elements
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Choose an element from the Element Rule List box.
3 Click Edit, Copy Rule.
84WordPerfect 9 XML: Chapter 6
You can also copy an element by selecting an element in the Edit Rule List
box and clicking the Copy Rule button.
Displaying text in elements
You can create an element rule that will display text as part of the element
formatting. For example, you can create an element rule that will display the
document author’s name whenever the Author element is inserted into the
XML document.
To insert text with element content
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click Display, Text.
4 Type the text in the Text box that you want to display when the selected
element is inserted into the XML document.
Deleting element rules
You can delete element rules that are no longer required.
To delete element rules
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Choose an element from the Edit Rule List box.
3 Click Edit, Delete Rule.
Restoring element rules
You can restore up to ten element rules that you have deleted.
To restore element rules
In the WordPerfect XML Project Designer, click Edit, Undelete Rule.
Working with elements
85
You can also restore your last deletion by clicking the Undelete Rule
button on the Property Bar.
Reverting element rules
You can revert most element rules in either their start or end tags. For a list
of formatting features that you can revert, see “Overview Features that can
be reverted” on page 86. For example, the style applied to an XML document
specifies a document font size of 12 point. You insert an element that
specifies a 20 point font. When the element’s end tag is encountered, the
layout information “reverts” back to the 12 point font size.
To revert an element rule
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Do one of the following:
Click the Elements button on the Property Bar, then choose an
element.
Choose an element in the Edit Rule List box, then click Edit, Edit Rule.
3 Click in the End Tag Entries Before Revert box.
4 Click Insert, Revert.
5 Choose the feature you want to revert from the Function list box.
The Functions list box displays only those features that can be reverted
with the exception of on/off functions. On/off functions do not display in
the Functions list box but can be reverted.
Features that can be reverted
You can revert any of the formatting features in the list below in either their
start or end tag with the exception of Center Page and Columns. Center Page
cannot be turned off in the end tag, and Columns is automatically turned off
in the end tag.
For example, you can define a style in WordPerfect that applies a 12 point
font size to documents. You can then associate this style with an element
rule using the WordPerfect XML Project Designer. You can create and insert
an element that specifies a 20 point font. When the end tag of the element is
encountered, the layout information “reverts” to the 12 point font size.
86WordPerfect 9 XML: Chapter 6
You can revert the following formatting features:
counters
font appearance, size, color, and position
justification
line spacing
margins
page numbering, page style, page position, page format, and page size
underlined spaces and tabs
widows/orphans
Examples of revert
The element rule specified in the start tag for an element invokes
columns. At the end tag of the element, the columns end. Formatting
rules specified in the Rule Entry for End Tag (Before Revert) box appear
inside the columns. Formatting rules specified in Rule Entry For End Tag
(After The Revert) box appear after the columns end.
You want an element called Warning to display the title “WARNING” in a
20 point font in the color red, but you want the text of warning to display
in the font and color of its parent element. To do this, the first rules in the
Start Tag box must specify the font point size and color, and the
subsequent rule must specify that the text to insert is “WARNING”. The
last rule must specify a revert of font size and color.
Working with elements
87
EDITING XML DOCUMENTS7
When you edit an XML document, you can
display the XML content model in order to better understand the
structure of elements
use the XML Tree to edit documents
edit element attributes
rename elements
find and replace elements, tags, or text
insert text and file references to reference information that is external to
the current XML document
You can also use the power of the WordPerfect writing tools to check spelling
and correct typing errors automatically with QuickCorrect.
Displaying the XML content model
The content model displays an interpretation of the items the selected
element can contain (similar to the original content model defined in the
DTD). The content model shows the XML group connectors and occurrence
indicators for the selected element.
To display the XML content model
1 In WordPerfect, open or create an XML document.
2 Click the XML button on the Property Bar, then click Content Model.
Editing XML documents89
If you have specified an alias file that contains alias names for the
elements in the current WordPerfect template, the alias names will appear
in the content model.
You can also access the XML Content Model by right-clicking the XML
Tree and clicking Content Model.
Using the XML Tree to edit documents
You can quickly edit document elements using the tree view which shows a
page view of the document on one side and a structured document view on
the other.
To use the XML Tree to edit documents
1 In WordPerfect, open or create an XML document.
2 Click the XML button on the Property Bar, then click Show XML Tree.
3 Right-click on an element in the XML Tree window to access menu
commands for editing.
You can also display the XML Tree by clicking the XML Tree button.
You can also double-click on an element in the XML Tree to edit its
attributes.
Editing elements and attributes
Elements are specific components of a document that have been identified
and marked with SGML or XML tags. Attributes qualify the formatting and
content of an element. You can define attributes that:
specify formats such as font style or justification definitions
specify what the content of an element should be. For example, an
attribute could specify that the content of the element status be either
public or confidential.
You can edit elements by renaming elements or by copying an element rule
from one element to another. You can also change the attributes associated
with an element. To make it easier for you to edit elements and attributes,
you can search for elements, tags, or text. You can also perform an automatic
search and replace to quickly replace elements, tags, or text.
90WordPerfect 9 XML: Chapter 7
Editing element attributes
You can use the XML Tree to quickly locate the element you want to edit. An
element with attributes can be easily identified by the plus sign that follows
the element name. Click on the plus sign to display the associated attributes.
To edit an element attribute
1 In WordPerfect, open or create an XML document.
2 In the XML document, position the cursor after the element for which you
want to edit attributes.
3 Click the XML button, then click Edit Attributes.
4 Choose an attribute from the Attributes section.
5 Click the Edit Value button, then do one of the following:
Choose a value from the list if the attribute you selected is of the type
List, Entity, or Entities
Type a value if the attribute is of any other type
6 Click one of the following buttons:
Click the OK button if the attribute is not of the type List, Entity, or
Entities. The attribute value is validated when you click OK.
Click the Select button for any other type of attribute.
To delete an element attribute
1 Follow steps 1 to 4 from the above procedure.
2 Click the Delete Attribute button.
Renaming elements
In SGML, you can rename elements provided that the new name has been
defined in the DTD. In XML, you can rename elements to make the name
more meaningful without the new name being defined in the DTD.
To rename elements
1 In WordPerfect, open or create an XML document.
2 Position the cursor after the start tag for the element you want to rename.
3 Click the XML button on the property bar, then choose Element Edit.
4 Type a new name for the element in the Element box.
Editing XML documents
91
Applying a rule to another element
You can apply an element rule to another element by renaming the rule.
To apply a rule to another element
1 In the WordPerfect XML Project Designer, open or create an XML
project.
2 Choose an element from the Element Rule List box.
2 Click Edit, Rename Rule.
3 Choose an element from the list box, then click OK.
You can also rename an element by clicking the Rename Rule button on
the toolbar.
Finding and replacing elements, tags, and text
In WordPerfect, you can search for
start tags or end tags
marked sections
processing instructions
an element with specific attributes or a specific attribute value
You can also search for the following codes:
entity references (shown as XML Entity Ref in the Codes dialog box)
character references (shown as XML Char Ref in the Codes dialog box)
marked sections (shown as XML Mrk Sec On and XML Mrk Sec Off in the
Codes dialog box)
processing instructions (shown as XML Proc Inst On and XML Proc Inst
Off in the Codes dialog box)
WP DATA (shown as XML WP Data On and XML WP Data Off in the
Codes dialog box)
Using WordPerfect, you can find and replace text in your XML documents.
Finding start tags or end tags
You can locate elements by searching for their tags. WordPerfect searches for
the start or end tag of the element closest to the cursor.
92WordPerfect 9 XML: Chapter 7
To find an element’s start or end tag
1 In WordPerfect, choose an element in the XML Tree or position the
cursor in the XML document.
2 Right-click in the XML Tree, then click Find Start or Find End.
Finding specific codes
You can search for a variety of XML codes. For a list of codes, see “Finding
elements tags or text” on page 92.
To find specific codes
1 In WordPerfect, open an XML document.
2 Click Edit, Find And Replace.
3 Click Match, Codes.
4 Choose the type of code you want to find from the Find Codes box.
5 Click the Insert And Close button.
6 Click the Find Next button.
To display only merge codes in the Find Codes box, enable the Display
Merge Codes Only check box.
Finding and replacing text within elements
WordPerfect allows you to search for text within specific elements.
To find and replace text within elements
1 In WordPerfect, open or create an XML document, then click Edit, Find
And Replace.
2 Type the text you want to search for in the Find box.
3 Type the text you want to use as a replacement in the Replace With box.
4 Click Match, Elements.
5 Enable the Use Match Element Conditions To Limit The Find check box.
6 Enable one of the following buttons:
Listed Element Order — searches for text within elements in the
order the elements are listed in the Elements To Search In boxes
Editing XML documents
93
Any Listed Element — searches for text within all elements
7 Choose an element in which you want to search for text from the
Elements to Search In text box.
8 If you want to exclude an element from the search, choose an element
from the Elements To Ignore text box.
9 Repeat step 7 or 8 until you have specified all the elements you want to
include or exclude.
Using text and file references
When you want to reference information external to the active XML
document, you can use either text or file references.
You use file references to link information in external files to an XML
document. These files are referred to as external entities. External entity
references can specify graphics, non-XML data, or other types of external
data.
Some document type definitions (DTDs) define external entity references so
that any document using that DTD can access the same resources.
You can also define external entity references for use only with the current
XML document. These user-declared external entity references might
specify graphics, charts, sound, or video used in that particular document.
You can specify data attributes for the specified notation when you are
creating or editing a file reference (also called an external entity). You can
also edit a notation attribute value.
Using WordPerfect 9, you can
insert text references
create and insert file references
edit or delete file references
use notations
Inserting text references
You can insert text references that consist of text, processing instructions, or
specific character data.
To insert text references
1 In WordPerfect, open or create an XML document.
2 Click the XML button on the Property Bar, then click Text References.
94WordPerfect 9 XML: Chapter 7
3 Click one of the following buttons:
Text — displays existing text references in the Text Reference box
Processing Instruction — displays existing text references that consist
of processing instructions in the Text Reference box
Specific Character Data — displays existing text references that
consist of specific character data in the Text Reference box
4 Choose a reference in the Text Reference box, then click the Insert
button.
Character mappings are not displayed in the text reference listing.
If no entities of a selected type have been defined in the document,
document type, or WordPerfect template, the Text Reference box is
empty.
Creating and inserting file references
File references link information in external files to an XML document. File
references can be defined in the DTD or created by the user. When you
define a file reference, you can define a Public Identifier, a System Identifier,
or a path and filename.
To create file references
1 In WordPerfect, open or create an XML document.
2 Click the XML button on the Property Bar, then click File References.
3 Click the User Declared button in the Reference Type section, then click
the New button.
4 Type a name for the reference in the Name box.
5 To include a public identifier, type the public identifier in the Public ID
box.
6 To include a path and file name, click the folder icon next to the File Path
box, then locate the external entity file.
7 Choose a data type from the Data Type list box to specify what the entity
will contain.
NDATA, SDATA, and CDATA are allowed only if the document type you
have selected contains at least one notation.
Editing XML documents
95
8 If you specified NDATA, SDATA, or CDATA as the data type, choose the
notation name from the Notation list box.
9 If the Notation name you choose has attributes defined for it, click the
Attributes button to specify attributes for the Notation.
If there is not a corresponding external entity declaration in the
document, document type, or WordPerfect template, file references are
not validated.
XML uses public identifiers to distinguish an entity for a receiving
system. A public identifier is a label that identifies an entity to a receiving
system without including the path and filename of the entity on that
system.
To insert file references
1 In WordPerfect, open or create an XML document.
2 Click the XML button on the Property Bar, then click File References.
3 Click one of the following option buttons in the Reference Type section:
All — displays all file references
User Declared — displays only file references that have been defined
by the user
DTD Declared — displays only file references that are defined in the
DTD
4 Choose a reference from the File Reference box, then click the Insert
button.
If no entities for the reference type you selected have been defined in the
document, document type, or WordPerfect template, the File Reference
box is empty.
Editing and deleting file references
You can edit a file reference when you want to change the information to
which the document is linked or delete file references when you no longer
want information linked.
96WordPerfect 9 XML: Chapter 7
To edit file references
1 In WordPerfect, open or create an XML document.
2 Click the XML button on the Property Bar, then click File References.
3 Click the User Declared option button in the Reference Type section,
choose a reference from the File References box, then click the Edit
button.
4 Do any of the following:
To edit the name of the file reference, click in the Name box
To include a public ID, type the public identifier for the file reference in
the Public ID box
To include a folder on your hard drive or on a network drive, click the
folder icon next to the File Path box, then locate the external entity
file.
5 Choose a data type from the Data Type list box to specify what the entity
will contain. NDATA, SDATA, and CDATA are allowed only if the
document type you have selected contains at least one notation.
6 If you specified NDATA, SDATA, or CDATA as the data type, choose the
notation name from the Notation list.
7 If the Notation name you choose has attributes defined for it, click the
Attributes button to specify attributes for the Notation.
XML uses public identifiers to distinguish an entity for a receiving
system. A public identifier is a label that identifies an entity to a receiving
system without including the path and filename of the entity on that
system.
To delete file references
1 In WordPerfect, open or create an XML document.
2 Click the XML button on the Property Bar, then click File References.
3 Click the User Declared option button, then choose the reference you
want to delete from the File Reference box.
4 Click the Delete button.
Editing XML documents
97
Using notations
Notations are defined in the DTD. They are used to identify the type of data
contained in an external entity.
If the notation declaration has attributes defined in the DTD, you can specify
data attributes for the selected notation when you create or edit file
references. You can also edit a notation attribute value.
To specify an attribute value for a notation
1 In WordPerfect, open or create an XML document.
2 Click the XML button on the Property Bar, then click File References.
3 Click the User Declared option button in the Reference Type section, then
click the New or Edit button.
4 Do the following:
Type a name for the file reference in the Name box.
Choose a data type from the Data Type list box.
Choose a notation from the Notation list box.
5 Click the Attributes button.
6 Choose an attribute from the Error/Present/Attributes box, then click OK.
7 Double-click an attribute in the Attributes list.
A check mark indicates that the attribute is selected.
8 Repeat step 7 to choose additional attribute values.
To edit a notation attribute
1 In WordPerfect, open or create an XML document.
2 Click the XML button on the Property Bar, then click File References.
3 Click the User Declared option button in the Reference Type section.
4 Choose a file reference in the File Reference list, then click the Edit
button.
5 Click the Attributes button, then choose an attribute in the
Errors/Present/Attributes box.
6 Click the Edit Value button.
7 Type a value for the attribute, then click the OK button to return to the
Data Attributes dialog box.
98WordPerfect 9 XML: Chapter 7
WORKING WITH TABLES,
MACROS, AND GRAPHICS8
Tagging tables
Automatic table tagging is a powerful and useful XML feature. If you have a
lot of tables in your document, you can save time by not marking up tables
manually.
To tag tables automatically, you must include one of the table types
WordPerfect supports in your DTD. WordPerfect includes table DTD
fragments that support the following types of markup:
Association of American Publishers (AAP)
Defined by the AAP in Markup of Tabular Material, part of the Electronic
Manuscript Series designed for use with the American National Standard for
Electronic Manuscript Preparation and Markup.
Computer-aided Acquisition and Life-Cycle Support (CALS)
Defined by the CALS initiative of the U.S. Department of Defense in military
specification MIL-M-28001A.
WordPerfect Table Tagging Method
WordPerfect DTD that supports tables created using WordPerfect 5.1, 6.0,
6.1, 7, 8, and 9.
Working with tables, macros, and graphics99
HTML
Defined by Netscape as extensions to the HTML 2.0 DTD.
If more than one table model is supported by a given DTD, WordPerfect
searches for the table model in the following order and uses the first table
model it finds, ignoring all others.
1 WordPerfect 6.x to 9
2 WordPerfect 5.x
3 CALS
4 AAP
5 HTML 3.2
The following table DTD fragments and the HTML DTD are included with
WordPerfect. The HTML DTD contains a table fragment that can be used in
other DTDs.
DTDExplanation
Aap_tbl.dtdDefined by Association of American Publishers (AAP).
Cals_tbl.dtdTable type defined by the Cals.dtd.
Cals_xml.dtdCALS table information considered relevant by the SGML features of
WordPerfect 9.
Wptable.dtdSupport for WordPerfect 5.x-level tables.
Wp60tbl.dtdFull-featured table DTD designed to work with WP 6.x, 7 and 8 tables.
Wp60min.dtdSimplified version of Wp60tbl.dtd.
Html_tbl.dtdHTML 3.2 level DTD that contains a table fragment that can be used in
other DTDs.
Tagging elements automatically using macros
You can also save time by using macros to automate document tagging. For
example, you might create a macro that searches for a style, selects the style
and its contents, and then inserts the <TITLE> element around the
selected text.
Working with graphics
You can insert and edit graphics just as you would in a word-processing
environment. You can also associate a graphic with an element using the
WordPerfect XML Project Designer.
100WordPerfect 9 XML: Chapter 8
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.