Uniface-Compliant DTDs
A Document Type Definition (DTD) defines rules for the structure of an XML stream. In Uniface, a DTD is a development object that includes DTD definitions and a default mapping between the XML elements defined by the DTD and Uniface component fields and entities. It can be used to define the rules for the structure of an XML stream that is exchanged between components.
An XML DTD specifies the elements allowed in an XML document, including their multiplicity, attributes, order, and content. An element can be set to occur once only, zero or once, any number of times, or one or more times. It can contain data, other elements, or a combination of data and elements. Elements can be constrained to occur in a specific sequence, or they can be allowed to occur in any order. DTDs are specified in the XML standard, issued by the World Wide Web Consortium.
Criteria for Uniface-Compliant DTDs
However, XML DTDs allow data structures that do not correlate to relational database or Uniface data structures. When handling XML declaratively, DTDs must meet the following criteria:
- Elements that represent entities:
- must contain elements only
- can be set to occur exactly once, 0-n times, 1-n times, or 0-1 times within each instance of their parent element
- Elements that represent fields:
- must have PCDATA as their content model
- must be a child of an element representing the field’s entity
- must occur once within each instance of the parent element
-
Always avoid mixed content (this means that you must never allow an element to contain PCDATA and elements)
Storing and Compiling DTDs
Compiling DTD objects places the DTDs in resource files (\dtd\Entity@Model.dtd ).
Note: Although compiled DTDs have a .dtd extension, they are not normal text DTD files.
If a DTD specifies a file name in its properties, compiling the DTD also creates a text file with a .dtd file extension. This file conforms to the XML standard for DTDs.
The default mapping between XML elements and Uniface fields is compiled, but is not stored in the DTD text file.