XML Module Specification Language (v 1.24.2)


Table of Contents

I. Introduction
1. Justification
Purpose
XML Language
Module Specification Schema
2. Editing a Module Description
Emacs
Nxml Prerequisites
Installation
.emacs (nxml mode)
PSGML Prerequisites
.emacs (SGML mode)
Creating a Module Specification
Validating a Module Description
3. Example
II. Module Description Element Reference
I. Module Description Element Reference
author - Full name of one author
authors - List a module's authors
caption - A description of an image
ccfile - Name of a c++ source file
cfile - Name of a c source file
component - Module description top-level element.
datatype - Name of a SCIRun datatype
description - description of some aspect of a module
developer - Documentation intended for module developers
examplesr - Specifies the path of a SCIRun network file which demonstrates the use of a module. Deprecated
ffile - Names a fortran source file
figure - A captioned image
file - Describe type and content of data in a file
gui - Documents the use of a module's graphical user interface
img - The pathname of an image file
implementation - A list of a module's c++, c, and fortran source files
inputs - Documents a module's inputs
label - A label (text) associated with a GUI widget.
modref - Cross-reference to a module specification document.
outputs - Documents a module's outputs
io - Specifies a module's inputs and outputs
net - Demonstrates the use of a module within a small network
nets - Documents the use of a module via one or more simple networks
overview - Lists a module's authors and describes a module's purpose.
p - A paragraph
parameter - Describes one GUI parameter
plan - A testing plan for a module
section - A titled section sub-division
step - Describes one step in a module testing process
summary - summarizes a module's purpose
testing - Documents a plan for testing a module
ulink - A URL-based link.
widget - The generic name of a GUIelement (e.g. scrollbar)
xref - An intra-document cross-reference

Introduction

Chapter 1. Justification

This section introduces the SCIRun module specification language.

Purpose

Writing a module specification should be one of the first steps in the design and implementation of a module.

A module specification documents the use, design, implementation, and testing of a SCIRun module.

HTML and PDF documention for a module are generated from a module specification. A module's source code can be partially generated from its module specification.

A module specification is written in an XML-based mark-up language. The rest of this document describes the grammer and semantics of the module specificition language.

XML Language

An XML formulation of the module specification is used to achieve the following goals:

Data centric viewpoint

Represent the module specification as a set of data to be used in several contexts.

Uniformity

Specify all modules the same way

Validation

Validate (check for correctness and completeness) module specifications.

The module specification mark-up language is similar in concept to HTML, but has a different, smaller set of tags, and a simpler, more regular set of document composition rules.

Module Specification Schema

An XML Schema defines a set of elements, element attributes, and the way they may be used in order to produce a valid document. The module specification language definition is available as a DTD and as a RELAX NG schema.

The module specification DTD can be found, relative to the top of the SCIRun tree, here:

src/Dataflow/XML/component.dtd

. The RELAX NG schema can be found here:

src/Dataflow/XML/component.rnc

Chapter 2. Editing a Module Description

Emacs

Any text editor can be used to create a module specification document's content. However, because it is easy to get lost in the “noise” of XML syntax, it is best to use an XML/Schema (e.g. DTD, Relax NG) aware editor. This type of editor will help construct a valid module specification document. Emacs is one such editor.

Emacs supports editing environments PSGML mode and nxml mode. These modes highlight XML syntax, indent nested elements and their content, and suggest elements based on the position of the insertion point. Nxml mode performs on-the-fly validation (PSGML does not).

Nxml mode can be downloaded from:

	http://www.thaiopensource.com/download/
      

Information on the use of nxml mode can be found here:


http://www.xmlhack.com/read.php?item=2061   
      

PSGML mode can be downloaded from:

	http://sourceforge.net/projects/psgml/	  
      

Information on the use of psgml mode can be found here:

	http://www.lysator.liu.se/~lenst/about_psgml/	  
      

It is strongly recommended that content is created with one of these editing modes in emacs. Note also that these modes are excellent for composing any xml (e.g. xhtml, DocBook, etc) content.

This author recommends nxml mode because it is simpler to use than psgml mode, performs on-the-fly content validation, and is actively supported.

Nxml Prerequisites

Installation

Nxml mode is commonly installed in a sub-directory of emacs'site-lisp directory, typically /usr/share/emacs/sitelisp/nxml.

