XML Schema Home

XML::Schema::Attribute

Table of Contents


Synopsis


Description

This module implements an object class for representing XML attributes with XML Schema. An attribute is, of course, a 'name="value"' pair within the starting tag of an XML element. In the following example, the attributes are named 'id' and 'name'.

Attribute are defined as having a specific type which determines what the acceptable values can be. These types are implemented by various objects derived from the XML::Schema::Type::Simple module. There are over 30 inbuilt simple type, defined in the XML::Schema::Type::Builtin module, and which include things like string, integer, float, time, date, and so on. Furthermore, you can extend these basic types to create your own custom simple types by applying additional validation facets.

An attribute can also define default and fixed values for itself. A fixed constraint specifies a value that the attribute must have, if present in a particular instance document. A default value can be specified for attributes that are missing.

An attribute can be defined within a particular scope. Usually, it is within the definition of a complex type, but can also exist within an attribute group. The attribute communicates with its enclosing scope to resolve its type name (e.g. 'string') with a type object. This allows types to effectively be used before they are defined, and also for attributes to be relocated for use in different scope (e.g. as part of an attribute group) and to resolve the correct type in each location.


Methods

Perl XML::Schema Documentation