create-element-declaration

operator

Return type: element-declaration
Returns:        A new element-declaration with the given properties.

Syntax
create-element-declaration element-name
                attributes attribute-declarations
           (case-sensitive case-sensitivity)?
                   content content-model
    


Purpose

The operator create-element-declaration can be used to create a new element declaration.

The element-name is a string expression that becomes the declared name of the new element, and the content of the new element declaration is taken from the content-model argument.

The attribute-declarations argument is a shelf of attribute-declaration values. Each of the items that has a key specifies the declaration of the attribute whose name matches the key. The shelf may also contain keyless items, whose values must be attribute-declared-implied. These items are used as fallbacks for specified attributes whose name doesn't match any of the given keys.

For example, the following expression specifies an element named Text that requires an attribute named language, but also accepts any other attribute:

     create-element-declaration "Text"
                     attributes { create-attribute-declaration attribute-declared-name
                                                       default attribute-declared-required with key "language",
                                  create-attribute-declaration attribute-declared-cdata
                                                       default attribute-declared-implied }
                        content mixed-content-model
          

The case-sensitivity argument is a switch that determines how the specified attribute names and values are matched against the declared ones. An element-declaration obtained from a compiled XML DTD is always case-sensitive, while one from an SGML DTD is typically not. A hand-crafted element declaration returned by this function may choose one or the other. The declared attribute names and tokens are not affected by this argument. If the argument is not specified, the matching will be case-sensitive by default.