10.5. Templates for DTDless XML documents

Most of the information that can be entered in the template wizard applies only to valid XML and SGML documents and is meant to simplify the creation of new documents without having to enter the same data every time a new document is created.

For well-formed XML documents, the template mechanism offers additional advantages. With respect to templates, well-formed XML documents commonly have the following characteristics:

The element set that is used in all documents of a class should be consistent. ecpEdit will help you to achieve this goal by using the template mechanism. When editing, epcEdit will not allow you to insert an element into your well-formed XML document that has not yet occurred in you document. If you need to insert an element with a new type, you will have to declare that element first (see Extending the element set).

When you save the template of your well-formed XML document, all element types and attributes that you have defined will be stored in the template. The next time that you use this template to open or create a new document of this document class, all element definitions that were made for this document class will be available again:

For example: The first time that you write a well-formed XML document with a top-level element of report, you might decide that you will need title, author, section, and para elements. After you define these elements, they will be available for insertion into your document. When the template for the report document is saved, the definitions of these elements are stored in the template. The next time that you use this template to create a new document, the element definitions for title, author, section, and para will be available automatically.