Cannot have a DOCTYPE declaration outside of a prolog. Error processing resource

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<font color="#0000ff" size=2>Hi</font>
<font color="#0000ff" size=2>Yes, its another one of these - sorry but Im fairly new to this.</font>
<font color="#0000ff" size=2>Im getting the following error, when trying to display some XML code on a browser and cant see where Im going wrong:</font> <font color="#0000ff" size=2>
 
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
Cannot have a DOCTYPE declaration outside of a prolog. Error processing resource http://localhost:2999/Exam/Exam.aspx. L...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<a title="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "&..

Im using the following C# code in the (Page_load of Exam.aspx.cs) to try and display the XML:
string whatever = "<CiscoIPPhoneText>rn";
string whatever1 = "<Title>Arrests</Title>rn";
string whatever2 = "<Text>C# XML text</Text>rn";
string whatever3 = "<SoftKeyItem>rn";
string whatever4 = "<Name>Next</Name>rn";
string whatever5 = "<URL>http://192.168.10.10/NWP/briefing_sheet/Arrests2.php</URL>rn";
string whatever6 = "<Position>1</Position>rn";
string whatever7 = "</SoftKeyItem>rn";
string whatever8 = "<SoftKeyItem>rn";
string whatever9 = "<Name>Exit</Name>rn";
string whatever10 = "<URL>http://192.168.10.10/NWP/briefing_sheet/briefing_sheet.php</URL>rn";
string whatever11 = "<Position>3</Position>rn";
string whatever12 = "</SoftKeyItem>rn";
string whatever13 = "</CiscoIPPhoneText>r";
Response.ClearContent();
Response.ContentType = "text/xml";
Response.Write("<?xml version=" + """ + "1.0" + """ + "?>rn");
Response.Write(whatever);
Response.Write(whatever1);
Response.Write(whatever2);
Response.Write(whatever3);
Response.Write(whatever4);
Response.Write(whatever5);
Response.Write(whatever6);
Response.Write(whatever7);
Response.Write(whatever8);
Response.Write(whatever9);
Response.Write(whatever10);
Response.Write(whatever11);
Response.Write(whatever12);
Response.Write(whatever13);

....and this is my .aspx code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Exam.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<a title="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
<script type="text/javascript
function myClose(thetime)
{
// Next statement added to prevent the message "The web page you are viewing is trying to close the window." from
// appearing.
window.opener="anyvalue"
setTimeout("window.close()", thetime)
}
</script>
<html xmlns="<a title="http://www.w3.org/1999/xhtml http://www.w3.org/1999/xhtml http://www.w3.org/1999/xhtml " >
<head runat="server
<title>Generate XML file with proper text values</title>
</head>
<body onload="myClose(3000)
<form id="Form1" runat="server

&nbsp;
&nbsp;
</form>
</body>
</html>
Can anyone spot my non-deliberate mistake?  I do not have a XSL or CSS file as I thought the code above would use some default code. Maybe this assumption is wrong?
Thanking you for any help.
Alistair</font>

View the full article
 
Back
Top