[squeak-dev] XMLNode (not the toba version, , , the monty version) canonicallyPrintTofLineNamed: 'foo.xml' not working on squeak

Levente Uzonyi leves at caesar.elte.hu
Mon Sep 20 22:32:41 UTC 2021

Hi Tim,

On Sun, 19 Sep 2021, gettimothy via Squeak-dev wrote:

> Hi folks
> just an FYI for the maintainers if they have time and inclination.
>  Its an easy workaround, but I thought I would bring it to the board's attention.
>       XMLNode  >> canonicallyPrintToFileNamed: aFileName
> "Prints to the file aFileName as canonical XML (http://www.w3.org/TR/xml-c14n)"
> and its cousins prettyPrintToFileNamed: and printToFileNamed:   throw a XMLFileException: (MessageNotUnderstood) ByteString>>asFileReference  .
> The workaround is straightforward with
> |ios|
> ios := ReadWSriteStream on:''.
> self canonicallyPrintOn: ios.
> StandardFileStream forceNewFileNamed: 'dude.xml' do:[:file | file nextPutAll: ios contents].

If you want to reach Monty, I suggest sending feedback directly.

The missing #asFileReference is probably a symptom of the missing 
Filesystem package[1]. I suppose Monty's version depends on that package, 
as it was integrated into Pharo.

Btw, I think you need to handle character encodings in your workaround.
FileStream would do that (sort of) but StandardFileStream does not.


[1] http://www.squeaksource.com/fs.html

More information about the Squeak-dev mailing list