Re: entities in SXML

"Neil W. Van Dyke" <[email protected]> Thu, 10 Mar 2005 20:21:14 -0500
Newsgroups gmane.lisp.scheme.ssax-sxml
Message-ID <[email protected]>
Oleg A. Paraschenko <[email protected]> writes at 03:03 11-Mar-2005 +0300:
> Unfortunately, this sort of entities doesn't fit to SXML
> specification.  So I'm going to use my SXML dialect for them (*REF* is
> for "reference"):
[...]
> ... (*REF* "product") (*REF* "nbsp") (*REF* "mdash") " AAA" ...

Oleg Kiselyov can explain better than I can about character entity
references in SXML.

But regarding a SXML dialect for representing the entities unexpanded
(such as we might like to do for representing HTML in SXML when our
Scheme implementation's strings are only ASCII or an 8-bit extended
ASCII), HtmlPrag 0.13 has introduced a special "&" form:

    (load "htmlprag.scm")

    (define shtml (html->shtml "&product;&nbsp;&mdash; AAA"))

    shtml
    ;==> (*TOP* (& product) (& nbsp) (& mdash) " AAA")

    (shtml->html shtml)
    ;==> "&product;&nbsp;&mdash; AAA"

The second element of the "&" form can be a string, symbol, or (for
character ordinal values) a nonnegative integer:

    (& "rArr")
    (& rArr)
    (& 151)

I am not completely happy with adding a new special form in an SXML
dialect, since that inevitably complicates the use of other SXML tools.

But the "Prag" in "HtmlPrag" *is* short for "pragmatic", and having a
human-editable character entity reference form looks like it just might
be the pragmatic choice for some of my HTML needs (at least until
Unicode is more widely supported in Scheme implementations and other
tools).

http://www.neilvandyke.org/htmlprag/


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click