site_model_to_xml_state function

Internal function to convert a site model to XML, used in the state section