[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

XLink implementation on Scheme


I'm working on implementation of XLink on Scheme. 
I have currently made a prototype of an extension to 
a SSAX parser which understands XLink markup. The
source code for Gambit, PLT, Chicken and Guile is
available at

The xlink-parser is a specialized SSAX parser. In
fact, it uses Oleg Kiselyov's SSAX:XML->SXML function
as a ptototype, adding some extra features to it. The
xlink-parser function has the same arguments as a 
SSAX:XML->SXML function, i.e.
 port - an input port for an XML document
 namespace-prefix-assig - namespace prefixes

The result is presented as a list of two elements:
 (sxml-tree  remote-resources-participating-in-links)
 sxml-tree is an SXML presentation of a document (the
   result is equal to the result of SSAX:XML->SXML 
   function, if applyed to the same document) 
 remote-resources-participating-in-links is itself a
   list, it contains all remote resources which are
   declared by XLink markup presented in a document
   (it is a null list if there are no XLink elements
   in a document):

remote-resources-participating-in-links = 
  (remote-resource remote-resource ...)
remote-resource = (URI role? linkbase? XPointer-path
  position element)
URI - URI of a remote resource
role? - a boolean value: whether the URI denotates a
linkbase? - a boolean value: whether the URI is a
XPointer-path - a path within a remote document (a
  string in a current version)
position - a position in a parsed file where this
  resource was encountered (for error messages)
element - an SXML list representing the element where
  this URI was declared

xlink-parser also has a side effect. It checks XLink
constraints and reports of an error if some constraint
is not fulfilled (the parsing is not terminated,
i.e. it can report of multiple errors). The current
version of the program is able to check the following
XLink constraints:

 Constraint: Attributes on Locator Element
 The locator-type element must have the locator
 attribute (see 5.4 Locator Attribute (href)). The
 locator attribute (href) must have a value supplied.

 Constraint: No Arc Duplication
 Each arc-type element must have a pair of from and to
 values that does not repeat the from and to values
 (respectively) for any other arc-type element in
 the same extended link; that is, each pair in a link
 must be unique.

 Constraint: type Value
 The value of the type attribute must be supplied. The
 value must be one of "simple", "extended", "locator",
 "arc", "resource", "title", or "none".

 Constraint: show Value
 If a value is supplied for a show attribute, it must
 be one of the values "new", "replace", "embed", 
 "other", and "none".

 Constraint: actuate Value
 If a value is supplied for an actuate attribute, it
 must be be one of the values "onLoad", "onRequest",
 "other", and "none".

 Constraint: label, from, and to Values
 The value of a label, from, or to attribute must be
 an NCName. If a value is supplied for a from or to
 attribute, it must correspond to the same value for 
 some label attribute on a locator- or resource-type
 element that appears as a direct child inside the
 same extended-type element as does the arc-type

The xlink-parser is unable to read any DTD yet.
I would be extremely grateful for your suggestions
and considerations.   

Dmitry Lizorkin