XMLSpy from Altova GmbH is not just one tool, but an entire suite of products for working with XML in many of its forms. In addition, you can extend the capabilities of XMLSpy by adding on one or more of Altova's other products, such as Authentic (graphical XML editor for non-technical people), SchemaAgent (XML Schema repository), MapForce (data and Web services integration), and StyleVision (graphical form/report designer). These tools integrate into XMLSpy, providing additional capabilities beyond its already long list of features.
As you would expect from a tool designed for XML editing, XMLSpy has great support for editing new or existing XML documents. As with many other tools described here, you can edit XML documents in either text or a graphical view. You can access these views either via the View menu, or by selecting the appropriate item at the bottom of the editor window.
q Text: A basic editing experience. However, the XMLSpy editing window also includes such niceties as auto-completion (if you have an assigned schema), code folding (see Figure 2-7). This can be useful to hide sections of the document you're working on.
Figure 2-7
q Grid: A hierarchical editing surface that shows the logical structure of the XML file in a series of nested grids. This can be a useful editing surface either when you are first working with an XML document, when you want to learn the structure of the document, or when you are working on one area of a document and want to hide the remaining parts of the document. (See Figure 2-8.)
Figure 2-8
q Schema/WSDL: This view is only available when working with XML schemas or WSDL documents. It shows one of two views. For the document itself, it shows a list of all the global structures (element definitions, complex and simple types, and so on) in the document. (See Figure 2-9.) The second view, shown when an element or complex type is selected, shows a graphical node-based view of that section of the schema. (See Figure 2-10.) Both of these views provide a graphical view of the structure of the schema, but also allow you to graphically design the schema or WSDL. For more details on this view, see the Schema Development section later in this chapter.
Figure 2-9
Figure 2-10
q Authentic: A view specific to XMLSpy, this displays the XML using a StyleVision stylesheet. A StyleVision stylesheet is a graphical overlay on an XML file. It can include controls, validation, and graphics to make working with XML easier for those not used to dealing with angle brackets. See Figure 2-11.
Figure 2-11
q Browser: Displays the XML document using Internet Explorer (requires IE 5 or above). This can be useful when you are creating XHTML files or XML files with an embedded stylesheet. It can confirm what the files might look like in a browser window. (See Figure 2-12.)
Figure 2-12
Schema development in XMLSpy is done with either DTDs or W3C XML schema. It does not directly support Relax NG or Schematron schemas. You can, however, create these schemas using either a text editor (see Figure 2-13) or their graphical editor (see Figure 2-14). You can navigate between the two editors by selecting either the Text or Schema/WSD buttons at the bottom of the editor window, or via the View menu. A number of entry helpers are available when you are working with either mode to ensure that you generate a valid schema, including statement completion. These entry helpers change to show the valid options at each point in the document.
Figure 2-13
Figure 2-14
XMLSpy has strong XSLT support, including support for XSLT 2.0. In addition to the capability to create basic XSLT files, XMLSpy also has support for mapping between two XML schemas using MapForce or generating documents via XSL:FO using StyleVision. However, these features require you to have those products installed.
When generating XSLT documents, XMLSpy has an integrated debugger (see Figure 2-15), accessed by selecting Start Debugger Go from the XSL/XQuery menu. This debugger enables you to step through your XSLT file, watch for specific variables or XPath statements, and set breakpoints. These can be invaluable assists when you are trying to interpret the sometimes-Byzantine interplay between XPath, individual XSLT templates, and XML.
Figure 2-15
One potentially useful feature of XMLSpy is the inclusion of a script editor, accessed via the Switch to Scripting Environment from the Tools menu. This script editor allows you to edit and run macros to extend the environment using either VB Script or JavaScript. You can also create forms that run within XMLSpy, enabling you to add new dialogs. (See Figure 2-16.)
Figure 2-16
The following table summarizes the XML editing features in XMLSpy.
Benefit | Disadvantage |
---|---|
Incredibly full-featured toolset for working with XML, schemas, XSLT and more. | Because of the scope, can be difficult to learn all the features. |
Includes macro engine for extending the environment. | Some features require purchasing additional software. |
Can be used as a code generator (C#, Java, or C++) | Does not directly support Relax NG or Schematron schemas. |
Includes XSLT, XQuery and SOAP debugging. |