1 Defining XML Element and Attribute Types

1.1 define-element

syntax

The grammar for the define-element syntax is:

element-definition ::= (define-element (element-tag namespace-uri))
                     | (define-element (element-tag #f))
                     | (define-element element-tag)

element-tag must be a symbol. If present, namespace uri is a string containing a uri.

define-element introduces the following bindings:

The example below defines an element 'group':

(define-element group)

The code fragment below illustrates the use of both the constructor group and the predicate group?.

(group? "test") ; ==> #f
(group? (group "body")) ; ==> #t

1.2 define-attribute

syntax

The grammar for the define-attribute syntax is:

attribute-definition ::= (define-attribute (attribute-tag namespace-uri))
                       | (define-attribute (attribute-tag #f))
                       | (define-attribute attribute-tag)

attribute-tag must be a symbol. If present, namespace uri is a string containing a uri.

define-attribute introduces the following bindings:

The example below defines an attribute 'label':

(define-attribute label)

The code fragment below illustrates the use of both the constructor label: and the predicate label?.

(label? (group "body")) ; ==> #f
(label? (group label: "a" "body")) ; ==> "a"

 

 

Last modified: Sunday, April 24th, 2005 2:52:27pm
HTML generated using WebIt!.