Elements are created by generating an element type in the Element List pane of the Element Types pane. Creating of an element type takes several steps. As an example, let's create an element Book for a schema based on the structure of a book (which may contain elements such as a title, author, chapters, sections, glossary, index, and so on).
1. Click on a blank line under the element type name column (or, if starting a new document, make sure the element type "unnamed" is selected). Enter the element name Book (as shown in Figure A). (NOTE: Names must begin with a letter and may contain numbers, underscores, dashes, and full stops -- typically periods). Unless the schema will be using namespaces, avoid using colons.
Figure A - Entering an element type name.
2. Select the appropriate constraint checkboxes (Text, Elem.) for Book. In this example, Book's content will probably contain other elements (such as Chapter) in its content model, so the Elem. constraint checkbox should be checked.
Figure B - Selecting the Elem. constraint checkbox.
3. Create the content model for Book by editing it in the Content Model column of the element type's row. If Book's content model contains references to sub-elements that are not yet defined, XML Authority will prompt the user to create entries for these element types (Figure C).
Figure C - Creating previously undefined sub-elements.
A simple content model for Book may look like the one shown in Figure D below. More information on how to build the content model can be found in the Getting Results section on creating a content model for an element.
Figure D - Simple content model for Book element type.
4. Select the attributes for the element type by clicking under the Attributes column for the element type's row. For example, the element type Chapter may include attributes that give us more information about a chapter, such as its chapter number and chapter title (Figure E). If an attribute is yet undefined, XML Authority will automatically create the attribute type and define its data type as "string". These attributes can be seen and modified in the Attribute types window (Figure F).
Figure E - Attributes of Chapter element type.
Figure F - Details on attributes of Chapter and Section element types (as seen in the Attribute types window).
5. When finished, check the row selector/error indicator for the element type in the element list pane. If there is a problem with an element type's declaration, the error indicator will turn red. Hovering the mouse cursor over the red indicator will display an explanation of the error.
An illustration of several element type declarations that are mentioned in the above examples appears below in Figure G.
Figure G - Element type definitions for book-related schema with no element type errors.
Copyright 2000 Extensibility, Inc.
Suite 250, 200 Franklin Street, Chapel Hill, North Carolina 27516