About magritte for XML serialization

Lukas Renggli renggli at iam.unibe.ch
Sun Mar 26 22:10:32 MEST 2006


Hi Stef,

> I wanted to know this was possible to specify how an field should  
> be saved and reloaded. For example I wanted to save a date and  
> reload it.

sure, this is possible.

> I added
>
> MADateDescription>>parseString: aString
> 	^ self parseString: aString protected: [ aString asDate ].

I don't have #parseString:protected: in my image, I guess you are  
using a very old version. In fact, in very early versions the parsing  
and printing of strings was fixed, but now it is done using a  
configurable visitor: have a look at the methods #toString: and  
#fromString: in MADescription.

> but I have the impression that been able to specify at the  
> description level the way the values are saved and filed in would  
> make sense.
>
> I checked on my old version of MA, but I could not find how the  
> MADescription itself was describing the condition because it would  
> be the same process may be been able to specify a block or a  
> selector for each of the  action would be cool.

The visitor can be changed on a per-description base. It can also be  
chosen at the meta-description level, if you want to give this  
possibility to the end-users. The default visitors used are  
MAStringReader and MAStringWriter.

Cheers,
Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch


More information about the SmallWiki mailing list