After installing nxml, file component.rnc must be copied to nxml/schema.

The following lines must be added to file nxml/schema/schemas.xml:

	  <documentElement prefix="" localName="component" typeId="Component"/>
	  <typeId id="Component" uri="component.rnc"/>
	

.emacs (nxml mode)

The following lisp code should be inserted into Emacs' .emacs initialization file prior to using nxml mode:

(load "nxml/rng-auto")
(setq auto-mode-alist
(append
'(("\\.xml" . nxml-mode)
("\\.html" . nxml-mode))
auto-mode-alist))
(make-face 'nxml-delimited-data-face)
(make-face 'nxml-name-face)
(make-face 'nxml-ref-face)
(make-face 'nxml-delimiter-face)
(make-face 'nxml-comment-content-face)
(make-face 'nxml-comment-delimiter-face)
(set-face-foreground 'nxml-delimited-data-face "grey55")
(set-face-foreground 'nxml-name-face "#257A25")
(set-face-foreground 'nxml-ref-face "#9292C9")
(set-face-foreground 'nxml-delimiter-face "#9292C9")
(set-face-foreground 'nxml-comment-content-face "orange")
(set-face-foreground 'nxml-comment-delimiter-face "orange")
	

PSGML Prerequisites

.emacs (SGML mode)

The following lisp code should be inserted into Emacs' .emacs initialization file prior to using SGML mode:

;; Setup autoloading
(require 'psgml)
(autoload 'sgml-mode "psgml" "Major mode to edit SGML files" t)
(autoload 'xml-mode "psgml" "Major mode to edit XML files." t) 
(setq auto-mode-alist
(append
'(("\\.xml" . xml-mode)
("\\.html" . sgml-mode))
auto-mode-alist))

;; Indent tags but not content.
(setq sgml-indent-step 2)
(setq sgml-indent-data nil)

;; Create appropriate "faces"
(make-face 'sgml-start-tag-face) 
(make-face 'sgml-end-tag-face) 
(make-face 'sgml-entity-face) 
(make-face 'sgml-doctype-face)
(make-face 'sgml-comment-face) 

;; Assign colors to faces
(set-face-foreground 'sgml-start-tag-face "grey55") 
(set-face-foreground 'sgml-end-tag-face "seagreen") 
(set-face-foreground 'sgml-entity-face "yellow2") 
(set-face-foreground 'sgml-doctype-face "orange3") 
(set-face-foreground 'sgml-comment-face "lightblue") 

;; Assign faces to sgml objects
(setq sgml-set-face t)
(setq sgml-markup-faces 
'((comment   . sgml-comment-face) 
(start-tag . sgml-start-tag-face) 
(end-tag   . sgml-end-tag-face) 
(doctype   . sgml-doctype-face) 
(entity    . sgml-entity-face))) 
	

Creating a Module Specification

To create a new module specification (using nxml mode) follow these steps:

  1. Create a new file and insert the following:

    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE component SYSTEM "path-to/component.dtd">
    
    <component name="component-name" category="category-name">
      
    </component>
    	  
  2. Save, close, and re-open the file (this will force nxml/sgml mode to load the proper schema when the file is re-opened).

  3. Insert remaining content using features of nxml or psgml mode.

Validating a Module Description

A validation service for module specification xml files can be found here:

http://www.cvrti.utah.edu/~dustman/srvalidate.html

Chapter 3. Example

Huh!

    

Module Description Element Reference

Organization

Each element reference is organized as follows:

Element name and short summary

The first part of each element reference provides the name of an element and a short summary of its purpose.

Synopsis

The synopsis consists of two parts. The first part of the synopsis presents an element's content model using a DTD-like syntax. The second part of the synopsis lists the name, type, and default value of each of the element's attributes.

Description

Describes the element's purpose and use.

Attributes

Describes the purpose and use of each attribute.

Parents

Lists the element's parents.

Content Models

An element's content model is the DTD fragment describing the element's structure. The content model lists an element's children and the number and order of their occurrence. A content model may contain keywords (e.g., #PCDATA), element names, and tokens that indicate child grouping (“(” and “) ”), sequencing (“,” separates children occuring in sequence), repetition (“*”, zero or more; “+”, one or more; “?”, zero or one), and alternation (“|” separates choices) of children.

Attribute Types

Attribute values are one of five types:

Enumeration

A choice of one or more string literals.

CDATA

A string containing any characters except “<” and “&

ID

A string uniquely identifying an element. An ID string must start with a letter, underscore, or colon and may then contain any combination of letters, digits, and the characters “.”, “-”, “_”, “:

IDREF

A string matching the value of one element's id attribute.

NMTOKEN

A string consisting of any combination of letters, digits, and the characters “.”, “-”, “_”, “:

Table of Contents

I. Module Description Element Reference
author - Full name of one author
authors - List a module's authors
caption - A description of an image
ccfile - Name of a c++ source file
cfile - Name of a c source file
component - Module description top-level element.
datatype - Name of a SCIRun datatype
description - description of some aspect of a module
developer - Documentation intended for module developers
examplesr - Specifies the path of a SCIRun network file which demonstrates the use of a module. Deprecated
ffile - Names a fortran source file
figure - A captioned image
file - Describe type and content of data in a file
gui - Documents the use of a module's graphical user interface
img - The pathname of an image file
implementation - A list of a module's c++, c, and fortran source files
inputs - Documents a module's inputs
label - A label (text) associated with a GUI widget.
modref - Cross-reference to a module specification document.
outputs - Documents a module's outputs
io - Specifies a module's inputs and outputs
net - Demonstrates the use of a module within a small network
nets - Documents the use of a module via one or more simple networks
overview - Lists a module's authors and describes a module's purpose.
p - A paragraph
parameter - Describes one GUI parameter
plan - A testing plan for a module
section - A titled section sub-division
step - Describes one step in a module testing process
summary - summarizes a module's purpose
testing - Documents a plan for testing a module
ulink - A URL-based link.
widget - The generic name of a GUIelement (e.g. scrollbar)
xref - An intra-document cross-reference

Module Description Element Reference


Table of Contents

author - Full name of one author
authors - List a module's authors
caption - A description of an image
ccfile - Name of a c++ source file
cfile - Name of a c source file
component - Module description top-level element.
datatype - Name of a SCIRun datatype
description - description of some aspect of a module
developer - Documentation intended for module developers
examplesr - Specifies the path of a SCIRun network file which demonstrates the use of a module. Deprecated
ffile - Names a fortran source file
figure - A captioned image
file - Describe type and content of data in a file
gui - Documents the use of a module's graphical user interface
img - The pathname of an image file
implementation - A list of a module's c++, c, and fortran source files
inputs - Documents a module's inputs
label - A label (text) associated with a GUI widget.
modref - Cross-reference to a module specification document.
outputs - Documents a module's outputs
io - Specifies a module's inputs and outputs
net - Demonstrates the use of a module within a small network
nets - Documents the use of a module via one or more simple networks
overview - Lists a module's authors and describes a module's purpose.
p - A paragraph
parameter - Describes one GUI parameter
plan - A testing plan for a module
section - A titled section sub-division
step - Describes one step in a module testing process
summary - summarizes a module's purpose
testing - Documents a plan for testing a module
ulink - A URL-based link.
widget - The generic name of a GUIelement (e.g. scrollbar)
xref - An intra-document cross-reference

Name

author — Full name of one author

Synopsis

Content Model

author ::= #PCDATA

Description

Element is the full name of one author

Parents

The following elements contain author: authors


Name

authors — List a module's authors

Synopsis

Content Model

authors ::= author+

Description

Element authors lists the authors of a module.

Parents

The following elements contain authors: overview


Name

caption — A description of an image

Description

Element caption is a description of an image.

Arguably, caption should allow paragraphs and other block-level elements.

Parents

The following elements contain caption: gui, figure


Name

ccfile — Name of a c++ source file

Synopsis

Content Model

ccfile ::= #PCDATA

Description

Element ccfile specifies the name of one c++ source code file.

Parents

The following elements contain ccfile: implementation


Name

cfile — Name of a c source file

Synopsis

Content Model

cfile ::= #PCDATA

Description

Element cfile specifies the name of one c source code file.

Parents

The following elements contain cfile: implementation


Name

component — Module description top-level element.

Synopsis

Content Model

component ::= overview, implementation?, io, gui?, nets? ,testing?
	  

Attributes

NameTypeDefault
nameCDATARequired
categoryCDATARequired

Description

Top-level module description element. All module descriptions start with this element. All other elements are enclosed by this one.

Attributes

name

Name specifies a module's name. Name's value must be unique among module names in a module's category.

category

Category specifies the module's category.


Name

datatype — Name of a SCIRun datatype

Synopsis

Content Model

datatype ::= (#PCDATA)

Description

Element datatype is the fully qualified name of a SCIRun datatype.

Parents

The following elements contain datatype: file, parameter, port


Name

description — description of some aspect of a module

Synopsis

Attributes

NameTypeDefault
idIDNone

Description

Element description is a small documentation environment. It is used in several places to document a particular aspect of a module. It offers many markup tags equivalent to those found in xhtml. A number of tags are unique to the task of writing module descriptions.

Attributes

id

Id is an identifying string for a description element. It must be unique within a module description and must begin with a letter.

Attribute id is used with element xref to create cross-references within a module description document.

Parents

The following elements contain description: device, file, gui, overview, parameter, plan, port


Name

developer — Documentation intended for module developers

Synopsis

Description

Element developer presents information intended for module developers. Developer's content model is similar to element description's content model, but may not be divided into sections.

Parents

The following elements contain developer: description, net, section, step.


Name

examplesr — Specifies the path of a SCIRun network file which demonstrates the use of a module. Deprecated

Synopsis

Content Model

examplesr ::= #PCDATA

Description

Specifies the path of a SCIRun network file which demonstrates the use of a module. Element examplesr is deprecated. Element nets is now used to demonstrate the use of a module in a network.

Parents

The following elements contain examplesr: overview


Name

ffile — Names a fortran source file

Synopsis

Content Model

ffile ::= #PCDATA

Description

Element ffile specifies the name of one fortran source code file.

Parents

The following elements contain ffile: implementation


Name

figure — A captioned image

Synopsis

Content Model

figure ::= (img,caption)

Attributes

NameTypeDefault
idIDNone

Description

Element figure is a captioned image.

Attributes

id

Id is an identifying string for a figure element. Id must be unique within a module specification and must begin with a letter.

Attribute id is used with element xref to create cross-references within a module specification document.

Parents

The following elements contain figure: description,desclistdef,developer,listitem,net,note,section,step,tip,warning


Name

file — Describe type and content of data in a file

Synopsis

Content Model

file ::= (description,datatype)

Description

Element file describes the type and content of data in a file.

Parents

The following elements contain file: inputs,outputs


Name

gui — Documents the use of a module's graphical user interface

Synopsis

Content Model

gui ::= ((description, parameter+, (img, caption?)*))+

Description

Element gui documents the use of a module's graphical user interface.

Use of content model fragment

(img,
	caption?)*

is deprecated. Instead, screenshots of a module's GUI should be presented within the description element using figures and xrefs.

Parents

The following elements contain gui: component


Name

img — The pathname of an image file

Synopsis

Content Model

img ::= (#PCDATA)

Description

Element img is the pathname of a file containing an image suitable for online presentation (e.g. jpg, gif, png, etc.

Parents

The following elements contain img: gui, figure


Name

implementation — A list of a module's c++, c, and fortran source files

Synopsis

Content Model

implementation ::= (ccfile|cfile|ffile)+

Description

Lists a module's c++, c, and fortran source files.

Parents

The following elements contain implementation: component.


Name

inputs — Documents a module's inputs

Synopsis

Content Model

inputs ::= (file|port|device)+

Attributes

NameTypeDefault
lastportdynamic Enumeration:
no
yes
no

Description

Element inputs specifies and documents a module's inputs. An input may come from a port, file, or device.

Attributes

lastportdynamic

Specifies whether a new instance of a module's last port is dynamically created when a connection is made to a module's last port.

Parents

The following elements contain inputs: io


Name

label — A label (text) associated with a GUI widget.

Synopsis

Content Model

label ::= (#PCDATA)

Description

Element label specifies text associated with a GUI widget.

Parents

The following elements contain label: parameter


Name

modref — Cross-reference to a module specification document.

Synopsis

Content Model

modref ::= (#PCDATA)

Attributes

NameTypeDefault
packageNMTOKENRequired
nameCDATARequired

Description

Element modref is a cross-reference to another module specification. Attributes name and package uniquely specify the referenced module. Modref may be empty or may contain cross-reference text. If modref is empty, suitable cross-refence text will be generated.

Attributes

name

Name of module to be referenced.

package

Name of package to which the referenced module belongs. The package name is spelled as it is in the source code tree.

Parents

The following elements contain modref: title, summary, author, caption, p.


Name

outputs — Documents a module's outputs

Synopsis

Content Model

outputs ::= (file|port|device)+

Description

Element outputs specifies and documents a module's outputs. An output may come from a port, file, or device.

Parents

The following elements contain outputs: io


Name

io — Specifies a module's inputs and outputs

Synopsis

Content Model

io ::= inputs, outputs

Description

Element io is a description of data entering and leaving a module's input and output ports.

Parents

The following elements contain io: component.


Name

net — Demonstrates the use of a module within a small network

Synopsis

Attributes

NameTypeDefault
idIDNone

Description

Element net is an environment for documenting the use of a module within a SCIRun network. Element net's content model is identical to element description's content model.

Attributes

id

Id is an identifying string for a description element. It must be unique within a module description and must begin with a letter.

Attribute id is used with element xref to create cross-references within a module description document.


Name

nets — Documents the use of a module via one or more simple networks

Synopsis

Content Model

nets ::= (net+)

Description

Element nets documents the use of a module via one or more simple networks

Parents

The following elements contain nets: component


Name

overview — Lists a module's authors and describes a module's purpose.

Synopsis

Content Model

overview ::= authors, summary, description, examplesr?

Description

Element overview lists a module's authors and describes a module's purpose.

Parents

The following elements contain overview: component.


Name

p — A paragraph

Description

Parents


Name

parameter — Describes one GUIparameter

Synopsis

Content Model

parameter ::= (widget,datatype,label,description)

Description

Element parameter documents the purpose and use of a module GUIparameter”.

Parents

The following elements contain parameter: gui


Name

plan — A testing plan for a module

Synopsis

Content Model

plan ::= (description, step+)

Description

Element plan outlines one plan for testing a module. Plan consists of a general test plan description followed by one or more specfic test plan steps.

Parents

The following elements contain element plan: testing


Name

section — A titled section sub-division

Synopsis

Attributes

NameTypeDefault
idIDNone

Description

Element section is a titled sub-division of the documentation elements description, net, step. Section elements may be nested.

Attributes

id

Id is an identifying string for a section element. It must be unique within a module description and must begin with a letter.

Attribute id is used with element xref to create cross-references within a module description document.

Parents

The following elements contain section: description, net, section, step.


Name

step — Describes one step in a module testing process

Description

Element step describes one step in a module's test plan.

Step's content model is identical to description's content model.

Parents

The following elements contain step: plan


Name

summary — summarizes a module's purpose

Synopsis

Description

Element summary summarizes a module's purpose. A summary should consist of only a few sentences.

Parents

The following elements contain summary: overview


Name

testing — Documents a plan for testing a module

Synopsis

Content Model

testing ::= (plan+)

Description

Element testing documents a plan for testing a module.

Parents

The following elements contain testing: component


Name

ulink — A URL-based link.

Synopsis

Content Model

ulink ::= (#PCDATA|firstterm|keyword|userinput|abbr|latex|path|emph|quote)

Attributes

NameTypeDefault
urlCDATARequired

Description

Element ulink is a URL-based link. Attribute url provides the link's target address. Ulink's content provides the link's text.

Attributes

url

Attribute url's value is the link's target URL.

Parents

The following elements contain ulink: title, summary, author, caption, p.


Name

widget — The generic name of a GUIelement (e.g. scrollbar)

Synopsis

Content Model

widget ::= (#PCDATA)

Description

Element widget is the generic name of an element in a GUI, e.g. “scrollbar”.

Parents

The following elements contain widget: parameter


Name

xref — An intra-document cross-reference

Synopsis

Content Model

xref ::=
	  (#PCDATA)

Attributes

NameTypeDefault
targetIDREFRequired

Description

Element xref is an intra-document cross-reference. Xref's target attribute provides the id of the cross-referenced element.

Attributes

target

Attribute target specifies the id of the cross-referenced element.

Parents

The following elements contain modref: title, summary, author, caption, p.