send XML from ASP

L

ljb

Does anyone have an example of ASP streaming XML? Can I set content headers
to indicate the page returns XML? Can this XML be a string or must it be
prepared with DOM? I need to create an ASP that queries Access and Oracle,
combines the data and returns it as XML.

thanks
LJB
 
A

Anthony Jones

Does anyone have an example of ASP streaming XML?

Without using a DOM

Response.ContentType = "text/xml"

Response.Write "<?xml version=""1.0"" encoding=""windows-1252"" ?>"
Response.Write "<root><item>Hello World</item></root>"



Using a DOM



Dim oXML
Set oXML = Server.CreateObject("MSXML2.DOMDocument.3.0")

oXML.LoadXML "<root />"

AddElem oXML, "item", "Hello World"

Response.CharSet = "UTF-8"
Response.ContentType = "text/xml"
oXML.Save Response

Function AddElem(roParent, rsName, rvntValue)
Set AddElem = roParent.ownerDocument.createElement(rsName)
If Not IsNull(rvntValue) AddElem.Text = CStr(rvntValue)
End Function

Can I set content headers to indicate the page returns XML?

Response.ContentType = "text/xml"
Can this XML be a string or must it be prepared with DOM?

It is strongly recommend you use DOM if at all possible. Generating XML
using a string requires your code to perform appropriate character escaping.
I need to create an ASP that queries Access and Oracle,
combines the data and returns it as XML.

Access text fields are unicode. For best results use a DOM.

Anthony.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,143
Messages
2,570,822
Members
47,368
Latest member
michaelsmithh

Latest Threads

Top