Are you developing in Squeak? I ask because the XML parser in the default Squeak image is very old. You can download the latest Pharo XMLParser lib from the SqueakMap. It's the "XMLParser" project. Other libs I maintain are also available as SM projects, like "XMLParser-XPath".
If you're doing DOM parsing, you can save a parsed DOM document to a file using a message like #printToFileNamed: (see the XMLNode "printing" category for more). ___ montyos.wordpress.com > Sent: Saturday, June 16, 2018 at 4:27 AM > From: Hilaire <[email protected]> > To: [email protected] > Subject: Re: [Pharo-users] Lost in stream > > Sometime you just need a good sleep, which I was fortunate to have. > > My newer code append contents to existing file, so it lead to corrupted > files at the end. Ensuring it is deleted first solved the problem: > > (location asFileReference / filename) ensureDelete binaryWriteStreamDo: > [ :fileStream | > fileStream nextPutAll: stream contents] > > There is still the issue of XML entity I described in an previous email, > the impact is minor for Dr. Geo though. Do other have issues with that? > > Hilaire > > > Le 15/06/2018 à 18:31, Hilaire a écrit : > > This fromer code to save file (xml or PNG file): > > > > " |streamOnDisk| > > [streamOnDisk := MultiByteFileStream forceNewFileNamed: (self > > absolutePath: filename). > > streamOnDisk nextPutAll: stream contents] ensure: > > [streamOnDisk close]" > > > > and the newer one: > > > > (location asFileReference / filename) binaryWriteStreamDo: [ > > :fileStream | > > fileStream nextPutAll: stream contents] > > > > The new one produce both wrong XML file and PNG file. The file looks > > short cuted at the end. > > -- > Dr. Geo > http://drgeo.eu > > > >
