0Day Forums
How can I load a dynamically generated XML file? - Printable Version

+- 0Day Forums (https://0day.red)
+-- Forum: Coding (https://0day.red/Forum-Coding)
+--- Forum: JScript (https://0day.red/Forum-JScript)
+--- Thread: How can I load a dynamically generated XML file? (/Thread-How-can-I-load-a-dynamically-generated-XML-file)



How can I load a dynamically generated XML file? - advisory479 - 07-24-2023

Assume I have a file that contains :

<%
Response.write("<my_tag>value</my_tag>")
%>
If I get it as an ordinary XML file, I get an error telling me that the XML have not the right format because it begin by "<%". How can I read this XML dynamically generated ?

**Edit:**

In fact, it was an illusion. The Server.Execute method just print the other file. What can I do ? How could I put the result of an ASP page in a string that I could read by loadXML method ? Or how could I just process the file before loading it ?


RE: How can I load a dynamically generated XML file? - Prosabadilla729 - 07-24-2023

Give it a file extension that ASP will know to process, or tell ASP to process the file extension you're using. The server has to know to process the file and give you the dynamic result. It doesn't treat every file served as a classic ASP file, you have to tell it what to treat the file as if you're using a non-standard extension for ASP. You can do this by mapping the classic ASP handler to the file type you're trying to HTTP GET.


RE: How can I load a dynamically generated XML file? - obsessions975538 - 07-24-2023

Use an .asp extension and set the Content Type:

<%
Response.CharSet = "utf-8"
Response.Buffer = True
Response.ContentType="text/xml"

Response.Write "<?xml version=""1.0"" encoding=""utf-8""?>"
Response.Write "<my_tag>value</my_tag>"

Response.Flush
%>

You might take a look here:

[To see links please register here]