In Chapter 1, you got an introduction to a few graphical editors [Hack #6]. This hack provides more highlights on how to edit documents using the graphical editor <oXygen/> (http://www.oxygenxml.com/). I have chosen <oXygen/> because it runs on multiple platforms, is inexpensive (it has a free trial and its license is less than $100 USD), and offers many useful features.
Figure 2-1 shows <oXygen/> editing time.xml and valid.xml, both part of the project time.xpr. Note the project pane (upper left) and the tabs above the document pane. The lower-left pane shows an outline view of valid.xml (note that the hour element is highlighted in both the outline and document panes). Beneath the document pane is a tabbed pane that shows the result of a transformation of valid.xml with XSLT.
Like any editor, <oXygen/> allows you to do normal editing tasks, such as undo and redo, spell check, and so forth. Here is a list of some of <oXygen/>'s more important features.
<oXygen/> can organize files into groups called projects (see the File menu). These projects can be named and saved in simple XML project files that have an .xpr file extension. All the files in a project can be validated in one fell swoop. When you reopen a project, it remembers some state information, such as what file was last opened and whether it had focus.
<oXygen/> provides
templates for creating XML documents in a variety of vocabularies:
DocBook, SMIL, SVG, TEI, VoiceXML, WML, WSDL, and XHTML, to name but
a few. It also has syntax highlighting, which can be edited under
Options Preferences
Colors. Syntax highlighting
works not only for XML, but also batch files, C, C++, DTD, Java, PHP,
RNC, SQL, and shell. The Xml
Format and Indent command
quickly formats your XML to make it more readable. An outline pane
allows you to highlight the structure of a document by selecting an
item in the outline, and with the click of a button, you can lock
elements so that they cannot be edited, although element content
still can. The Tree Editor is a fully graphical landscape for
inserting or adding XML structure by merely clicking buttons. File
Save to URL allows you to save a document on the Web using
FTP/WebDAV.
<oXygen/> has a
well-formedness checker (Xml Check document form), and can
validate against a DTD or XML Schema (Xml
Validate
document), RELAX NG?both XML and compact versions (Xml
RELAX NG validation)?and even Namespace Routing
Language (Xml
NRL validation; see also http://www.thaiopensource.com/relaxng/nrl.html).
A special command provides a quick way to associate a schema with an
instance (Xml
Associate schema). Because RELAX NG does not
have its own method for associating schemas, <oXygen/> uses its
own processing instruction [Hack #3] that appears as follows:
<?oxygen
RNGSchema="file:/C:/Hacks/examples/time.rnc"
type="compact"?>. Schemas can be local or
across the Web. You can generate documentation about your schemas,
too.
<oXygen/> offers several
built-in XSLT processors. You can create and name a variety of
transformation scenarios (Xml Create transformation
scenario), and include parameters with the command as well as insert
headers and footers for output. These scenarios can be imported and
exported (Options
Import transformation scenarios and
Options
Export transformation scenarios). <oXygen/>
has a built-in XSL-FO processor (FOP) with PDF, PostScript (ps), or
text output. You can also specify output be sent to a browser or
saved in a file (you can choose to be prompted for a name).
Transformation results are displayed in tabbed panes and can be saved
in files. <oXygen/> can also evaluate XPath paths to see if
they exist in a given document (with the results shown in a tabbed
pane).
<oXygen/> provides an interface to James Clark's Trang conversion tool (http://www.thaiopensource.com/relaxng/trang.html). Trang is a handy tool that can accept a DTD, a RELAX NG schema in XML or compact syntax, or an XML document as input, and then output a DTD, a RELAX NG schema (XML or compact), or an XML Schema.