I'm trying to export XML data from a web page to a spreadsheet using javascript. So far I've just tried the very simple:
Sub Export
Response.ContentType = "application/vnd.ms-excel"
<script>
var XML = document.getElementById("xmldata");
window.open(XML);
</script>
End Sub
This tries to open the XML file as an excel spreadsheet, however it doesn't open because it has invalid characters. I've tracked down these characters and the main culprit tends to be the horizontal dash "–". There may be other invalid characters, but If I remove them manually, the XML file opens fine.
How would I go about formatting the XML content to remove or replace the invalid characters to display properly to excel? The XML sheet is built from fields in a database, should I format it as it's built or format it with javascript? I'm trying to find the simplest solution possible as I'm fairly new to web programming. Also, I'm using classic ASP/VBscript.