Hello Norbert,
I have developed some code to serialize object to XML and visa versa using
their Magritte descriptions. It is not completely finished yet but for
standard scenario's it works fine.
Here an example where an instance of MAXMLTestPerson is serialized to XML.
<MAXMLTestPerson>
<name>Bill Gates</name>
<address>
<MAXMLTestAddress>
<city>Amsterdam</city>
<street>Mainstreet</street>
</MAXMLTestAddress>
</address>
<birthDate>1966-10-20</birthDate>
</MAXMLTestPerson>
It can be de-serialized using MAXMLParser:
MAXMLParser parse: self personWithAddressXML readStream.
The serialization process can be customized. I still have to add proper
error handling. My intention was to add it to the Magritte add-ons
repository when the error handling was fully working. If you want I can add
it sooner so you can have a look.
Jan.
On Tue, Feb 9, 2010 at 11:22 AM, Norbert Hartl <norbert(a)hartl.name> wrote:
Hi,
at the moment I'm thinking about a new project. The project will need a Web
API to communicate with an iphone. To me it is quite obvious to implement
the API part as a request handler. But when it comes to generation of e.g.
XML I'm not sure what is the best way to do.
Sure, the seaside way to do it is to create my own canvas and every object
needs to draw itself onto the canvas. But then I have magritte and a lot
could be done automatically. Using xpath in the descriptions I could use
Pastell to deserialize objects. To produce the output there could be a
similar way. This would be some kind of XML binding then.
I wanted to ask if there is anything already available that could help me
on my way or if there dedicated ideas how to solve this in seaside.
thanks in advance,
Norbert
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
--
Jan van de Sandt
gsm: +31 (0)6 3039 5998