* sxml boolean
@ 2012-03-11 10:24 john
2012-03-31 6:56 ` s9nn9s
2012-03-31 15:46 ` Mark H Weaver
0 siblings, 2 replies; 5+ messages in thread
From: john @ 2012-03-11 10:24 UTC (permalink / raw)
To: guile-user
Hi Guilers...
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>. 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.
Any thoughts?
Cheers,
John
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: sxml boolean
2012-03-11 10:24 sxml boolean john
@ 2012-03-31 6:56 ` s9nn9s
2012-03-31 14:47 ` john
2012-03-31 15:46 ` Mark H Weaver
1 sibling, 1 reply; 5+ messages in thread
From: s9nn9s @ 2012-03-31 6:56 UTC (permalink / raw)
To: guile-user
john <jptmoore@gmail.com> writes:
> Hi Guilers...
>
> 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>. 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.
>
> Any thoughts?
>
> Cheers,
>
> John
since (if "" #t #f) ==> #t, an empty string between to <foo></foo> to
represent #t seems both right and least verbose.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: sxml boolean
2012-03-31 6:56 ` s9nn9s
@ 2012-03-31 14:47 ` john
0 siblings, 0 replies; 5+ messages in thread
From: john @ 2012-03-31 14:47 UTC (permalink / raw)
To: s9nn9s; +Cc: guile-user
On 31 March 2012 07:56, s9nn9s <s9nn9s@gmail.com> wrote:
> john <jptmoore@gmail.com> writes:
>
>> Hi Guilers...
>>
>> 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>. 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.
>>
>> Any thoughts?
>>
>> Cheers,
>>
>> John
>
> since (if "" #t #f) ==> #t, an empty string between to <foo></foo> to
> represent #t seems both right and least verbose.
>
>
But (sxml->xml '(foo #f)) also produces <foo></foo>.
Cheers,
John
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: sxml boolean
2012-03-11 10:24 sxml boolean john
2012-03-31 6:56 ` s9nn9s
@ 2012-03-31 15:46 ` Mark H Weaver
2012-03-31 18:18 ` john
1 sibling, 1 reply; 5+ messages in thread
From: Mark H Weaver @ 2012-03-31 15:46 UTC (permalink / raw)
To: john; +Cc: guile-user
Hi John,
john <jptmoore@gmail.com> 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:
http://okmij.org/ftp/Scheme/SXML.html
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.
Does that make sense?
Regards,
Mark
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: sxml boolean
2012-03-31 15:46 ` Mark H Weaver
@ 2012-03-31 18:18 ` john
0 siblings, 0 replies; 5+ messages in thread
From: john @ 2012-03-31 18:18 UTC (permalink / raw)
To: Mark H Weaver; +Cc: guile-user
Hi Mark,
On 31 March 2012 16:46, Mark H Weaver <mhw@netris.org> wrote:
> Hi John,
>
> john <jptmoore@gmail.com> 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:
>
> http://okmij.org/ftp/Scheme/SXML.html
>
> 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.
>
> Does that make sense?
>
> Regards,
> Mark
Yes it does. Thanks for the explanation.
Cheers,
John
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-03-31 18:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-11 10:24 sxml boolean john
2012-03-31 6:56 ` s9nn9s
2012-03-31 14:47 ` john
2012-03-31 15:46 ` Mark H Weaver
2012-03-31 18:18 ` john
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).