Authoring, Validating, Viewing, and Transforming XML Documents
- Authoring Documents
- Validating Documents
- Viewing Documents
- Transforming Documents
This article discusses some of the things that can be done with an XML document, and some of the tools that can do them. The lists of tools and products are by no means exhaustive.
Authoring Documents
Although many applications involve XML that is generated automatically (for example, the body of a SOAP message), there are at least as many instances in which the document is authored and maintained by a human being.
Text Editors
With the proliferation of massive Integrated Development Environments (such as Microsoft Visual Interdev and Borland's JBuilder 4.0), it is amazing how much can be accomplished with a lowly text editor. Unlike a sophisticated programming language with a large runtime library, an XML document has relatively few syntax structures to memorize. Without the need for online help and syntax completion, a simple text editor can provide a perfectly viable tool for writing XML documents. These are a few text editors you might consider:
Notepad (shipped with Windows)Really a terrible editor, but it is ubiquitous.
WordPad (shipped with Windows)Better than Notepad, but still not great for structured text editing.
SlickEditA commercial programmer's editor. Has many features for integrating with software development processes (compilers, linkers, make programs, and so on). Good but expensive.
UltraEditA really good shareware editor with plenty of features for indentation, tab and space handling, and syntax highlighting.
For the record, all the XML sample documents in Strategic XML were written using UltraEdit. It has tons of features, is very inexpensive, and loads quickly (in under three seconds on my system).
WYSIWYG XML Editors
The idea of a what-you-see-is-what-you-get (WYSIWYG) XML editor might seem to be an oxymoron. XML is not intended to be a presentation format, so what exactly does a WYSIWYG editor show you? In most cases, the high-end commercial editors are capable of displaying an XML document as a freeform prose view with embedded tags. The lower-end and freeware products usually provide only a tree view, showing nested tag relationships. These are some advanced features to look for:
Integrated stylesheet editing (CSS and/or XSL)
DTD and schema editing
Good import/export facilities to nonXML data sources
A few dedicated XML editors available today are listed here:
XML NotepadA freely available tree-based XML editor. Awkward interface, but it's free.
XMetaLFrom the same company that produced HotMetal (a WYSIWYG HTML editor), now owned by Corel Corporation. Very full-featured, has a nice freeform prose editing window that shows the XML tags as special icons embedded in the text (à la WordPerfect).
XML SpyAnother GUI editor for XML document development. The latest version includes a graphical XML schema design view.
Opinions vary widely on the utility of visual XML editors. On one side, visual-editor fans like the fact that it's impossible to create a document that isn't well-formed and valid (if validation is being used). Text-editor aficionados, on the other hand, say that XML syntax is so simple that it's more efficient to edit it directly (despite the occasional syntax or structural error). In the end it comes down to a matter of personal preference, comfort level with XML syntax, and budgetary constraints.