How ASP can return XML
In this article, I will explain how ASP can return XML. XML can be generated on a server without any installed XML software.
To generate an XML response from the server write the following code and save it as an ASP file on the web server. Note: the content type of the response must be set to "text/xml". Learn How ASP can return XML
Overview on How ASP can return XML
How ASP can return XML code:
XML file on server
<?xml version="1.0" encoding="ISO-8859-1"?>
<message>
<from>Raj</from>
<to>Sam</to>
<msg>Hello</msg>
</message>
Generating XML with ASP:
<%
response.ContentType="text/xml"
response.Write("")
response.Write("
response.Write("
response.Write("
response.Write("
response.Write("")
%>
Note :the content type of the response must be set to "text/xml".
Saving XML To a File Using ASP
<%
text="
text=text & "
text=text & "
text=text & "Hello!"
text=text & "
set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.loadXML(text)
xmlDoc.Save("raj.xml")
%>