XML Tools Evaluation Guide

1.0 Introduction

The XML Tools contribution consists of the following components

* These components are pulled in from the eclipse WSVT project

2.0 Getting Started

The easiest way to get started using the XML tools is to use the New Example wizard to create the example 'Editing and Validating XML files' project. This wizard will create a 'simple' project and populate it with some XML artifacts that you can use to experiment with the editors and validators. See section 3.1 for more details. Although the XML tools are designed to work in various perspectives, we'll choose to use the resource perspective to explore the tools.

3.0 Quick Tour

3.1 XML example wizards

The XML Example wizard is a very simple component that provides a sample project that is pre-populated with some example files. From the main menu select File->New -> Example to invoke the dialog shown below. Currently there is only one example project named 'Editing and validating XML files'. This sample project is a handy way to populate your workspace with some XML files so that you can try out the XML Tools.

3.2 XML Schema editor

Under the PurchaseOrder folder, locate the PurchaseOrder.xsd file and double click the file to open it in the XML Schema Editor. As shown below, an Outline and Properties view is provided in addition to the editor pane. At the bottom of the editor area you'll see that there is a 'Source' and a 'Graph' tab at the bottom of the editor area. The 'Source' tab is used for basic XML source editing. The 'Graph' tab is used for higher level graphical editing. Select the 'Graph' tab so that you're looking at the Graph view. As shown below you should see a 'top level' view of the XML Schema that summarizes all of the components (e.g. elements and types) that are defined in the schema.

In order to see these components in detail you can 'drill down' on a component of interest by double clicking on it. For example, if we double click on the 'purchaseOrder' component, the editor will display the structure of the 'purchaseOrder' element as shown below. Notice that the +/- controls can be used to navigate into an element's containment structure. To return to the 'top level' view, press the back button at the top left of the editor, or right clicking within the editor and selecting 'Back to Schema' from the context menu.

Editing the schema is acheived by invoking context menu actions on selected objects in the Graph view and using the properties view to modify the properties of the selected object. Follow the steps below to create a new element declaration and define its content.

  1. right click within the 'Elements' section of the top level schema and choose 'Add Global Element'
  2. use the properties view to change the name of the element to 'purchaseOrderList'
  3. right click within the 'Elements' section of the top level schema and choose 'Add Global Element'
  4. use the properties view to change the name of the element to 'purchaseOrderList'
  5. now double click on the element in the editor to drill down on the element so that we can edit its structure
  6. right click on the purchaseOrderList and select 'Add Sequence' to specify that the element will contain a sequence of child elements.

  7. right click on the sequence to specify a child element, in this case we want to reference an existing element so we'll add an element reference as shown below.

  8. Notice that editor automatically selected the 'PurchaseOrderElement' (as shown below). Luckily this happens to be the element we'd like to reference. If we wanted to specify a different element we could click on the label to invoke a combo box to select an alternative element. In the properties view modify the element reference's minOccurs and maxOccurs to be 0 and undbounded respectively. This specifies that the purchaseOrderList element will contain zero or more purchaseOrder elements.
  9. Right click again on the sequence node and add an element. Rename NewElement to retailerInfo. Now in the properties view, switch to the 'Attributes' tab so that we can define some attributes for the retailerInfo element. Right click in the empty box on the left to add attribute use the table on the right to name the attribute 'retailerName' with a type of 'string'. Add another attribute and give it the name 'dateSubmitted' and give it the type 'date'. Your editor should appear as shown below.

  10. Now that we've finished editing the XML Schema you can save the file. If you'd like to validate the schema or create an XML instance from the schema continue to sections 3.4 and 3.5 for more details.

3.3 WSDL Editor and 'New WSDL' wizard

In this section we will explore the new WSDL wizard and WSDL Editor by creating a completely new WSDL file. The WSDL file we will be creating is TemperatureService.wsdl. We will go through adding Operations, deleting Operations, generating our binding, and simple editing using the editor.

1. New WSDL Wizard 2. Exploring and editing the newly created WSDL file 3. Adding a new Operation 4. Adding an Operation by copying an existing Operation 5. Editing an 'embedded' schema 6. Deleting an Operation 7. Regenerate Binding 8. Now that we've finished editing the WSDL you can save the file. If you'd like to validate the WSDL continue to section 3.4

3.4 Validators for XML artifacts

There are several ways to inoke the validators. The most direct way is to right click on a file (for example purchaseOrder.xsd) and select 'Validate XML Schema' from the context menu. A dialog message will pop up to inform you if the file is valid or not. If the file is invalid errors will be shown in the Problems view. Using the project's preferences, you can also configure the validators to be invoked automatically when a resource is saved. With this setting enabled the validator is automatically invoked and the Problems view is updated when a file is saved. In order to validate an entire project right click on the project and select 'Run Validation'.

3.5 New XML wizard and XML generators

The capability to create an XML instance from a DTD or XML Schema is provided via a 'Generate->XML' menu option and via a 'New XML File' Wizard. Follow the steps below to generate an XML file from an XML Schema. The 'New Wizard' dialog works bery much the same but is invoked from the File->New->Other menu action.

  1. In the naviagor view, select the file PurchaseOrder.xsd under the PurchaseOrder directory
  2. Right click on the file and select 'Generate -> XML File...'
  3. Accept the default name PurchaseOrder1.xml, press Next
  4. In the 'Root Element' combo select the 'PurchaseOrder' (or 'PurchaseOrderList' element if you've completed section 3.2).
  5. Check the the 'Create Optional elements' box, press Finish
  6. The XML file will now open up in the XML Editor. Notice that the file's content has been generated according to the structure defined in the XML Schema.

3.6 XML catalog support

The XML Catalog provides a way to redirect references to XML artifacts (specified by URI locations and namespace names) to an alternate location. Typically this mechanism is used to redirect remote refereces to resources out on the web to a local copy. The user can manually edit the XML Catalog entries via the preferences page (select Window->Preferences->Web and XML->XML Catalog. By pressing the 'New..' button the user can populat the 'User Specified Entries' section of the catalog with a new catalog entry.

You'll notice that the 'Plugin Specified Entries' section of the catalog contains a lot of entries. These entries are contributed by serverl plugins via extension point defined in plugin.xml files. Generally if a plugins requires access to an XML resources that is officially available on the web it will ship a local copy of that XML resource and contribute a catalog entry to redirect remote references to the local copy.

4.0 Provide Feedback to Us

We encourage development/design feed back on the wtp-dev mailing list. You can subscribe to the list via this link.

For usage questions, discussion of bugs, and strange behaviour please post to the eclipse.webtools newsgroup. Information on the Web Tools Platform newsgroup can be found here.