XML in WordPerfect 9: A Developer's View

May 31, 2000

Michel Rodriguez and Greg Kohn


One of the most annoying problems with XML (and SGML before it) is the lack of editors/word processors supporting it. Sure, Emacs+PSGML fits the bill, but would you let people familiar with traditional office suites or word processors use it? The remaining options are a few pieces of Java software, Adobe's FrameMaker+SGML (at $1499 a pop), or the even pricier Adept from ArborText. In other words, unless you have a healthy budget or an inclination to fiddle with things technical and complex, XML and its cosmic potential are likely to pass right by. The lack of XML editors impedes one of XML's main goals: cross-platform, cross-application functionality.

Corel's WordPerfect 9, which offers full, open XML/SGML support, promises to bring the power of XML to the masses. Bundled with the WordPerfect Office 2000 suite, which also includes Quattro Pro (also with XML support), Paradox, and a bunch of other useful applications, the most alluring feature of WP9 is its bargain-basement $150 price tag. Not to mention the suite runs on PC and Linux. Looks hopeful!

In this article we examine the XML support in WordPerfect 9, both from the point of view of a developer who needs to set up the XML environment (i.e., the style sheet), and of a user -- an editor who uses both SGML and non-SGML word processors.

We should note that prior to writing this article, neither of us had had much prior experience using WordPerfect, our usual publishing environment being FrameMaker+SGML (and vi!).

A Developer's View

The bad news first. Two things are really annoying when trying to set up an XML environment for WordPerfect: the documentation is very thin, and WordPerfect keeps crashing.

Now for the good news. Style sheet development is somewhat crude but effective, especially when starting from one of the several templates that come with the software.

Although not as powerful as FrameMaker or Adept Editor, WordPerfect 9 is a great tool in which to quickly set up an editing environment robust enough to handle simple to moderately complex XML documents.


WordPerfect's documentation is appalling. Actually, the lack of documentation is appalling!

Many of the features in the software are barely mentioned in the manuals or in the online help. And out of the 1170 pages of the WordPerfect Office 2000 Bible, exactly six pages (including four screen shots) are dedicated to XML. I will admit that the last words of those six pages were worth the effort: "For more information see the Corel Reference Center." The Reference Center, it turns out, is a well-hidden item in the Set-up and Notes menu created at install. This menu provides access to a whole manual dedicated to WordPerfect and XML. The problem is that it gives you all the obvious information that you can figure out on your own--I had already found out how to assign a style to an element--but gives no details on any advanced features (or bugs). For example, what is the difference between the two types of end tag rules for an element?

