Eclipse: Creating a New XML File from an XSD Schema File

From The SBN Wiki
Revision as of 23:11, 4 September 2012 by Raugh (talk | contribs) (Creation - Safety Save)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

A common task for PDS4 data preparation is creating a new XML label file. Some will be one-off labels for things like context objects, documents, bundle and collections. Others will be turned into templates to use as input to label generation software.

Prerequisites

The following instructions assume you have already downloaded the latest version of the PDS4 master schema (or the specific version you're working with, if not the latest release), and have added an XML Catalog entry to use it to define the PDS namespace, as described in Configuring XML Schema validation.

The example below uses a pre-release, beta-test version of the PDS4 master schema. Some of the details of the schema content you see might not be valid under official releases, but these details are not relevant to the process we're describing - so try to ignore them...


Procedure

Here are the files I'm starting with in my "Demo" project. I'll be using the PDS master schema file called PDS4_PDS_0900B.xsd as the basis for my new XML label file.


CreateDemo1.png


I want to create a new file in my main project directory, so I call up the context menu for Demo (right-clicking on my Windows system, for example), and select New->XML File.


NewXMLFileLocation.png


This will open a New XML File dialogue box. Make sure the "parent folder" name above the center box is the one you want, and type in the name for the new file. Note that all XML label files should have an extension of ".xml".


NewXMLFile1.png


Now, instead of clicking the Finish button, click the Next> button, to show the creation options. Click the Create XML File from an XML Schema file radio button:


NewXMLFile2.png


Then click Next> to get to the schema selection dialogue:


NewXMLFile3.png


You're presented with two options. Either way you'll end up in the same place, but here's how they work.

The first option is the Select file from Workspace option, which will let you select a schema (.xsd) file from someplace (anyplace) in your workspace. Here I've selected the PDS4 master schema file in my "Demo" project "Schemas" subdirectory:


NewXMLFile4.png


Alternately, if I click the Select XML Catalog entry button, I'm presented with a list of every namespace currently listed in the eclipse XML Catalog file, including the entry I created for the PDS4 namespace, which I can then select:


NewXMLFile5.png


Either way, clicking on Next> should take you to the same place:


NewXMLFile6.png