3.2. Creating a New Document

epcEdit offers two way of creating new documents:

The preferred way to create a new document is to use a document template. epcEdit comes with pre-configured document templates for a number of popular DTDs.

Follow these steps to create a new document from an existing document template:

Creating a new document from a template

  1. Choose File->New File from the main menu or click on the New Document button in the toolbar.

    A dialog will appear that lets you choose how you want to create a new document.

  2. Choose the name of the template to use from the list of available templates at the bottom of the dialog. If you need more information about a template, right-click on the template icon and choose Template Info... from the context menu. This will display a template information dialog as described in Figure 15-3.

  3. After selecting the appropriate template, click on the OK button to create a new document from this template.

After selecting the appropriate template and clicking the OK button, a new document is created with the information from this template. The document element is inserted in the new document and the insertion cursor is placed inside the document element.

If you do not have a template for the type of document that you want to create, you can either create a new template or create the new document from scratch. Follow these steps to create a new document without a template:

Creating a new document without a template

  1. Choose File->New File from the main menu or click on the New Document button in the toolbar. The dialog for creating a new document will appear.

  2. Select the Create document of type: radio button and choose the type of document from the drop-down list to the right of the button. You can create three types of documents:

    • Select DTDless XML if you want to create an XML document that does not use a DTD. The resulting XML document will be well-formed only.

    • Select XML for creating a valid XML document that uses a DTD.

    • Select SGML to create an SGML document.

  3. Click on the Ok button. A new dialog will appear where you can enter the information for creating your document. The exact form of this dialog depends on the type of document that you want to create.

    Figure 3-2. Document creation information

    • The Document element is used to enter the name of the top-level element for your document. If you are creating an SGML document or an XML document with a DTD, the DTD must contain the definition of this element. Filling out this field is required.

    • The Document encoding field lets you specify the encoding for XML documents. This field is not available if you are creating an SGML document. It is recommended to accept the default encoding of UTF-8 for XML documents.

    • The System identifier field is used to enter the system identifier for your DTD. In most cases, this will be the file name of the DTD. This field is not available if you are creating a DTDless XML document.

      This field is required for XML documents that use a DTD. For SGML documents, either a System identifier or a public identifier must be provided.

    • The Public identifier field is used to provide a public identifier for the DTD. Public identifiers are resolved using catalog files as described later in this document.

      This field is not available if your are creating a DTDless XML document. Filling out this field is optional if you are creating an XML document with a DTD.

  4. Click on the Ok button to create a new document.

XML documents that use a DTD require the presence of a system identifier that specifies how the DTD can be found. When an absolute file name is used as a system identifier, this approach is a potential problem for the portability of your documents because file names tend to differ from system to system. Please refer to Catalogs for suggestions about using public and system identifiers for XML documents.