Hello,

I am attempting to read and write an XML document.

Currently I have parsed the document successfully. I have basic navigation and have learned how to modify the XMLDocument.

Now I want to write the modified document back to the file system.
What I have tried so far is:

writer := XMLWriter new.
xmldoc document writeXMLOn: writer.
writer stream.
f := File openForWriteFileNamed: '/home/jimmie/xmldoc.xml'.
f nextPutAll: (writer write contents).
f flush.
f close.

It does write an xml document to the file system. However, it has exploded in size. The original is 28mb and is in UTF-8. The newly written file is 112mb and is UTF-32.

I do not know why the change in encoding or how to correct or manually set the encoding.

Any help in understanding how to correctly write an XML document that I have read and minimally modified would be greatly appreciated.

Thanks.

Jimmie

Reply via email to