extensibility

Processing Data Types


XML 1.0 supports only some of the data types that XML Authority provides. If you need to build applications that use the data typing information, you'll need to add a layer in your application that reads the data type information (supplied as default attribute values) and checks element and attribute values to make certain that they're of the right type.

XML Authority uses a simple set of conventions to identify element and attribute data types within XML 1.0 representations of schemas. Data types are identified by fixed attribute values that use the approach of SGML General Architectures. ( Technically, XML Authority is using an XML-compatible derivation of the "lextype" architectural form provided by the General Architecture, ISO/IEC 10744 (HyTime), clause A.5.4.) Data type information for elements is stored using attributes prefixed with 'e-', while data type information for attributes is stored using attributes prefixed with 'a-'.

XML Authority supports four different kinds of data typing properties internally, though only the top-level data type (dtype) is accessible through the interface of version 1.1. (All four data type properties are created during an import from an ODBC source.) The four properties are listed below.

Name

Content

dtype

The dtype property identifies the top-level data type of the element or attribute. The information stored in dtype is what is normally available throughout the XML Authority interfaces for element and attribute data typing - like string, number, date, etc.

dsize

The dsize property defines the size of the data. For strings, this is typically a character value, for integers and floats, it represents the number of bytes, and for numbers it identifies the number of digits that may appear before and after the decimal point. The dsize property is only used for certain data types, and in XML Authority 1.0 is only used for strings imported from ODBC sources.

pkey

The pkey property identifies which element or attribute type contains the primary key of a table. The pkey property is only used on elements representing tables. Its value is the name of the element or attribute type containing the primary key.

fkey

The fkey property identifies which element or attribute type contains the primary key of a table matching the contents of this element or attribute type. The fkey property is only used on elements and attributes representing foreign keys within tables. Its value is the name of the element or attribute containing the primary key to which the foreign key is connected.

The most commonly used property is definitely the dtype property. When used to identify datatypes of elements, it will be implemented as an attribute named 'e-dtype' and contain the data type name as its value. For example, to declare that the contents of the element type 'myNumber' are of type 'number', XML Authority would create an attribute type declaration like:

<!ATTLIST myNumber
   e-dtype NMTOKEN #FIXED 'number'>

Attribute data type declarations are a little more complicated. There will only be one attribute named 'a-dtype', containing datatype information for all the attributes with data types. If myNumber has the attributes name - a string - and exponent - an integer, both those descriptions need to be stored in the a-dtype attribute. The contents of that attribute are a list of attribute names and data types, separated by spaces:

<!ATTLIST myNumber
   e-dtype NMTOKEN #FIXED 'number'>
   a-dtype NMTOKENS #FIXED 'name string exponent int'

The same rules for defining the attribute declarations work for the other properties. Processing software will have to know how to extract this information and apply it - XML 1.0 parsers will simply pass it to the application.

In addition, user-defined data types can make this task more complex but more powerful. Using notations, users can define their own data types and associate processing with them. These notations can provide you with a powerful approach to building integrated data type validation services, if you can handle the processing. Your application will probably need to provide an extensible interface which users can build their own data type validation modules to support their extensions, or you can simply list the accepted notations your application can handle.

Normally, XML Authority hides this information. You can see and edit it in the Source Window if needed.

Copyright 2000 Extensibility, Inc.

Suite 250, 200 Franklin Street, Chapel Hill, North Carolina 27516