WARNING: This server is unstable and will be retired in the next days.
If you want to keep this forum available, please request immediately a migration
on the Nabble Support forum.
Forums that don't receive any migration request will be deleted forever.
john <jptmoore@...> writes:
> When using (sxml simple) a conversion from boolean has no value. For
> example, (sxml->xml '(foo #t)) produces <foo></foo>. Is this intended
> or a bug? I was expecting perhaps something like <foo>true</foo>,
> <foo>1</foo> or <foo>#t</foo>.
(foo #t) is not valid SXML, and 'sxml->xml' assumes valid SXML,
so the result is undefined. The SXML grammar is defined at:
Arbitrary Scheme values are _not_ allowed, and there is no attempt to
guess how the user would like those to be formatted. A child of an
element must either be another element, a processing instruction, a
comment, an entity, or character data. Character data must be
represented as a Scheme string, and all the others are represented by
Scheme lists. See the spec for details.
> The first two make more sense to me in terms of validating against XML
> Schema but I think any value is better than no value.
We didn't design SXML. Oleg Kiselyov did. However, I think he made the
right decision here. IMO, it would have been a mistake to define a
behavior for other Scheme values. Whatever behavior he chose, it would
not be what many users wanted, and it would make the definition and
implementation of SXML considerably more complex.
The only advantage would be a minor convenience in case the user
happened to want the same formatting choices that Oleg had made. It is
easy and far more flexible for the user to write their own converter
that formats Scheme values as they need for their specific application.