Chapter 12. Editing DTDless XML documents

Table of Contents
12.1. Extending the element set
12.2. Declaring new attributes
12.3. Tables in DTDless XML documents

XML distinguishes two types of XML documents: valid documents and well-formed, DTDless documents. A DTDless document is assumed to define its own markup by the existence and location of elements where you create them. When an XML application encounters a DTDless document, it builds its internal model of the document structure while it reads it, because it has no DTD to tell it what to expect. In this manual, we use the term well-formed XML document to refer to documents that do not reference a DTD.

Well-formed, DTDless XML documents are supported by epcEdit with a number of specialized functions. The main difference between valid XML /SGML documents and well-formed XML documents is the absence of a DTD.

After a well-formed XML document has been loaded into epcEdit, only the elements and attributes that have already occurred in the document are available for insertion unless a document template exists that matches the type of the document: If a document template is found that matches the type of the well-formed XML document, the element and attribute definitions in this template are read and added to the initial list of elements and attributes.

For example: the well-formed XML document book.xml with a document element of book is loaded by epcEdit and a matching template, let's say book.sgt, is found on your system. epcEdit will read the document template book.sgt and add all element and attribute definitions that are stored in book.sgt to the list of available elements and attributes.

When a new well-formed XML document is created from a template, epcEdit will create an initial list of available element names that contains only the document element. It will then add all elements and attributes to this list that were found in the template that was used to create the document.

Because no DTD is available to restrict the possible content of elements and the values of attributes for well-formed XML documents, epcEdit will assume that:

12.1. Extending the element set

The initial set of available elements and attributes may not be sufficient. For example, you may find that you will need an additional element appendix in your well-formed XML document.

Because no appendix elements have yet occurred in your well-formed XML document, epcEdit knows nothing about the potential appendix elements: In order to insert an element of a hitherto unknown element type, you have to declare the new element type first. Once a new element type has been declared, it can be used like any other element type that has been inferred from the existing document content.

To declare a new element type, follow these steps:

Declaring a new element

  1. Choose Element->Element Overview from the main menu or click on the All tab in the element manager.

  2. Click on the Declare element button at the bottom of the element manager.

  3. The following new dialog will appear:

    Figure 12-1. Declare element dialog

  4. Enter the name of the new element in the entry field, then click on the OK button. The entry dialog will be closed and the name of the new element will appear in the element manager.