The only effective support resources I have found are the Corel newsgroups, especially the Corel WordPerfect Suite - SGML one (although it's hosted on a Corel news server not mirrored by many ISPs, making access difficult).


WordPerfect keeps crashing.

Increasing the amount of RAM on my computer from 32 Mb (the minimum recommended) to 158 Mb did not help, unfortunately. Actually, WP9 works just fine (except for the crashes!) with only 32 Mb on a K2-400.

Three service packs can be obtained from the Corel web site (the last one, SP3, includes all fixes and weighs in at a hefty 79 Mb), but neither do these do much to improve the robustness of the software.

The upside is that the crashes are mostly just annoying and never show-stoppers; they never prevented me from ultimately doing what I wanted to do. Once you've learned (usually the hard way!) how to "save early and often," as well as how to use the handy "move the insertion point to the previous position" arrow to go back to your previous place in the document (click on it twice after a save), you shouldn't lose too much work.

One good thing is that the crashes tend to be consistent. If the software crashes during an operation, it will crash as many times as you repeat the attempt. Crashes can happen at any time, especially when inserting or deleting text. For some reason, WP9 seems to especially dislike inserting a title (in HTML-like DTDs) just before another title. The solution is nearly always to repeat the operation somewhere else in the document, and then cut and paste the text at the appropriate place. Or, better yet, to save and reload the document when the formatting goes wild!

Creating an XML Project

To edit XML documents you need to create an XML project, which consists of a DTD and a template.

Using a DTD makes sense in a word processor. After all, how could you apply a style to an element if you don't even know it exists? For flexibility, however, WordPerfect gives you the option of using tags that do not appear in the DTD (just type the name of the tag in the box at the top left of the screen), enabling you to adjust the DTD later.

After you compile the DTD and specify the template file, you can then edit the template using a tool called the XML Project Designer. A nice feature of this tool is that you can even call it up from within WordPerfect as you are editing a document. This is quite convenient, and makes interactive development rather smooth, at least when compared to the "open EDD, fix, check, save, import in document" cycle of FrameMaker.


The XML Project Designer lets you create rules for each element in the DTD, which trigger formatting actions when a start tag or end tag is found.

A rule can be applied to an element in context by specifying the hierarchy above the element and/or attribute values that trigger the rule. A rule can also be applied to only the first of a series of elements of the same type.

For each rule, you can define exactly which WordPerfect codes will be inserted with the start and end tag of the element. The WordPerfect codes include all formatting options, regular text, attribute values, and counters. While editing, you can view those codes using the ever-popular "Reveal Codes" option, which is very handy while writing the template.

WordPerfect supports a wide range of special elements -- equations, graphics, tables, two types of footnotes, headers, footers, and watermarks -- that can be associated with XML elements. The range of table models supported is good, including AAP, CALS and HTML tables, as well as WordPerfect's own model. There is no way to format other elements as tables, though.

Other options available in templates include defining WordPerfect macros that will be triggered when an element is inserted. Additionally, the Project Designer allows aliases to be created so that the user never sees the actual tag names. I have never liked that kind of feature, which inevitably leads to misunderstandings between users and developers, but it is there if you want it.

Overall, the Project Designer is quite easy to use. Except, of course, if you are not familiar with WordPerfect. It is then that some of the formatting options are difficult to find, such as having to go to Format->Style->Edit then Format->Paragraph->Format to change the indentation of a style.

WordPerfect definitely does not scale for complex DTDs. Rules are edited through a GUI and simply stored in alphabetical order, which makes it much harder to maintain than when they are stored in an editable file. Plus there is no flexibility in expressing the hierarchy of elements that triggers a rule: to apply the same formatting for a title whether in a <body_clause>, a <definition_clause>, an <accronym_clause>, or a <bibiography_clause>, you will have to duplicate the rule four times. Worse, there is no way to give a depth level for a rule to be triggered, or alternatives in the hierarchy. So if you want to specify a formatting for titles of level 3 regardless of the kind of clause they are in, you will have to write 64 rules!

One last piece of advice: as with FrameMaker+SGML, I found it beneficial to stay away from character and paragraph styles, preferring instead to insert the formatting codes in the template (the EDD in FrameMaker) so that all the formatting information was kept in one place.

WordPerfect XML Project Designer
Figure 1: The WordPerfect XML Project Designer

Putting WordPerfect to Work

Our tests included porting a subset of a fairly complex DTD and style sheet (the IEEE Standards DTD) to be used to create drafts of documents that will be later edited and output using FrameMaker+SGML, creating style sheets for HTML-based DTDs and, naturally, writing this article using the XMLNews DTD that comes with WordPerfect.

One of the easiest ways to create a new XML document type is to use the HTML DTD as a basis, as WordPerfect includes a template for HTML 3.2. Just copy the DTD and the template, add your own tags, create an XML project, recompile the DTD, add rules for the new tags... et voila! This is really easy, and a great way to use WP9 since most of the formatting is already done and the DTD is quite simple.

I was even able to use the XHTML 1.0 transitional DTD, plus the associated entity definition files, in which I replaced the PUBLIC identifiers by SYSTEM ones.

When it comes to using a more complex DTD, though, the results are less impressive. As noted above, it is very difficult to manage the number of rules needed to implement the formatting required. The lack of power in describing the context in which a rule is triggered made it impossible to generate the formatting we needed. So we had to settle for writing a style sheet for a subset of the original, sometimes only approximating the result we could get in FrameMaker+SGML. In hindsight this is probably the most sensible way to use WordPerfect: a rather cheap XML editor with limited display capabilities.

To summarize, the XML Project Designer is quite easy to use and a convenient tool with which to create (or update) templates for simple DTDs with a limited number of elements and a simple hierarchy. For more complex tasks it can be used a tool to create XML documents and print drafts.

One last note: WordPerfect comes with a handful of DTDs: CALS, Docbook, HTML 3.2, TEI Lite, and XML News. Of those only HTML and XML News have templates. I have not been able to even compile the Docbook 3 DTD! I really would have liked to see a style sheet for that huge DTD!

XML in WordPerfect 9: A User's View

Getting Around

From a user's point of view, the XML features of WP9 are fairly straightforward and easy to use. Perhaps the best part is that there's no set up needed to use the application, as there is in FrameMaker+SGML (which requires a techie to set up the file structure, the EDD, and so forth). With WP9, the XML is ready to go right out of the box.

Things get a bit more complicated when you start introducing personalized XML files, DTDs, and style sheets. WP9 uses an oversimplified "project creator" to walk users through setting up and opening new and existing XML documents. While the typical user can navigate this exercise without ever consulting the user's manual (which you probably want to avoid anyway), things get a bit hairy when something goes wrong (such as if the style sheet won't open with the XML file). In our experiences and experiments we found that, if using personalized XML components, it can save some aggravation on the back end to first compile the DTD. Doing so entails a journey through the bowels of Windows to find the WordPerfect XML Project Designer utility, but it's worth it. The compilation process associates the DTD with a WP style template (or style sheet). Once the DTD is compiled on your system, most other problems are, we found, minimized.

One neat benefit of the "project creator" feature is that it allows the user to permanently set XML project names. For instance, I compiled our DTD and style template, and called that project "StdsPubs." Now whenever I want to use that specific template and DTD, I just choose "StdsPubs" from the list of projects and -- bingo -- I'm ready to edit XML.

The Look and Feel

