Changed standard C includes to C++ style
Fixed ampersand encoding in XML writer