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:
Although well-formed XML documents do not restrict or prescribe the names of elements and attributes that can occur, they can normally be classified according to the top-level element of the document. In most cases, users create XML documents with a limited set of top-level elements.
For example, you might write different types of publications like books, articles, or reports. You will then use a top-level XML element like book, article, or report for these publications. If you write a new report as a well-formed XML document, you will use a top-level element of report for this new document.
It is normally desirable to keep the set of elements that are used in well-formed XML documents small and consistent. For example, you will not mix up title and heading elements in your document and stick to using either title or heading unless these elements have a different purpose.
The same set of elements will occur in all documents of the same class. For example, all of your reports may use a title element rather than a heading element for providing title information.
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:
By declaring new elements that should be used in your documents, you gradually build up an element set for a class of well-formed XML documents.
By storing these elements in a template, you achieve consistency of the element set for all well-formed XML documents in a document class.
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.