In this lesson, you will create a letter in XML using the WordPerfect XML Editor. The letter will be based on the letter.wpt template you created in lesson 2.
In this lesson, you'll
explore the WordPerfect XML Editor
create a new XML document
insert elements
insert text
You'll need about 40 minutes to complete this lesson.
Exploring the WordPerfect XML Editor
You create, open, edit, and save XML documents using the WordPerfect XML Editor. The WordPerfect XML editing environment is an extension of the familiar WordPerfect word-processing environment. An XML-specific Property bar and XML-specific menu commands are available only within the WordPerfect XML editing environment.
To learn about the elements of the WordPerfect XML Editor window
Click any of the elements in the picture below.
and are visible in the XML Tree window. You can double-click error message icons for more information about the error.
A visual representation of where a graphic appears in the document also appears in the XML Tree window as .
You can move and size the XML Tree window.
WordPerfect XML Editor window
You work within the WordPerfect XML Editor window to insert elements, text, tables, and graphics into XML documents.
Inserting elements and text into an XML document
After you exit the wizard and complete the process of creating a WordPerfect template, WordPerfect opens a blank XML document in the WordPerfect XML editing environment with the default XML Property bar.
Before you type the text of the letter, you must insert element tags. The WordPerfect Auto-Insert feature automatically inserts all the required elements defined in the DTD into your XML document . Any element defined as optional in the DTD is not automatically inserted. The generic layout created in lesson 2 presents the element tags in a more readable display.
To insert elements
1. In WordPerfect, click the XML button on the property bar, then click Elements.
2. In the Elements dialog box, click the Valid Elements option button.
The Valid Elements list shows the elements that can be inserted at the current point in the document.
3. Click the Insert button to insert all valid elements defined in the WordPerfect template into the blank XML document.
4. When the Edit Attributes dialog box appears for the tag Salutation, click the Edit Value button.
5. In the Attribute Value box, choose Miss, then click the Select button.
A checkmark appears in the Present column beside the attribute name title.
6. In the Error\Present\Attribute Name box, choose Surname, then click the Edit Value button.
7. In the Value box, type "Smith", click the OK button, then click the Close button to close the Edit Attributes dialog box.
Note
To begin a new XML document based on the template created in Lesson 2, use the File, New From Project command in WordPerfect.
Tip
To insert elements, you can also use the Valid Elements list box on the property bar or the Valid Elements command (by right-clicking in the XML document).
To insert text
1. Position the cursor between the Company Name start and end tags, then type "Corel Corporation."
2. Position the cursor between the element tags below and type the corresponding text.
Element Text
Street 1600 Carling Avenue
City Ottawa
Region Ontario
Para We received payment in the amount of 275 for the following items. It is a pleasure doing business with you. If there is anything else that you require, please feel free to contact me.
Adieu Yours sincerely
Author Alexander Day
3. Position the cursor before the end tag for Address. Notice that the Valid Elements list box on the Property bar shows Postal Code as a valid element at this point in the document. Postal Code was not inserted automatically into the document because it is defined as an optional element in letter.dtd.
4. From the Valid Elements list box on the Property bar, choose Postal Code.
5. Position the cursor between the Postal Code start and end tags, then type "K1Z 8R7".
Click here to see what the document should look like at this point.
Inserting a symbol
XML is based on the Unicode character set. All symbols are already mapped, so there is no need to define an external entity reference in the DTD for most symbols.
To insert a symbol
1. In the XML document, position the cursor in front of "275."
2. Click the Insert menu, Symbol.
3. From the Set button, choose Typographic Symbols.
4. Choose the symbol for the British Pound (number 4,11).
5. Click the Insert And Close button.
Saving an XML document
XML documents are validated by default when you save them.
To save the XML document
1. Click the File menu, Save.
2. In the File Name box, type "letter," then click the Save button.
3. In the Save As XML dialog box, click the OK button to accept the default settings for saving.
4. In the XML Validation dialog box, click No.
5. Click the File menu, Close to close letter.xml.
Summary of Lesson 3
In this lesson, you learned about
the WordPerfect XML Editor
creating a new XML document
inserting elements
inserting text
In Lesson 4, you'll create a document layout for the letter by formatting elements using the WordPerfect XML Project Designer.