Updated API to use asXML