I managed to get this far since my first post. My laster mystery is
the following two functions
(de mydata ()
(prinl "HTTP/1.0 200 OK^M")
(prinl "Content-Type: text/xml; charset=utf-8")
(prinl "^M")
(xml? T)
(xml '(root NIL "Hello Using XML"))
)
(de mydata2 ()
(httpHead "text/xml; charset=utf-8" 1)
(xml? T)
(xml '(root NIL "Document 2"))
)
mydata works perfectly. mydata2 fails to roduce any output. Now the
thing is the built in html function uses httpHead quite sucessfully
and if I connect with psh and call mydata2 it prints a http header
that looks valid. Indeed if I take the printed lines and duplicate
them exactly as prinl statements then things work fine as well. I must
be doing something wrong here but can't for the life of me see what it
might be.
On 03/10/2008, Tomas Hlavaty <[EMAIL PROTECTED]> wrote:
> Hi Konrad,
>
>> http://localhost:8080/@xmldata
>
>> and get the intended xml data back. So far I've had no luck getting
>> the server to successfully call a function and get anything back.
>
> try this for example:
>
> ===
>
> #!bin/picolisp lib.l
>
> (load "ext.l" "lib/http.l" "lib/xhtml.l")
>
> (de xmldata ()
> (prinl "HTTP/1.0 200 OK^M")
> (prinl "Server: PicoLisp^M")
> (prinl "Date: Fri, 3 Oct 2008 10:53:58 GMT^M")
> (prinl "Cache-Control: max-age=0^M")
> (prinl "Cache-Control: no-cache^M")
> (prinl "Content-Type: text/xml; charset=utf-8^M")
> (prinl "^M")
> (prinl "<hi><how/>are<you>?</you></hi>"))
>
> (de start ()
> (html 0 "xmldata test" NIL NIL
> (<p> NIL (<href> "xmldata" "@xmldata") ) ) )
>
> (server 8080 "@start")
>
> ===
>
> Execute the script from your picolisp directory, then click on the
> xmldata link. You should get an XML as returned by xmldata function.
>
> The next step is to fix the http header and get the xml from a file.
>
> Cheers,
>
> Tomas
> --
> UNSUBSCRIBE: mailto:[EMAIL PROTECTED]
>
--
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]