Strange indeed, we will check

Cheers,
Alexandre


On 31 Oct 2010, at 08:13, Stéphane Ducasse wrote:

> Patching XMLNode>>printOn: like that seems to work.
> 
> 
> XMLNode>>printOn: aStream
>       | writer |
> 
>       writer := XMLWriter on: aStream.
>>>     writer enablePrettyPrinting.
>       self printXMLOn: writer.
>       writer flushMarkup.
> 
> Now this is clearly not a good solution. I will change my code not to be 
> based on the printOn behavior and use a
> writer instead. 
> 
> Now I do not understand why we create a writer for each printOn: message
> 
> 
> Stef
> 
> 
> 
> 
> On Oct 31, 2010, at 12:03 PM, Stéphane Ducasse wrote:
> 
>> 
>> 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
>> 
>> 
>> 
>> 
>> 
> 
> 

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






Reply via email to