Hi,
I'm having a problem with getting code which works on the client side to work on the server in ASP.
This code works:
<script language="VBScript">
set xmldoc = CreateObject("Microsoft.XMLDOM"
xmldoc.async=False
xmldoc.Load ("clientList.xml"
set element = xmldoc.getElementsByTagName("clients"
for each theItem in element
document.write theItem.getAttribute("lastName"
&"<br>"
next
</script>
But this does not
<%
Response.buffer=true
Response.ContentType="text/xml"
set xmldoc = Server.CreateObject("Microsoft.XMLDOM"
xmldoc.async=False
xmldoc.Load Server.MapPath("clientList.xml"
set element = xmldoc.getElementsByTagName("clients"
for each theItem in element
Response.write theItem.getAttribute("lastName"
&"<br>"
next
%>
The error it comes up with is:
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
Invalid at the top level of the document. Error processing resource ' Line 1, Position 1
Your help on this would be very much appreciated
Marcus
I'm having a problem with getting code which works on the client side to work on the server in ASP.
This code works:
<script language="VBScript">
set xmldoc = CreateObject("Microsoft.XMLDOM"
xmldoc.async=False
xmldoc.Load ("clientList.xml"
set element = xmldoc.getElementsByTagName("clients"
for each theItem in element
document.write theItem.getAttribute("lastName"
next
</script>
But this does not
<%
Response.buffer=true
Response.ContentType="text/xml"
set xmldoc = Server.CreateObject("Microsoft.XMLDOM"
xmldoc.async=False
xmldoc.Load Server.MapPath("clientList.xml"
set element = xmldoc.getElementsByTagName("clients"
for each theItem in element
Response.write theItem.getAttribute("lastName"
next
%>
The error it comes up with is:
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
Invalid at the top level of the document. Error processing resource ' Line 1, Position 1
Your help on this would be very much appreciated
Marcus