In my really old code I wrote
save
"self new save"
| doc |
doc := self buildXML.
doc printOn: self stream
buildXML
^ self base asXML
Base>>asXML
"BDBase uniqueInstance asXML"
| doc elem |
doc := XMLDocument new.
doc version: '1.0'.
elem := XMLElement
name: #Base
attributes:
(Dictionary new
at: 'date' put: Date today asString;
at: 'entriesNumber' put: self elements size asString;
at: 'note' put: self note asString;
yourself).
doc addElement: elem.
self elements do: [:each | elem addElement: each asXML].
^ doc
Elements>>asXML
^ XMLElement name: self class xmlName attributes: self attributes
So how can I control that each elements ends with a linebreak/cr whatever?
Stef