The Hook, a single element schema language
12:48, 7 Feb 2001 UTC | Eric van der Vlist

Rick Jelliffe has posted a proposal for The Hook, an experimental terse schema language using a single element which allows checking the relatives and content of each XML node.

The xml-dev list has seen a rich and constructive exchange of emails comparing the approaches of different schema languages that has been summarized by Tim Bray:

"I must say that it's a long time since I've *enjoyed* reading xml-dev, but this last week's worth has been an exception. There is a tremendous amount to be learned here."

In one part of this long thread, Rick Jelliffe proposed a terse schema language to answer the following question: "Does this element have a feasible name, ancestry, previous-siblings and contents?" and that would be "like a checksum for a schema":

"A Hook schema is an element containing a list of element names, some of which may be grouped by square brackets. This list represents a certain ordering of the names and validation consists of checking conformity to this ordering."

The result is very concise as can be shown by the following schema describing XHTML Basic:

 <hook:order targetNamespace="" >
  html head  [ title; meta. link. base. ]   
  body [ a br. blockquote caption; div  dl; form h1; h2; h3; h4; h5; h6;  
        img. ol; p; pre; table; ul; ]  
  [ tr;  dt; dd; li;  input; label; select; textarea; ]  [ td option. ]
  [ abbr acronym address cite code dfn em kbd q samp span strong var object; ] 

Joe English praised the proposal on xml-dev and has proposed a SAX style validation algorithm and, in a later post, validity check diagrams and formulae.

Noting on the Schematron mailing list that Hook "is as far from XML Schemas as is possible, 'only one element!'" Jelliffe wondered if a similar formal characterization of Schematron couldn't be created and has invited mathematicians and theoretical computer scientists to give it a try.

xmlhack: developer news from the XML community

Front page | Search | Find XML jobs

Related categories