Given the strategic importance associated with XML since its inception, there is no shortage of tools to help developers create and validate XML documents. These tools fall into three categories:
XML authoring tools for creating XML documents from scratch
Automated XML converters that will take an existing document and convert it into a valid XML document ”for example, Excel 2002 (as discussed earlier), which will now save a standard Excel spreadsheet in the form of an XML document, as depicted in Figure 2.3(a, b)
Given that an XML document, by definition, is a flat text file, one could, as with HTML, create and edit XML documents using a simple text editor such as Windows Notepad, which is included as a standard, no-cost accessory with all flavors of today s Windows operating systems. However, as with HTML, many will find using a pure text editor to create XML to be tedious and frustrating. They would prefer an XML-cognizant editor, which would simplify some of the mundane but crucial tasks (e.g., keeping track of open tags). The good news is that there are plenty of such XML-specific editing tools.
A free graphical XML editor, which would allow you to display and manipulate XML documents per their XML structure, was available from Microsoft. It was called XML Notepad. Though no longer available directly from Microsoft, this still-popular editor can be downloaded for a fee from: http://www.devhood.com/. XML Notepad is a standard Windows application, which allows you to create and edit XML documents quickly and easily. It displays the structure of an XML document as an easy-to-follow tree structure. The interface, as shown in Figure 2.8, presents two panes: one for the XML structure and the other for the values. You can add elements, attributes, comments, and text to an XML document by creating the tree structure in the left pane and then entering the required values in the corresponding text boxes shown in the right pane.
Other, but not free, XML editors are available from the likes of XML Spy at http://www.xmlspy.com and Corel/SoftQuad at http://www.xmetal.com. These editors come in two forms. XML Spy, like Microsoft s XML Notepad, deals directly with XML code and expects you to know XML. On the other hand, XMetaL hides the XML from you. You concentrate on the structure of the document using Word processor “like techniques. The editor, behind the scenes, generates the XML on your behalf . These types of automatic XML generators are similar to MS FrontPage or MacroMedia DreamWeaver in the context of HTML. These user-friendly HTML tools allow you to compose Web pages using visual, drag-and-drop, graphical techniques. The HTML is generated automatically by the editor without the user having to know anything about it.
If you plan to use XML extensively, you might want to get one of each of the two different editor types. Use the automatic generation editor to get you started. Then use the XML-centric editor to refine, optimize, and customize the automatically generated XML. Then there are the XML converters, which will take a document, typically a document in a word processing format, and then represent it as an XML document. XML validators, on the other hand, take an existing XML document and parse it to make sure that it is valid in that it meets all of the XML requirements.
At present there are two popular XML APIs: Document Object Model (DOM) and Simple API for XML (SAX). These APIs allow applications to read XML documents independent of the XML syntax. These APIs are geared toward different applications. DOM is geared for display type applications involving XML-oriented browsers and editors. SAX, on the other hand, is targeted for interprogram interactions.