toXmlString is used only as value for paramter, so only danger character is ```"``` that it cannot have. Also kind you point is ```<MAP>``` that is not used as it is overwritten by map and writtes specific version like ```map<string,list>```.

For real XML element is used toXml that use toXmlString as parameter.

Second note is right. I will fix it.