On Mon, Sep 9, 2019 at 7:41 AM Lassi Kortela <xxxxxx@lassi.io> wrote:

Great, thanks. I'll read up on those. There seem to be lots of Scheme
SXML libraries already; it's just a matter of organizing them.

*groan*.  There are far too many with overlapping, partial, and broken functionality.  The Curse of Lisp <http://www.winestockwebdesign.com/Essays/Lisp_Curse.html> has struck with a vengeance.  Read the essay as well as the linked essay on the bipolar Lisp programmer if you haven't already; it's core to what I'm trying to do with R7RS-large.

The core of SXML format is a Good Thing:  an element is a list where:

a) the first object is the element name as a symbol

b) the second (optional) object is  a pair (@ . alist), where alist maps attribute names as symbols to attribute values as strings

c) the remaining objects are strings (text) or lists (child elements).  Characters, symbols, and numbers may or may not be allowed; if so, they are coerced to strings.

I wrote a spec for mapping the above core SXML to and from MicroXML, a W3C-designed but not W3C-approved subset of XML with exactly this data model.  See <https://dvcs.w3.org/hg/microxml/raw-file/tip/spec/microxml.html>; only 10 pages instead of over a hundred for XML + namespaces + Infoset.  But I decided I didn't want to do the implementation, which allowed both callback and streaming parsing:  too big, too much like things I've done wearily often in the past.


The rest of the cruft around SXML is needed only to allow a few marginal features:

1) Processing instructions in the data model (as opposed to processed on the fly by the parser).

2) Comments in the data model.

3) PIs and comments outside the top-level element, which require an above-the-top-level pseudo-element to hold them.

4) Neurotic XML: binds more than one prefix to the same URI.

5) Psychotic XML: binds the same prefix to different URIs in different element scopes, either disjoint or nested.

With neither 4) nor 5) you can just use XML prefixes in place of namespaces and maintain a separate prefix-to-URI mapping outside the SXML tree.


John Cowan          http://vrici.lojban.org/~cowan        xxxxxx@ccil.org
The present impossibility of giving a scientific explanation is no proof
that there is no scientific explanation. The unexplained is not to be
identified with the unexplainable, and the strange and extraordinary
nature of a fact is not a justification for attributing it to powers
above nature.  --The Catholic Encyclopedia, s.v. "telepathy" (1913)