This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: xml literals


works... yes but , i have find some interesting clues:

-still needing to use the literal to avoid the error:
Exception in thread "main" java.lang.Error: gnu.kawa.xml.MakeElement does not implement Externalizable
if you issue a literal:toString it avoids the compiler trying to "Externalize" an object it does know how to externs but know how to do it for it for String

example:
(set! html-literal
     	   #<td align="center">&[html-literal-table]</>)
     
     (set! html-literal-str (html-literal:toString))

no compile error

the problem is not specific to function call style but also with # literal, but after all perheaps it is the side effect of set! returning a literal which should be avoid in the code... i do not know.

-(simple ) slicing, a Kawa only feature seems to do not work always in literals, here his some test examples:

 ;;(apply html:table literal-rows-list)) ;; OK
	   ;;(html:table literal-rows-list)) ;; OK but non-sense
	   ;;(html:table @literal-rows-list)) ;; KO
	   ;;(html:table option-lst literal-rows-list)) ;; OK but non-sense
	   ;;(html:table @option-lst @literal-rows-list)) ;; KO
	   ;;#<table DIR="LTR" BORDER="1" width="312" id="table_observateurs">&[@literal-rows-list]</>) ;; KO
	   ;;#<table DIR="LTR" BORDER="1" width="312" id="table_observateurs">@&[literal-rows-list]</>) ;; OK
	   ;;#<table DIR="LTR" BORDER="1" width="312" id="table_observateurs">POPUP</>) ;; OK
	   ;;#<table>POP UP</>) ;; OK
	   ;;(html:table "POP UP")) ;; OK

for example this works:

(set! options-and-arguments-lst
	   (append option-lst literal-rows-list))

        (set! html-literal-table
	   (apply html:table options-and-arguments-lst)) ;; OK

but not those:
;;(html:table @literal-rows-list)) ;; KO
	   ;;(html:table option-lst literal-rows-list)) ;; OK but non-sense
	   ;;(html:table @option-lst @literal-rows-list)) ;; KO

the good thing is i finally succeed in making my program (in attachments) compiling and running by melting function call style and literal list but the both are working
 if you take some special cautions with side-effects and slicing too.

the output is not human readable:
<td align="center"><table xmlns="http://www.w3.org/1999/xhtml"; DIR="LTR" BORDER="1" width="315" id="table_observateurs"><tr><td DIR="LTR" ALIGN="LEFT">RGY</td><td DIR="LTR" ALIGN="LEFT">NuLL</td></tr><tr><td DIR="LTR" ALIGN="LEFT">LM</td><td DIR="LTR" ALIGN="LEFT">NuLL</td></tr><tr><td DIR="LTR" ALIGN="LEFT">BSL</td><td DIR="LTR" ALIGN="LEFT">NuLL</td></tr><tr><td DIR="LTR" ALIGN="LEFT">KHA</td><td DIR="LTR" ALIGN="LEFT">  ? ? </td></tr><tr><td DIR="LTR" ALIGN="LEFT">TME</td><td DIR="LTR" ALIGN="LEFT">  ? ? </td></tr><tr><td DIR="LTR" ALIGN="LEFT">TM</td><td DIR="LTR" ALIGN="LEFT">?</td></tr><tr><td DIR="LTR" ALIGN="LEFT">ABT</td><td DIR="LTR" ALIGN="LEFT">Abetti G.</td></tr><tr><td DIR="LTR" ALIGN="LEFT">AFR</td><td DIR="LTR" ALIGN="LEFT">Africano</td></tr><tr><td DIR="LTR" ALIGN="LEFT">AHN</td><td DIR="LTR" ALIGN="LEFT">Ahnert P. von</td></tr>.......

i think there is a way to include in Kawa literal some non interpreted character,i see in the doc, to have some  human readable html page,i will try this later.

regards,

Damien

Le Wednesday 07 June 2017 20:16:05 Per Bothner, vous avez écrit :
> On 06/07/2017 09:23 AM, Per Bothner wrote:
> > On 06/07/2017 07:17 AM, Damien MATTEI wrote:
> >> i checked in my Dropbox history at what point did the code begin to compile with error and issued a diif on the files and get this:
> >> [mattei@moita Jkawa]$ diff DBtoWebObserversKawa.scm DBtoWebObserversKawa_first_bug.scm
> >> 287c287
> >> <          (html:td html-literal-table))
> >> ---
> >>>           (html:td align: "center" html-literal-table))
> >>
> >> seems that the simple fact to add an attribute makes the errors.
> > 
> > Indeed, I've reproduced the problem.
> > 
> > I have to think about the best fix.
> 
> Using XML literals works:
> 
>   #<td align="center">&[html-literal-table]</>


Attachment: DBtoWebObserversKawa.scm
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]