The Attribute Types pane is used to view, create, and edit attribute type declarations. This pane defines how the elements in a document should be annotated with attributes. Multiple elements may share the same attributes, simplifying the declaration process.
The Attribute Types pane (Figure A) provides a different view of the same schema information presented in the Element Types pane. Instead of focusing on element types and their content models, with attribute information presented as a side note for the element types, the Attribute Types pane focuses on the attribute types and their content, listing the element types to which the attribute types are attached for reference.
Figure A - The Attribute Types pane
Each attribute is listed in a row of the pane. Information associated with each attribute appears in columns across the pane and includes the following (from left to right):
The entire list can be sorted at any time by clicking on one of the column headers. For example, to sort the list by the name of the attribute name, click on the Attribute Name column header. Or, to sort the list by data type, click on the Data Type column header, and so forth. To sort a column in descending order, hold down the <Shift> key while clicking a column header.
Row Selector/Error Indicator
The row selector/error indicator (dot), located at the start of each row on the left, can be clicked-on to select a row (or multiple rows, using the shift and ctrl keys) for cut, copy, and paste operations. The indicators turn red if there is an error in the declaration. If the user hovers the mouse cursor over a red row selector/error indicator for a few seconds, a description of the declaration's error is displayed. Right-clicking on the row selector/error indicator brings up a menu offering cut, copy, paste, and clear options.
The column between the selectors and the attribute names indicates whether a
declaration comes from the file being edited. If a small document icon with a slash
through it () appears in
this pane, it indicates that the declaration cannot be edited directly here, because the
declaration comes from a file that is external to the currently active file. To edit
these declarations, either use the Overview pane to unlock
the declarations, or open the original file containing the declarations.
A new attribute can be created by clicking on a blank row under the attribute name column, and then entering a name. (NOTE: Names must begin with a letter and may contain numbers, underscores, dashes, and full stops -- typically periods). To edit an attribute type name, click on an existing name in the attribute type name column. Unless the schema will be using namespaces, avoid using colons.
The Element column references the element to which an attribute belongs. The user can enter the element type to which an attribute belongs by typing its name in the element column. As the user enters the name, XML Authority will automatically try to complete the element name, making the entry process easier. If the same attribute needs to be assigned to multiple element types, those assignments should be made in the Attributes column of the element list area of the Element Types pane. If an attribute is used by multiple elements, it will be listed in the Attribute types pane as shared (example: the test element in Figure B). To bring up a list of the multiple elements using a particular attribute, right-click on the word 'shared' as shown below:
Figure B - Right click on the word 'shared' to display an element list
To separate the definition for a particular element type (to choose a different default value, for instance), select the name of the element type from the pop-up menu. XML Authority will create a separate entry for that attribute and permit the user to make changes. To avoid separating the definitions, click outside of the pop-up menu.
(NOTE: With the exception of XDR and BizTalk schemas, each attribute must be associated with a declared element. In XDR and BizTalk, an attribute can be declared as global by leaving the element column blank.)
Attributes have much simpler content model choices than elements. XML Authority provides all of the XML 1.0 options as well as a number of advanced data types to identify your attribute's type precisely. Each attribute's data type can be entered in the Data Type column by typing it (in which case XML Authority will fill in a type as soon as it recognizes the entry) or by selecting it from the Type pop-up menu (Figure C):
Figure C - The Data Types pop-up menu
The Constraints column allows the user to limit the choices available for attribute values. Within a DTD, XDR, or BizTalk schema, constraints are only available for attributes of type enumeration or notation, in which case a list of possible values should be entered, separated by vertical bars (|). For example, an entry of Sun | Mon | Tues | Wed | Thurs | Fri | Sat would limit the acceptable values to abbreviations for days of the week. When working with a SOX or XSDL schema, there are more options available for constraining data types. For example, an attribute of type number could be constrained by a maximum value.
If the same constraints are used for multiple attribute types within a DTD, consider creating reusable constraints, which can be accessed from the Constraints popup menu shown in Figure D.
Figure D - Reusable Constraints option for a DTD
Default values for attributes are specified in this column. Default values provide a value for an attribute even when document authors do not declare values for the attribute in their documents. In addition, if a default value is provided and the Required checkbox is checked, XML Authority will declare that value to be fixed - document authors do not have to include the attribute declaration, but even if they do, its value must be set to the value in the Default column.
The Required checkbox specifies that document authors must provide a value for this attribute in order for their documents to be valid. If the Required checkbox is checked and a Default value is provided, XML Authority will make the attribute declaration fixed as noted above.
Copyright 2000 Extensibility, Inc.
Suite 250, 200 Franklin Street, Chapel Hill, North Carolina 27516