toXML function completed