chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Lowdown & sxml-serializer not working together


From: Matt Gushee
Subject: Re: [Chicken-users] Lowdown & sxml-serializer not working together
Date: Fri, 23 Aug 2013 22:24:58 -0600

Hello again--

Well, I'm running into a new problem with SRV:send-reply. By following
the documentation, I managed to create a rule set that escaped problem
characters i the manner I want. But now, working with the complete
document, I discover that some of the non-element nodes are not
handled properly. The SXML form of my document starts like this:

  (*TOP*
    (@ (*NAMESPACES*
      (#f "http://www.w3.org/1999/xhtml";)
      (cvt "http://xmlns.therebetygers.net/civet/0.1";)))
    (*PI* xml "version=\"1.0\" encoding=\"utf-8\"")
    (html
      (@ (xml:lang "en") (lang "en"))

But when I serialize it with (SRV:send-reply (pre-post-order tree
<rules>)), the output begins like this:

  <*TOP*
      *NAMESPACES*="http://www.w3.org/1999/xhtml
       cvt="http://xmlns.therebetygers.net/civet/0.1"";>
  <*PI*>xmlversion=&quot;1.0&quot; encoding=&quot;utf-8&quot;</*PI*>
  <html xml:lang="en" lang="en">

... which is obviously not quite right. I suppose it should be
possible to create conversion rules for the *TOP*, *NAMESPACES*, and
*PI* nodes, but I don't understand the syntax well enough. Are there
any examples out there of how to do this?

--
Matt Gushee

On Thu, Aug 22, 2013 at 3:01 PM, Moritz Heidkamp
<address@hidden> wrote:
> Hi Matt,
>
> Matt Gushee <address@hidden> writes:
>> markdown->sxml converts whitespace in the input to character objects,
>> or lists of character objects, e.g.:
>>
>>    '(#\space)
>>    #\newline
>>
>> ... but serialize-sxml can't handle these: evidently it wants either
>> strings or symbols. I haven't found any arguments or parameters in
>> either egg that seem to be able to affect this behavior.
>
> yeah, Lowdown is cheating a bit here. Those individual characters fall
> right out of the parser and it would require an additional walk of the
> result to turn them into strings. As you already found out, this is not
> really part of the SXML spec but most tools allow characters just fine
> (sxml-serializer is an exception here and is particularly strict). Same
> applies to the additional list wrapping. I usually serialize SXML like
> this:
>
>   (use sxml-transforms)
>   (define some-data '(some #\d (#\a "ta")))
>   (SRV:send-reply (pre-post-order some-data) universal-conversion-rules))
>
> Which outputs:
>
>   <some>data</some>
>
> As you can see, universal-conversion-rules and SRV:send-reply (what's
> the deal with that name?) don't care much about the structure. Note that
> characters will not be entity escaped though, they are just passed
> through as-is.
>
> However, I do take your point and I think if I advertise Lowdown as
> producing SXML I should better change it to produce SXML according to
> spec :-) I hope I will get around to changing this soon but can't
> promise when. I also hope the workaround above will serve you until
> then!
>
> Moritz



reply via email to

[Prev in Thread] Current Thread [Next in Thread]