| <html> |
| <head> |
| <meta |
| http-equiv="Content-Type" |
| content="text/html; charset=UTF-8"> |
| <meta |
| http-equiv="Content-Type" |
| content="text/html; charset=iso-8859-1"> |
| <link |
| rel="stylesheet" |
| href="../../../..//default_style.css" |
| type="text/css"> |
| <link |
| rel="stylesheet" |
| href="../../../..//webtools/wtp.css" |
| type="text/css"> |
| <title>XML Schema Editor Tutorial</title> |
| </head> |
| <body> |
| <table |
| width="100%" |
| cellspacing="5" |
| cellpadding="2" |
| border="0"> |
| <tbody> |
| <tr> |
| <td |
| width="60%" |
| align="left"><font class="indextop">XML Schema Editor Tutorial</font> <br> |
| <font class="indexsub">XML Schema Editor Tutorial</font></td> |
| <td width="40%"><img |
| width="207" |
| hspace="50" |
| height="129" |
| align="middle" |
| src="../../../..//webtools/images/wtplogosmall.jpg" |
| alt=""></td> |
| </tr> |
| </tbody> |
| </table> |
| <table |
| width="100%" |
| cellspacing="5" |
| cellpadding="2" |
| border="0"> |
| <col width="16"> |
| <col width="*"> |
| <tbody> |
| <tr> |
| <td |
| valign="top" |
| align="right"> </td> |
| <td valign="top"> |
| <p><b>By Keith Chong and Craig Salter</b> <br> |
| December 23, 2004<br> |
| <br> |
| </p> |
| <p>This tutorial will use the catalog.xsd from the "Editing and validating XML files" Examples. To |
| create it, select New -> Examples... to launch the wizard. Follow the instructions described in the |
| wizard, then click Finish to create the example project.</p> |
| <p>Once created, under the PublicationCatalogue folder, locate the Catalogue.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. <br> |
| <br> |
| <img |
| border="0" |
| src="images/xsdeditor-figure1.jpg" |
| alt=""></p> |
| <p>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 'Book' component, the editor will display the |
| structure of the 'Book' 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 <img |
| border="0" |
| src="images/xsdeditor-backbutton.jpg" |
| alt=""> at the top left of the editor, or right clicking within the editor and selecting 'Back to |
| Schema' from the context menu.<br> |
| <br> |
| <img |
| border="0" |
| src="images/xsdeditor-figure2.jpg" |
| alt=""></p> |
| <p>Editing the schema is achieved 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.</p> |
| <ol> |
| <li>right click within the 'Elements' section of the top level schema and choose 'Add Global |
| Element'</li> |
| <li>use the properties view to change the name of the element to 'Paper' <img |
| border="0" |
| src="images/xsdeditor-figure3.jpg" |
| alt=""></li> |
| <li>now double click on the element in the editor to drill down on the element so that we can edit |
| its structure</li> |
| <li>right click on Paper and select 'Add Sequence' to specify that the element will contain a |
| sequence of child elements.<br> |
| <img |
| border="0" |
| src="images/xsdeditor-figure4.jpg" |
| alt=""> <br> |
| </li> |
| <li>click on the anonymous complex type, and then from the properties view, click on the [...] |
| button for Base Type.<br> |
| <img |
| border="0" |
| src="images/xsdeditor-figure5.jpg" |
| alt=""> <br> |
| <br> |
| </li> |
| <li>The Available Types dialog will appear. Select the User Defined Complex Types radio button, |
| then select PublicationType, and click OK <img |
| border="0" |
| src="images/xsdeditor-figure6.jpg" |
| alt=""> <br> |
| <br> |
| </li> |
| <li>Paper's type is now shown below. Right click on the sequence node and add an element.<br> |
| <img |
| border="0" |
| src="images/xsdeditor-figure7.jpg" |
| alt=""> <br> |
| <br> |
| </li> |
| <li>Name the newly added element 'URL', because, say, the paper is found on the web.<br> |
| <img |
| border="0" |
| src="images/xsdeditor-figure8.jpg" |
| alt=""> <br> |
| </li> |
| <li>Click on the Paper element. In the properties view, click on the 'Other' tab. For the |
| substitutionGroup property, click in the cell editor to the right of the label. A drop-down combobox |
| will appear. Select PublisherType. Your editor should look like this:<br> |
| <br> |
| <img |
| border="0" |
| src="images/xsdeditor-figure9.jpg" |
| alt=""> <br> |
| </li> |
| <br> |
| <li>Now that we've finished editing the XML Schema you can save the file.</li> |
| </ol> |
| <p></p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </body> |
| </html> |