Hello,

 

I’m working on the Magritte-XMLBinding package. With this package you can export Magritte objects as XML and read Magritte described objects from XML. I would like to have a nice simple API that is easy to understand. I’m looking for some feedback.

 

Assume we have the following description:

 

MXPerson>>descriptionName

 

            ^MAStringDescription new

                        accessor: #name;

                        label: 'Name';

                                  

If we want to export the name property as a xml element we add the beXmlElement message. By default it will add an extra element with the accessor name as the element name and the value as the element contents:

 

<MXPerson>

            <name>Pete</name>

</MXPerson>

 

Optionally we can specify an alternative xml element name:

 

description

            beXmlElement;

            xmlElementName: 'person-name'.

 

Or do you like this API better?

 

description

            beXmlElement: 'person-name'.

 

The output:

 

<MXPerson>

            <person-name>Pete</person-name>

</MXPerson>

 

It is also possible to store a property as an xml attribute of the parent element:

 

description

            beXmlAttribute.

 

<MXPerson name='Pete'>

</MXPerson>

 

Or in a property of a separate element:

 

description

            beXmlElementWithAttribute

 

<MXPerson>

            <name value='Pete' />

 </MXPerson>

 

The element and attribute names can be customized:

 

description

beXmlElementWithAttribute;

xmlElementName: 'xname';

xmlAttributeName: 'yvalue'.

 

OR:

 

description

beXmlElement: 'xname' withAttribute: 'yvalue'.



Is the "be" message with arguments better or should a "be" message always have zero arguments?

Jan.