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.
Because no DTD is available in well-formed XML documents, the set of available element types and attributes for these element types is initially undefined for well-formed XML documents. When epcEdit loads a well-formed XML document, it adds a new element type to its internal list of known elements for every new element that is encountered in a well-formed XML document.
For example, if a well-formed XML document is loaded into epcEdit and this document contains elements with the names book, chapter, section, and para, then epcEdit's internal list of available elements will contain the element types book, chapter, section, and para. Because no DTD is available to tell epcEdit the context in which of these elements may occur, epcEdit will allow the occurrence of every element at every possible location in the document (provided that the document will remain a well-formed document, i.e. that the markup tags are properly nested, etc).
If an element in a well-formed XML document has attributes, each attribute name is added to the list of available attributes for the type of the element in which the attribute occurred. For example, if a well-formed XML document contains an element para and this element has an align attribute, then epcEdit will allow align attributes to occur on every para element in the document.
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:
Every element that occurs in the well-formed XML documents has unrestricted content, i.e. it has a content definition of ANY.
Every attribute that occurs in a well-formed XML document has the most generic value type, i.e. it has a value type of CDATA.
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
Choose -> from the main menu or click on the All tab in the element manager.
Click on the button at the bottom of the element manager.
The following new dialog will appear:
Enter the name of the new element in the entry field, then click on the button. The entry dialog will be closed and the name of the new element will appear in the element manager.