There are three basic types of XML editors: WYSIWYG, WYSIWYM, and plain text. If you have any experience with web development or desktop publishing, you're probably familiar with the term WYSIWYG, which stands for What You See Is What You Get. The idea behind WYSIWYG tools is that you edit content exactly as you want it to appear. Microsoft Word and Macromedia Dreamweaver are examples of WYSIWYG tools in that they allow you to edit word processing documents and web pages just as they will appear when printed or viewed on the Web. WYSIWYG XML editors take a similar approach by focusing on the final appearance of an XML document for display purposes, as opposed to the meaning of the XML content itself.
If you want to focus more on the meaning of XML content, you should consider using a WYSIWYM XML editor. Any guesses as to what the acronym stands for? You get two points if you said What You See Is What You Mean! A WYSIWYM XML editor focuses on the meaning of XML code as opposed to how the code is rendered for viewing. WYSIWYM editors often take into consideration specific XML languages, and offer you context-sensitive help in using tags and attributes. Most WYSIWYM editors display XML code as a tree-like structure roughly similar to the default browser view of XML that you saw in the previous chapter (XML And Web Browsers and XML And Web Browsers).
WYSIWYM XML editors are also sometimes referred to as semantic editors because they focus on the semantics (meaning) of XML code, as opposed to the resulting appearance of the code.
The third type of XML editor is the plain text editor, which simply allows you to edit an XML document as plain text. The plain text approach is neither WYSIWYG or WYSIWYM because there is no clue provide regarding the eventual appearance of the code or the context of its meaning. You're pretty much on your own if you go the plain text route, which is not entirely a bad thing, at least in terms of learning the ropes and understanding every single character of an XML document.
There are several commercial XML editors available at virtually every price range and supporting both major approaches to XML editing (WYSIWYG and WYSIWYM). Although a commercial XML editor might prove beneficial at some point, I recommend spending at least a little time with a plain text editor because it allows you to work directly at the XML code level with no frills. Figure 2.1
shows the "talltales" example XML document open in Windows Notepad.
Figure 2.1. Simple text editors such as Windows Notepad allow you to edit XML documents as plain text.
If you use Windows WordPad or some other text editor that supports file formats in addition to standard text, you'll want to make sure to save XML documents as plain text. This means you will need to use the Save As command instead of Save, and choose Text Only (.txt
) as the file type.
As far as WYSIWYG XML editors go, one of the better editors I've seen is called Vex, and it is freely available for download at http://vex.sourceforge.net/
. Vex presents a visual user interface generally similar to a word processor such as Microsoft Word. More importantly, Vex earns the WYSIWYG label because it hides XML tags from you, allowing you to focus solely on the appearance of your code. Vex uses CSS (Cascading Style Sheets) to render the appearance of XML code. You learn how to use CSS to style XML code in Styling XML Content With CSS, "Styling XML Content with CSS." Unfortunately, Vex is a little tricky to get the hang of in terms of creating and managing XML projects, so I'd recommend sticking with a WYSIWYM or plain text for the creation of XML documents until you have more experience. Keep in mind that you can always use a web browser for a WYSIWYG view of an XML document that you create in a WYSIWYM or plain text XML editor.
Many XML documents aren't about appearance at all, in which case you'll want to look into using an editor that focuses on meaning as opposed to appearance. One of my favorite WYSIWYM XML editors is Butterfly XML, which is available for free download at http://www.butterflyxml.org/
. Unlike Vex, Butterfly XML is geared toward editing XML content with a focus on what the content means, not what it will look like. Butterfly XML displays an XML document as both a hierarchical tree of data and context-highlighted text. In other words, you get to see both the tree-like structure of an XML document as well as how each portion of the tree is associated with plain text in the document. However, instead of entering raw text in the document, you are presented with editing aids such as a pop-up list of available tags. Figure 2.2
shows an example of how Butterfly XML allows you to edit an XML document with a focus on the meaning of the content.
Figure 2.2. The Butterfly XML WYSIWYM XML editor gives you an opportunity to focus on the meaning of XML documents as you edit them.
I've actually done a bit of foreshadowing here by showing you the talltales.xml
document in Figure 2.2
. You create this document as your first XML document in the next section of this tutorial.
In case you're concerned that I'm being too cheap by only showing you free XML editors, there are plenty of commercial editors you can buy if you want to go that route. Many of the commercial editors allow you to edit XML documents using a combination of WYSIWYG and WYSIWYM approaches, which gives you lots of flexibility. One of the more powerful commercial XML editors I've run across is <oXygen/> XML Editor, which is available for Windows, Macintosh, Linux, and Eclipse. <oXygen/> isn't free but it could very well pay for itself with its advanced XML features. To learn more about <oXygen/>, visit it on the Web at http://www.oxygenxml.com/
.
Another solid XML editor is XML Spy, which is available for Windows computers. XML Spy has been around a while, and is packed with support for a wide range of XML technologies. Perhaps of more interest to you at this stage of the game, XML Spy is available for free in a special Home Edition. There is also an Enterprise Edition and a Professional Edition, both of which are not free but pack in a lot more features. You can download and try out XML Spy Home Edition at http://www.altova.com/download_spy_home.html
.