Update XMLWriter.php

Checking for is_string before trying to cast as string.