Creating projects and importing files

From The SBN Wiki
Jump to navigation Jump to search

This page describes how to get started editing and validating XML files using eclipse. We'll use a set of sample files to configure the details of how eclipse interacts with XML and schemas, plus gain some experience with a few eclipse workbench basics.

Sample Files

This zip file contains a few schemas based on an older alpha-test version of PDS4 and a couple of labels that reference them. You can use them to check that your catalog file settings are working properly:

Download the file and unzip it into a temporary directory anywhere except your eclipse 'workspace' directory. (If you don't know where your 'workspace' is, start eclipse and it will tell you. If it doesn't, under the top menues select File->Switch Workspace->other... and the current workspace location will be highlighted.) The files will unpack into a directory called Play.

Creating a Project

Start up eclipse and look over the various windows and menus. (If you haven't already set your perspective to "XML", now would be a good time to do so.) There's not a lot going on at the moment. Eclipse organizes the work area by projects. You can think of a project as a sort of meta-directory: you can create files and directories underneath it, but the project file itself is just a bookkeeping mechanism. We want to play around with some schema files, so we'll have to start by creating a project to work in. Select File->New->Project, or right-click on the empty Project Explorer panel and select New->Project:


You'll be presented with a dialogue box inviting you to select a wizard. We just want a plain, old project, so look under General for Project, select it and click Next>:


Give your project a name. If, for some reason, you want to specify a workplace different from your default workplace to hold this project, now's your chance. We won't be using "working sets" for any of these PDS demos, so the rest of the dialogue can be safely ignored. Click on Finish and your project will be created. Mine's called Demo:


Importing Files into a Project

Now we need to import the files from the zip package we downloaded before into this new workspace. Since we want to import them into the workspace we just created, right click on the name of your new project and select Import...:


This will open the import dialogue box. Click on General to expand it and select File System - because we're importing files from elsewhere in our own file system. (You may find some of the other options intriguing - especially if you'll be using eclipse in a production environment. Explore those later.) Then click on the Next> button:


The next dialogue is for locating the files to be imported. Use the Browse... button to navigate to the place where you stashed the files, and select the top-level "Play" directory. Here's what the result looks like on my system:


I don't really need an extra subdirectory in my project, so in the window on the right I check both XML files listed, and then in the window on the left I expand Play and check the two subdirectory boxes (Dictionaries and Schema). You'll see in the window on the right that when you check, for example, the Dictionaries folder on the left, all the files in it automatically appear checked in the window on the right. You can select and de-select files individually when you're importing folders.

I want to put these all in my Demo folder, which is what comes up by default (since I started by right-clicking on Demo), so we're OK there. There should be nothing to overwrite and I don't need more folders at this point, so the other options I'm leaving unchecked. Similarly for the Advanced... options. Here's what that all looks like just before I hit the Finish button:


And afterwards, if I expand the Demo folder and its subfolders in my Project Explorer window, I now see this:


Checking out the Test Files

Now's a good time to browse what you've just imported. There are several ways to open a file - double click on it, right click and select Open, or via a function key. Close a file by clicking on the X in its editor tab. Go ahead and explore the interface a little. I'll wait...

OK, so here's what's in the test files package:

A PDS4-type label for a very simple collection. This is based on an early version of the schemas - it is not valid under the current version, so don't use it as a template for real work!
A mock-up of a label for a product from the Deep Impact mission. Once again, this would not be valid with the current PDS4/Deep Impact/SBN schemas and dictionaries, so don't try to re-use it.
Contains mock-ups of local dictionaries. These really don't look like the final working format - they're just here to demonstrate how XML files can reference multiple schemas defining different namespaces.
This directory contains two different (and incompatible) preliminary versions of the PDS4 master schema and the associated Schematron file for each.