From: D Herring
Subject: Re: XML generator
Date: 
Message-ID: <i7adnWWovqq-GZjVnZ2dnUVZ_oDinZ2d@comcast.com>
Jeff Shrager wrote:
> And I've tried xmls:
...
> ....what the!?!?!?

(xmls:write-xml '(foo (("att1" "a") ("att2" "b")) (bar)) t)
<FOO att1="a" att2="b"><BAR/></FOO>


Haven't tried it, but XMLisp looked interesting.
http://www.agentsheets.com/lisp/XMLisp/

- Daniel

From: levy
Subject: Re: XML generator
Date: 
Message-ID: <2d6cb72c-bf30-493b-90a7-5b47ce1eb6b8@b1g2000hsg.googlegroups.com>
See a short (120 LOC) class inspector web server example at:
http://common-lisp.net/project/cl-quasi-quote/present-class.html

Some explanation:
http://common-lisp.net/project/cl-quasi-quote/present-class-explanation.html

The result:
http://common-lisp.net/project/cl-quasi-quote/persistent-class.html

The project is at:
http://common-lisp.net/project/cl-quasi-quote/

levy
From: Alessio Stalla
Subject: Re: XML generator
Date: 
Message-ID: <fbfe3e62-a80c-481f-a04a-f226c2d08345@l42g2000hsc.googlegroups.com>
On Apr 16, 6:44 am, D Herring <········@at.tentpost.dot.com> wrote:
> Haven't tried it, but XMLisp looked interesting.http://www.agentsheets.com/lisp/XMLisp/
>
> - Daniel

XMLisp is great IMHO, though it is probably overkill if you just want
to spit out some xml, since it provides a full XML-CLOS mapping (in
both directions), of which you can customize almost every aspect. I've
used it to code an XML-based widget DSL for my toy web framework, and
it works like a charm with very little coding. I slightly modified it
to allow a kind of customization the authors hadn't provided, and it
took very little effort despite I hadn't studied XMLisp code in great
detail. Definitely, it's a great library, kudos to the authors!

Alessio Stalla
From: Andy Chambers
Subject: Re: XML generator
Date: 
Message-ID: <4b71a1b0-c64f-4b01-9e97-f414703afe97@u69g2000hse.googlegroups.com>
On Apr 16, 5:44 am, D Herring <········@at.tentpost.dot.com> wrote:
> Jeff Shrager wrote:
> > And I've tried xmls:
> ...
> > ....what the!?!?!?
>
> (xmls:write-xml '(foo (("att1" "a") ("att2" "b")) (bar)) t)
> <FOO att1="a" att2="b"><BAR/></FOO>
>
> Haven't tried it, but XMLisp looked interesting.http://www.agentsheets.com/lisp/XMLisp/
>
> - Daniel

The macros I created for openAIR should be generally useful for
creating objects that need to be serialized to XML.  For example, here
is the definition for defining an html form...

(defhtml form ()
    ()
  (:attrs form
   :action (:-method :method) :enctype
   :accept :name :onsubmit
   :onreset :accept-charset))

This expands to create a form class and a utility macro to create an
instance of it.  Something like....

(progn
  (defmodel form (family html)
    (action ..)
    (method ..))

  (defmacro mk-form
    ...))

..so that creating instances of these is as easy as...

(mk-form ()
  (mk-input (:-type "text"))
  (mk-input ...))

(provided you've done the defhtml for the input tag too).

The family superclass you see there is Kenny's way of creating a
hierarchy of objects.  He has a bunch of utility macros that search up/
down and around family trees which is exactly what you need when
dealing with XML.

A generic function xhtml returns the actual markup represented by
these objects.  Since they're all part of Kenny's family framework,
you just recursively collect the xhtml slots to get the xml output for
the entire tree of objects.

I've had experience writing XML schema's using the W3C schema language
and Relax NG but this is the most painless approach I've found so far
and the best thing is, the schema itself defines the object model.

It may be a little OTT unless you're dealing with a complex/large XML
model but its definitely worth a look.  Check out the defhtml macro in
the file macros.lisp at

http://gitorious.org/projects/hunchncells/repos/mainline/trees/master

--
Andy
From: Ken Tilton
Subject: Re: XML generator
Date: 
Message-ID: <48060cdd$0$11635$607ed4bc@cv.net>
Andy Chambers wrote:
> On Apr 16, 5:44 am, D Herring <········@at.tentpost.dot.com> wrote:
> 
>>Jeff Shrager wrote:
>>
>>>And I've tried xmls:
>>
>>...
>>
>>>....what the!?!?!?
>>
>>(xmls:write-xml '(foo (("att1" "a") ("att2" "b")) (bar)) t)
>><FOO att1="a" att2="b"><BAR/></FOO>
>>
>>Haven't tried it, but XMLisp looked interesting.http://www.agentsheets.com/lisp/XMLisp/
>>
>>- Daniel
> 
> 
> The macros I created for openAIR should be generally useful for
> creating objects that need to be serialized to XML.  For example, here
> is the definition for defining an html form...
> 
> (defhtml form ()
>     ()
>   (:attrs form
>    :action (:-method :method) :enctype
>    :accept :name :onsubmit
>    :onreset :accept-charset))
> 
> This expands to create a form class and a utility macro to create an
> instance of it.  Something like....
> 
> (progn
>   (defmodel form (family html)
>     (action ..)
>     (method ..))
> 
>   (defmacro mk-form
>     ...))
> 
> ..so that creating instances of these is as easy as...
> 
> (mk-form ()
>   (mk-input (:-type "text"))
>   (mk-input ...))
> 
> (provided you've done the defhtml for the input tag too).
> 
> The family superclass you see there is Kenny's way of creating a
> hierarchy of objects.  He has a bunch of utility macros that search up/
> down and around family trees which is exactly what you need when
> dealing with XML.
> 
> A generic function xhtml returns the actual markup represented by
> these objects.  Since they're all part of Kenny's family framework,
> you just recursively collect the xhtml slots to get the xml output for
> the entire tree of objects.
> 
> I've had experience writing XML schema's using the W3C schema language
> and Relax NG but this is the most painless approach I've found so far
> and the best thing is, the schema itself defines the object model.
> 
> It may be a little OTT unless you're dealing with a complex/large XML
> model but its definitely worth a look.  Check out the defhtml macro in
> the file macros.lisp at
> 
> http://gitorious.org/projects/hunchncells/repos/mainline/trees/master

Any hope of a new release for me to try to work into the ECLM 2008 
Kennynote Address on Sunday? I already have a nice gee whiz finish, but 
OpenAIR would really take it to eleven.

Oh, btw, can one push an update to the client? ie, If the bit running on 
the server sees something happen (if only the system clock move forward) 
can it decide to show something new on the client by sending over some 
xhtml? Or does one have to wait for the user to do something leading to 
a refresh?

kt

-- 
http://smuglispweeny.blogspot.com/
http://www.theoryyalgebra.com/

"I've never read the rulebook. My job is to catch the ball."
   -- Catcher Josh Bard after making a great catch on a foul ball
and then sliding into the dugout, which by the rules allowed the
runners to advance one base costing his pitcher a possible shutout
because there was a runner on third base.

"My sig is longer than most of my articles."
   -- Kenny Tilton
From: Andy Chambers
Subject: Re: XML generator
Date: 
Message-ID: <5d32c281-ba37-470d-9c7d-da9ca3d12ac5@a1g2000hsb.googlegroups.com>
On Apr 16, 3:27 pm, Ken Tilton <···········@optonline.net> wrote:
> Andy Chambers wrote:

> Any hope of a new release for me to try to work into the ECLM 2008
> Kennynote Address on Sunday? I already have a nice gee whiz finish, but
> OpenAIR would really take it to eleven.

I'm afraid not.  I've been swamped with "real work" this week and
haven't had any time to work on openAIR.  Sorry.

> Oh, btw, can one push an update to the client? ie, If the bit running on
> the server sees something happen (if only the system clock move forward)
> can it decide to show something new on the client by sending over some
> xhtml? Or does one have to wait for the user to do something leading to
> a refresh?

In theory yes but it is pretty hard.  The server tells the client to
keep the connection open and then sends new info as it is generated.
This info is buffered in a js variable which is polled on the client
for changes.  You have to jump through hoops to make this work in IE.
There are some proprietary solutions out there so it must be possible
but I'm not sure how they do it.

--
ac
From: Ken Tilton
Subject: Re: XML generator
Date: 
Message-ID: <48068341$0$25040$607ed4bc@cv.net>
Andy Chambers wrote:
> On Apr 16, 3:27 pm, Ken Tilton <···········@optonline.net> wrote:
> 
>>Andy Chambers wrote:
> 
> 
>>Any hope of a new release for me to try to work into the ECLM 2008
>>Kennynote Address on Sunday? I already have a nice gee whiz finish, but
>>OpenAIR would really take it to eleven.
> 
> 
> I'm afraid not.  I've been swamped with "real work" this week and
> haven't had any time to work on openAIR.  Sorry.

This is unacceptable. I suppose next you are going to tell me you are 
spending time socializing with friends and family.

:)

kt


-- 
http://smuglispweeny.blogspot.com/
http://www.theoryyalgebra.com/

"I've never read the rulebook. My job is to catch the ball."
   -- Catcher Josh Bard after making a great catch on a foul ball
and then sliding into the dugout, which by the rules allowed the
runners to advance one base costing his pitcher a possible shutout
because there was a runner on third base.

"My sig is longer than most of my articles."
   -- Kenny Tilton