I am producing an XML file through ASP to pass to flash. I have generated the tables in SQL Server. I use the following code to connect to the database and output to an XML file. It works fine for one table that I have but not the other two.
I get an error saying that whitespace is not allowed at this location.
RECORD><RECORD><marketID>121</marketID><market>Slovakia</market></RECORD><RECORD&g...
m"></RECORD>
+ <RECORD>
Can anybody help? What does it mean by Whitespace? in the <marketID>flags? What can I do to solve this?
My ASP code is as follows:
<%
response.ContentType="text/xml"
response.write("<?xml version='1.0' encoding='ISO-8859-1'?>")
'The code below must be modified according to your database connection
'It is just a simple ADO Recordset declaration and opening
Set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = MM_DB_STRING
sql = "select marketID,market from MARKETS"
rs.Open sql
'End of modified code
response.write("<ROOT>")
while not rs.Eof
response.write("<RECORD>")
for i=0 to rs.fields.count -1
if rs.fields(i).value<>"" then
response.write("<"&rs.Fields(i).Name&">"&trim(rs.Fields(i).Value)&"</"&rs.Fields(i).Name&">")
else
response.write("<"&rs.Fields(i).Name&"/>")
end if
next
response.write("</RECORD>")
rs.moveNext
wend
response.write("</ROOT>")
rs.close
set rs = nothing
%>
I get an error saying that whitespace is not allowed at this location.
RECORD><RECORD><marketID>121</marketID><market>Slovakia</market></RECORD><RECORD&g...
m"></RECORD>
+ <RECORD>
Can anybody help? What does it mean by Whitespace? in the <marketID>flags? What can I do to solve this?
My ASP code is as follows:
<%
response.ContentType="text/xml"
response.write("<?xml version='1.0' encoding='ISO-8859-1'?>")
'The code below must be modified according to your database connection
'It is just a simple ADO Recordset declaration and opening
Set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = MM_DB_STRING
sql = "select marketID,market from MARKETS"
rs.Open sql
'End of modified code
response.write("<ROOT>")
while not rs.Eof
response.write("<RECORD>")
for i=0 to rs.fields.count -1
if rs.fields(i).value<>"" then
response.write("<"&rs.Fields(i).Name&">"&trim(rs.Fields(i).Value)&"</"&rs.Fields(i).Name&">")
else
response.write("<"&rs.Fields(i).Name&"/>")
end if
next
response.write("</RECORD>")
rs.moveNext
wend
response.write("</ROOT>")
rs.close
set rs = nothing
%>