I know I am probably messing in areas I shouldn't be (based on my
limited knowledge of Common Lisp), but I have a desire to create an
object to xml marshaller. Basically, I am building a webapp that has a
RESTful interface that a javascript and flex based UI is communicating
with.
Originally, I thought to create my response objects and have generic
functions that generated xml for each one. Then I thought, "Why do
that if I can write code to examine each object's structure and data?
Then I could write generalized code to convert any object to xml." A
little research into MOP and I was soon able to extract almost all the
information I needed. The only aspect that I need is to know whether a
data item is a child node, text, or attribute.
I've initially solved this by using the :documentation key for each
slot. I just put an indicator in there and when the marshaller is
examining the object, it pulls this data. This is ok and works, but
I'm hijacking a key for my own purposes. I'd rather be able to define
my own slot key(s) for the meta information the marshaller needs (node
type, namespace, etc).
Now we (finally) get to my issue - I've determined that I need to
define a meta class so that I may define my own slot keys.
Unfortunately, I'm receiving an error when attempting this.
(defclass my-meta-class (standard-class) ())
gives the following - (DEFCLASS MY-META-CLASS): superclass #<STRUCTURE-
CLASS STANDARD-CLASS> should be of class STANDARD-CLASS
I am using clisp 2.33 on windows (Lisp in a box) and Clozure CL on OSX
(leopard) and get the same in each case. Either they both have the
same issue or (much more likely) I'm doing something wrong. Any help
would be greatly appreciated. Additionally, if there is already a
mapping tool available that I should be using that someone knows
about, please let me know.
Thanks,
Gene
In article
<····································@79g2000hsk.googlegroups.com>,
vttoonses <·········@gmail.com> wrote:
> I know I am probably messing in areas I shouldn't be (based on my
> limited knowledge of Common Lisp), but I have a desire to create an
> object to xml marshaller. Basically, I am building a webapp that has a
> RESTful interface that a javascript and flex based UI is communicating
> with.
>
> Originally, I thought to create my response objects and have generic
> functions that generated xml for each one. Then I thought, "Why do
> that if I can write code to examine each object's structure and data?
> Then I could write generalized code to convert any object to xml." A
> little research into MOP and I was soon able to extract almost all the
> information I needed. The only aspect that I need is to know whether a
> data item is a child node, text, or attribute.
>
> I've initially solved this by using the :documentation key for each
> slot. I just put an indicator in there and when the marshaller is
> examining the object, it pulls this data. This is ok and works, but
> I'm hijacking a key for my own purposes. I'd rather be able to define
> my own slot key(s) for the meta information the marshaller needs (node
> type, namespace, etc).
>
> Now we (finally) get to my issue - I've determined that I need to
> define a meta class so that I may define my own slot keys.
> Unfortunately, I'm receiving an error when attempting this.
>
> (defclass my-meta-class (standard-class) ())
>
> gives the following - (DEFCLASS MY-META-CLASS): superclass #<STRUCTURE-
> CLASS STANDARD-CLASS> should be of class STANDARD-CLASS
>
> I am using clisp 2.33 on windows (Lisp in a box) and Clozure CL on OSX
> (leopard) and get the same in each case. Either they both have the
> same issue or (much more likely) I'm doing something wrong. Any help
> would be greatly appreciated. Additionally, if there is already a
> mapping tool available that I should be using that someone knows
> about, please let me know.
>
> Thanks,
> Gene
Maybe you need to update your Lisp implementations?
I don't get an error in CLISP 2.45 and CCL 1.2.
--
http://lispm.dyndns.org/
P� Tue, 16 Sep 2008 15:51:52 +0200, skrev vttoonses <·········@gmail.com>:
> I know I am probably messing in areas I shouldn't be (based on my
> limited knowledge of Common Lisp), but I have a desire to create an
> object to xml marshaller. Basically, I am building a webapp that has a
> RESTful interface that a javascript and flex based UI is communicating
> with.
>
> Originally, I thought to create my response objects and have generic
> functions that generated xml for each one. Then I thought, "Why do
> that if I can write code to examine each object's structure and data?
> Then I could write generalized code to convert any object to xml." A
> little research into MOP and I was soon able to extract almost all the
> information I needed. The only aspect that I need is to know whether a
> data item is a child node, text, or attribute.
>
> I've initially solved this by using the :documentation key for each
> slot. I just put an indicator in there and when the marshaller is
> examining the object, it pulls this data. This is ok and works, but
> I'm hijacking a key for my own purposes. I'd rather be able to define
> my own slot key(s) for the meta information the marshaller needs (node
> type, namespace, etc).
>
> Now we (finally) get to my issue - I've determined that I need to
> define a meta class so that I may define my own slot keys.
> Unfortunately, I'm receiving an error when attempting this.
>
> (defclass my-meta-class (standard-class) ())
>
> gives the following - (DEFCLASS MY-META-CLASS): superclass #<STRUCTURE-
> CLASS STANDARD-CLASS> should be of class STANDARD-CLASS
>
> I am using clisp 2.33 on windows (Lisp in a box) and Clozure CL on OSX
> (leopard) and get the same in each case. Either they both have the
> same issue or (much more likely) I'm doing something wrong. Any help
> would be greatly appreciated. Additionally, if there is already a
> mapping tool available that I should be using that someone knows
> about, please let me know.
>
> Thanks,
> Gene
For the record have you looked at the code for cl-store? It has a
deprecated module that translates Lisp objects to XML. Another module
cl-prevalence does a ACID in memory database an mirrors data onto a disc
using XML. Perhaps this could be used or save you some time? (Getting MOP
to work portably is pain in the A**...)
--------------
John Thingstad
On Sep 16, 5:41 pm, "John Thingstad" <·······@online.no> wrote:
> På Tue, 16 Sep 2008 15:51:52 +0200, skrev vttoonses <·········@gmail.com>:
>
>
>
> > I know I am probably messing in areas I shouldn't be (based on my
> > limited knowledge of Common Lisp), but I have a desire to create an
> > object to xml marshaller. Basically, I am building a webapp that has a
> > RESTful interface that a javascript and flex based UI is communicating
> > with.
>
> > Originally, I thought to create my response objects and have generic
> > functions that generated xml for each one. Then I thought, "Why do
> > that if I can write code to examine each object's structure and data?
> > Then I could write generalized code to convert any object to xml." A
> > little research into MOP and I was soon able to extract almost all the
> > information I needed. The only aspect that I need is to know whether a
> > data item is a child node, text, or attribute.
>
> > I've initially solved this by using the :documentation key for each
> > slot. I just put an indicator in there and when the marshaller is
> > examining the object, it pulls this data. This is ok and works, but
> > I'm hijacking a key for my own purposes. I'd rather be able to define
> > my own slot key(s) for the meta information the marshaller needs (node
> > type, namespace, etc).
>
> > Now we (finally) get to my issue - I've determined that I need to
> > define a meta class so that I may define my own slot keys.
> > Unfortunately, I'm receiving an error when attempting this.
>
> > (defclass my-meta-class (standard-class) ())
>
> > gives the following - (DEFCLASS MY-META-CLASS): superclass #<STRUCTURE-
> > CLASS STANDARD-CLASS> should be of class STANDARD-CLASS
>
> > I am using clisp 2.33 on windows (Lisp in a box) and Clozure CL on OSX
> > (leopard) and get the same in each case. Either they both have the
> > same issue or (much more likely) I'm doing something wrong. Any help
> > would be greatly appreciated. Additionally, if there is already a
> > mapping tool available that I should be using that someone knows
> > about, please let me know.
>
> > Thanks,
> > Gene
>
> For the record have you looked at the code for cl-store? It has a
> deprecated module that translates Lisp objects to XML. Another module
> cl-prevalence does a ACID in memory database an mirrors data onto a disc
> using XML. Perhaps this could be used or save you some time? (Getting MOP
> to work portably is pain in the A**...)
>
> --------------
> John Thingstad
Also http://www.agentsheets.com/lisp/XMLisp/
P� Tue, 16 Sep 2008 17:49:04 +0200, skrev ······@corporate-world.lisp.de
<······@corporate-world.lisp.de>:
>
> Also http://www.agentsheets.com/lisp/XMLisp/
>
Cool. Missed that one. Seems perfect for implementing AIML. Been working
through PAIP lately and ALICE, the modern evolvement of ELIZA would be a
interesting study.
--------------
John Thingstad
* Alessio Stalla Wrote on Wed, 17 Sep 2008 02:20:42 -0700 (PDT):
| Xmlisp is really cool. I used it in an attempt to write the nth Lisp
| web framework (now abandoned for various reasons, though it was fun).
| I remember I tweaked it to allow a kind of customization that wasn't
| available (don't remember what), but never sent the patch to the
| authors because I lost interest soon afterwards. As soon as I can get
| the code, I can publish it if it's interesting enough.
What would also be cool is a library of freely available clos classes
based on xml-serializer for handling the various "standard" xml files.
It would be nice to have a place to collect xmlisp classes contributed
by users, [Just like everytime someone writes lisp ffi bindings to some
C library there is a new project on common-lisp.net] --- I think it
would be incredibly useful.
(Of course the problem is that that users should actually share their
xmlisp classes to this library. Myself, I'm too worried about the
quality and correctness of my coverage for the xmlisp classes I've
written, to cut configuration files and createrepo schemas, that I'd be
afraid to submit them, but hey I'm just making suggestions :)
--
Madhu