Opening and closing documents

As with most editing applications, <oXygen/> lets you open existing documents, save your changes and close them as required.

Creating new documents

<oXygen/> plugin wizards

The <oXygen/> plugin installs a series of Eclipse wizards for easy creation of new documents. Using these wizards you let <oXygen/> fill in details like the system ID or schema location of a new XML document, the minimal markup of a Docbook article or the namespace declarations of a Relax NG schema.

Procedure 4.1.  Creating new documents

  1. Select File-> New->-> Other (Ctrl+N) or press the New toolbar button. The New wizard is displayed which contains the supported Document Types: XML, XSL, XML Schema, Document Type Definition, Relax NG Schema, XQuery, Web Services Definition Language, Schematron Schema, CSS File .

    Figure 4.1.  The New wizard

    The New wizard
  2. Select a document type, then click Next. For example if XML was selected the "Create an XML Document" wizard is started.

  3. Type a name for the new document and press Next.

  4. The Create an XML Document dialog enables definition of a XML Document Prolog using the system identifier of a XML Schema, DTD, Relax NG (full or compact syntax) schema or NRL (Namespace Routing Language) schema. As not all XML documents are required to have a Prolog, you may choose to skip this step by clicking OK . If the prolog is required complete the fields as the following.

    Figure 4.2.  The Create an XML Document - XML Schema Tab

    The Create an XML Document - XML Schema Tab

    Complete the dialog as follows:

    Use a DTD, XML Schema, Relax NG or NRL schema

    When checked enables selection between DTD, XML Schema, Relax NG schema or NRL schema.

    URL

    Specifies the location of an XML Schema Document (XSD).

    Document Root

    Populated from the elements defined in the specified XSD, enables selection of the element to be used as document root.

    Namespace

    Specifies the document namespace.

    Figure 4.3.  The Create an XML Document - DTD Tab

    The Create an XML Document - DTD Tab

    Complete the dialog as follows:

    Use a DTD, XML Schema, Relax NG or NRL schema

    When checked enables selection between DTD, XML Schema, Relax NG schema or NRL schema.

    System ID

    Specifies the location of a Document Type Definition (DTD).

    Document Root

    Populated from the elements defined in the specified DTD, enables selection of the element to be used as document root.

    Public ID

    Specifies the PUBLIC identifier declared in the Prolog.

    Figure 4.4.  The Create an XML Document - Relax NG Tab

    The Create an XML Document - Relax NG Tab

    Complete the dialog as follows:

    Use a DTD, XML Schema, Relax NG or NRL schema

    When checked enables selection between DTD, XML Schema, Relax NG schema or NRL schema.

    URL

    Specifies the location of a Relax NG schema in XML or compact syntax (RNG/RNC).

    XML syntax

    When checked the specified URL refers to a Relax NG schema in XML syntax. It will be checked automatically if the user selects a document with the .rng extension.

    Compact syntax

    When checked the specified URL refers to a Relax NG schema in compact syntax. It will be checked automatically if the user selects a document with the .rnc extension.

    Document Root

    Populated from the elements defined in the specified RNG or RNC document, enables selection of the element to be used as document root.

    Figure 4.5.  The Create an XML Document - NRL Tab

    The Create an XML Document - NRL Tab

    Complete the dialog as follows:

    Use a DTD, XML Schema, Relax NG or NRL schema

    When checked enables selection between DTD, XML Schema, Relax NG schema or NRL schema.

    URL

    Specifies the location of a NRL schema (NRL).

Creating Documents based on Templates

Templates are documents containing a predefined structure. They provide starting points on which one can rapidly build new documents that repeat the same basic characteristics. <oXygen/> installs a rich set of templates for a number of XML applications. You may also create your own templates and share them with other users.

The New from Templates wizard enables you to select predefined templates or templates that have already been created in previous sessions or by other users. Open a template using the following options:

Figure 4.6.  The New from Templates wizard

The New from Templates wizard

Open a template using the following options:

Standard

Populates the Templates list to show templates supplied with the <oXygen/> installation package.

User defined

Populates the Templates list to show previous saved personal templates.

From URL

Enables definition of a URL location containing Templates.

Templates List

Displays the available templates for Standard, From File and From URL options.

Procedure 4.2.  Creating Documents based on Standard Templates

  1. Select File-> New->New from Templates The New from templates wizard is displayed.

    Figure 4.7.  The Templates dialog

    The Templates dialog
  2. Type a name for the new document and press Next.

  3. Select the Standard option from the Load Templates Group. The Templates list displays standard <oXygen/> templates.

  4. Scroll the Templates list and select the required Template Type.

  5. Click Finish. A new document is opened that already contains structure and content provided in the template starting point.

Procedure 4.3.  Creating Documents based on Personal Template Files

  1. Select File-> New->New from Templates The New from templates wizard is displayed.

    Figure 4.8.  The Templates dialog

    The Templates dialog
  2. Type a name for the new document and press Next.

  3. Select the User defined option from the Load Templates Group. The Templates list displays person templates.

  4. Scroll the Templates list and select the required Template Type.

  5. Click Finish. A new document is opened that already contains structure and content provided in the template starting point.

Procedure 4.4.  Creating Documents based on URL Template Files

  1. Select File-> New->New from Templates The New from templates wizard is displayed.

    Figure 4.9.  The Templates dialog

    The Templates dialog
  2. Type a name for the new document and press Next.

  3. Select the From URL option from the Load Templates Group. The From URL field is enabled.

  4. Enter the URL location of the templates, then click Load. The list of templates is retrieved from the URL and displayed in the Templates list.

  5. Scroll the Templates list and select the required Template Type.

  6. Click Finish. A new document is opened that already contains structure and content provided in the template starting point.

Saving documents

The edited document can be saved with one of the actions:

    Opening existing documents

    Documents can be opened using one of the actions:

    In addition <oXygen/> supports direct opening of files from the command prompt. Use the following command syntax:

    • On Windows:

      oxygen.bat FileToOpen.xml

    • On Unix/Linux:

      sh ./oxygen.sh FileToOpen.xml

    • On Mac OS X:

      sh ./oxygenMac.sh FileToOpen.xml

    Also when the Tree Editor perspective is activated the current document in the Editor perspective will be opened and displayed as a tree of XML elements.

    Closing documents

    To close documents use one of the following methods:

    Creating and sharing new document templates

    Creating a new document template

    <oXygen/> enables user defined templates to be created. Templates are created by adding an existing document to the Template library.

    Procedure 4.5.  Creating New Templates

    1. Open the document that will be used to create the Template.

    2. Modify the structure and content as required.

    3. XML->Add to templates (Ctrl+Shift+A) or press the toolbar button Add to templates to display the Add templates dialog used to define the name by which the current document content will be recognized in the New from templates option.

    4. Enter the name by which the template will be known. Click OK the document is added to the list of Personal Templates.

    5. Test the template using the From File option.

    Sharing document templates

    <oXygen/> stores Personal Templates in an XML file called .com.oxygenxml/templates.xml, located in the Home folder of the <oXygen/> user. By copying this file to a Web Server folder and making it accessible via HTTP, other <oXygen/> users can use the From URL option to access the templates.

    Procedure 4.6.  Sharing Templates

    1. Create one or more Personal Templates.

    2. Copy [user home dir]\com.oxygenxml\templates.xml into an accesible directory on your web server.

    3. Test the template using the From URL option.

    Viewing file properties

    You can quickly access informations about the current edited document like the character encoding, full path on the filesystem, schema used for content completion and document validation, associated transformation scenario, if bidirectional text (left to right and right to left) is enabled, indent size by going to File-> Properties