This brings to JS errors sometimes.
XMLUtils.createElement(paramSaxBuffer, "message", atts, catalogueID + ':' + key);
should be
paramSaxBuffer.characters(ch, start, length).