The ShakeGrid save() method writes XML using normal file open/write/close. But some of the fields it writes (the event description, for example) may have special characters in them (like "&") which are treated by XML parsers as control characters. Using an XML writer module to write the file would handle these cases.