Despite its simplicity, at least compared to Adept or FrameMaker, WP9 has all the tools you need to create and work with XML files. Best of all, most of these tools are logically arranged and easily accessible. Where FrameMaker+SGML uses different windows for each facet of SGML/XML (a window for elements, a window for the tree view, a window for attributes, etc.), WP9 presents all that information on one simple screen. By default, the program positions the XML tree to the left of the text. The size of the tree view, however, can easily be reduced or increased, or closed altogether. Rather than interspersing XML functions among regular word-processing functions (as Frame does), WP9 nicely separates them. Access to all XML tools rests comfortably within one pull-down tool menu. Plus there's the XML toolbar that sits neatly beneath the regular word-processing toolbar. Carefully arranged, the toolbar gives quick access to the features you need most often, including a pull-down menu for elements (a huge plus!). As in most of the other XML editors, the tree view is particularly helpful. The program marks in the tree exactly where you are in the document, and marks any errors with a bright yellow warning marker. It even gives you a pull-down menu list of valid elements or attributes if it has determined one is needed at that point. The only missing feature really is Merge Elements -- as it is you have to cut-and-paste the content of the second element in the first one.

WordPerfect Main Screen
Figure 1: WordPerfect's Main Screen

Another advantage of the WP9 XML editing environment is that it sits atop the traditional WordPerfect word processor. That means the user has access to all of the nifty features of WP9, plus its XML functionality. Its SGML/XML capabilities notwithstanding, WP has long been considered superior to Word as a word processor, though poorly marketed. One obvious attraction of the WP editing environment is that it doesn't try to automate each task you perform, and instead yields control to the user (nor does it have that annoying dancing paperclip!). For anyone who has had to suffer through the quirks of Word for any extended period of time, end user control is a very good thing.

Special Characters

Special characters or symbols have historically posed problems for editors and XML technicians alike. WP9 solves that problem by offering great Unicode support. In FrameMaker, for instance, accented characters would need to be converted to an entity, meaning additional external documents linked to the SGML file. WP9 simply inserts the Unicode character and moves along. (It is unfortunate, however, that the option to insert a character reference seems to work only for ASCII characters.) While Unicode on its own is a nice feature, the real marvel is the interface through which WP9 lets you select the special characters you need. At last those stubborn and antiquated KeyCaps and Character Map menus are passé--WP9 uses a pop-up window that organizes the special symbols and characters by genre (such as Greek, math, or Japanese) rather than by font. The symbols are presented in a large-point type, with the Unicode characters coded in red. Adding symbols and special characters -- and ensuring that they transport from platform to platform -- has never been so convenient.

Style Matters

Although designing the WP9 XML style sheet can be an exercise in frustration, WP9 has been designed to give the user unprecedented control over the look and layout of an XML document. Unlike FrameMaker, where the style template sits frozen behind the actual SGML or XML document, the style template in WP9 can be tweaked and adjusted on the fly. For instance, if the user wants to add an extra new line between each paragraph, that change can be made -- by the user -- directly in the style sheet. This is a terrific benefit for anyone who wants to use an XML document for traditional print, where minute style details (such as the amount of space between list items) are critical. Giving style control to the end user also frees the XML technician (i.e., the style sheet designer) from having to anticipate every nuance of style that might arise within a document or body of documents. The user, for example, can create a slightly different style sheet for each XML document, which will ensure that each time the document is opened with that style sheet, the document will look exactly as formatted. (In FrameMaker, on the other hand, cosmetic adjustments to the documents, such as extra spacing, are lost once the document is closed.)

The danger of an active XML style sheet, of course, is that an end user can make global and significant changes without really being aware of what they've done. Sure, WP9 queries the user if they want to save changes made to the style sheet once changes have been made, but the program doesn't keep track of what's been changed, or what parts of the XML document were affected by the changes. At the very least, it is a recommended practice to keep a copy or two of a master style sheet safely tucked aside so that the original styles can be restored as needed.


Overall the XML features of WP9, at least from an end user's perspective, are comprehensive and easy to use. That's terrific news for anyone seeking to amble into XML without first delving deep into their pockets for a pricey editor. For a mere $150, you get the ability to exchange files near-flawlessly with top-end applications such as ArborText's Adept and Adobe's FrameMaker+SGML. Sure, you don't get as much bang for your buck, and you only get a word processor as opposed to a desktop publisher, but WP9 will surely meet the needs of less intricate XML ventures. For instance, a small weekly newspaper could buy several copies of WP9 and, within hours, have all of its writers generating clean XML by means of the XMLNews DTD.

WordPerfect seems especially appropriate for editing documents using an HTML-based DTD, which it can print or publish to PDF so that they can then be easily served on the web.

But as much as we're impressed with the XML capabilities of WP9, we're proceeding with caution. While WP9 is an efficient and affordable XML editor, it is hardly poised to take on the world. For starters, WP9 is not Corel's meal ticket; Linux is. Therefore, much of the company's marketing and developing efforts (and, it certainly seems, its technical writing staff) are put toward its Linux initiatives, with WP serving as an auxiliary money-maker. But at $150 a unit, maybe that's OK.