|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
send XML from ASP
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 >Does anyone have an example of ASP streaming XML? Without using a DOMResponse.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 XMLusing a string requires your code to perform appropriate character escaping. >I need to create an ASP that queries Access and Oracle, Access text fields are unicode. For best results use a DOM.> combines the data and returns it as XML. Anthony. |
|||||||||||||||||||||||