Update XMLWriter.php

WriteText and WriteCommentText values will now be attempted to be cast as strings.

An exception is thrown if you pass in a non-castable variable type.