Re: three proposed additions to sxml

Andy Wingo <[email protected]> Wed, 19 Mar 2014 23:11:41 +0100
Newsgroups gmane.lisp.scheme.ssax-sxml
Message-ID <[email protected]>
Hi :)

On Mon 10 Mar 2014 07:45, [email protected] writes:

> Let me attempt to summarize:
>> 1. Entity references *may* be represented by lists of two elements, with 
>> the first element the symbol "&" and the second element either a number 
>> or a case-sensitive symbol, meaning, respectively, a numeric character 
>> entity reference or a named entity reference.
>> Examples: (& 151)  (&copy)  (& rArr)  (& |rArr|)
>
> You are talking about internal entity references, because external
> entity references are already represented as
>         (*ENTITY* public-id system-id)
> So, you are suggesting to add
>         (& symbol-or-number)
>
> I'm intrigued by Andy Wingo's comment: ``Seems to me that for Scheme
> where we have unquote and different ways to specify characters in
> string literals, including named references, this isn't that
> important.'' Andy, could you expand on this with more examples?

Sure.  One common use case for parsed entities is representing
codepoints that are hard to type, like &rArr;.  (Of course there has to
be a suitable entity definition of "rArr" available.)

If you are authoring SXML, then you have Scheme, so you can `(... ,rArr
...) for some suitable Scheme definition of rArr.  That's what I meant
by "unquote".  Unquote also works well for arbitrary SXML subtrees, not
just funny characters.

By "ways to specify specific characters in string literals", I was under
the mistaken impression that Scheme had a standard way to get a
character given its unicode name, and that there would be an escape
syntax for that in string literals.  My embarrassing confusion there!
But if that were the case, and it could be in some implementations, then
that would be a suitable language-level solution to the problem of
"insert a right arrow here": "and as you see, x \_right-arrow y..."

If you are parsing XML and you see a parsed internal entity reference,
you almost always want to have it expand out to a sequence of characters
-- as the SSAX parser does.

Perhaps Neil has a different use case, or I am misunderstanding.

Regards,

Andy
-- 
http://wingolog.org/

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech