Hello Squeakers!
I am trying to implement XML based protocol in Squeak.
And was wondering how to do it cleanly in Smalltalk.
My take is to write general DSL (something like DTD, but bit more powerfull with types) for this that whould generate classes which object fields whould be maped to object instance variables. This way I could have protocol objects as native Smalltalk objects.
But I am not shore if this is the best solution. Maybe there is one (by googling I didn't find anything)? Or how a real smalltalker whould tackle this?
Hi Ramunas,
On 11/26/06, Ramūnas Gutkovas ramunasg@gmail.com wrote:
My take is to write general DSL (something like DTD, but bit more powerfull with types) for this that whould generate classes which object fields whould be maped to object instance variables. This way I could have protocol objects as native Smalltalk objects.
so, basically, you intend to implement an XML data binding for your protocol, to have the protocol available in the more convenient form of Smalltalk objects, right? That's reasonable and frequently done.
A word about DTDs: those are pretty outdated; DTDs have essentially been replaced by XSchema definitions. XSchema is far more convenient.
But I am not shore if this is the best solution. Maybe there is one (by googling I didn't find anything)? Or how a real smalltalker whould tackle this?
As I said, establishing an XML data binding is a reasonable approach. In Squeak, you can use the YAXO package to have an XML parser.
Hope this helps,
Michael
Michael Haupt <mhaupt <at> gmail.com> writes:
so, basically, you intend to implement an XML data binding for your protocol, to have the protocol available in the more convenient form of Smalltalk objects, right? That's reasonable and frequently done.
Yes. Sorry not being clear, my english is a bit rusty :)
A word about DTDs: those are pretty outdated; DTDs have essentially been replaced by XSchema definitions. XSchema is far more convenient.
The protocol is given by a set of DTD's. I don't know about convinience all of XML is quite painfull (and it was made to be simple, the irony) ;)
As I said, establishing an XML data binding is a reasonable approach. In Squeak, you can use the YAXO package to have an XML parser.
Yes I am already using YAXO, I have implemented WBXML as SAXDriver for it. But working on a raw DOM tree is not convinient at all.
Other day I was looking at Magritte I think it could suit the task. Declarative model with types, validation, automatic accessor generation etc. - very nice. All I have to do is to write DOM -> Magritte -> DOM. Oh, well back to work :)
Hope this helps,
All the help is appreciated!
Michael
squeak-dev@lists.squeakfoundation.org