Hace poco migré un sitio ASP de mi máquina de desarrollo a un servidor en vivo. Todas las páginas excepto mi página de preguntas frecuentes funciona muy bien, pero mi FAQ trae a colación:¿Qué podría estar causando un error de análisis XML: no se ha encontrado ningún elemento?
XML Parsing Error: no element found
Location: http://geniusupdate.com/GSHelp/faq.aspx
Line Number 1, Column 1:
Los únicos cambios que he hecho estaban cambiando la cadena de conexión en mi página de SQL desde el local a la cadena especificada por mi servicio de alojamiento. ¿Algún consejo sobre lo que puedo hacer para encontrar la raíz de este problema?
aquí es la fuente de mi página de preguntas frecuentes:
<%@ Page Language="VB" MasterPageFile="~/theMaster.master" AutoEventWireup="false" CodeFile="faq.aspx.vb" Inherits="faq" Title="Untitled Page" %>
<%@ Import Namespace="sqlstuff" %>
<%@ Import Namespace="functions" %>
<asp:Content ContentPlaceHolderID="page_title" ID="theTitle" runat="server">
FAQ</asp:Content>
<asp:Content ContentPlaceHolderID="column1_title" ID="col1Title" runat="server">
<%=faqPageTitle(Request.QueryString("cid"))%></asp:Content>
<asp:Content ContentPlaceHolderID="column1" ID="columnContent" runat="server">
<p>Click on a question to expand it to see the answer!</p>
<p><% If cID >= 0 Then
Dim theFaq As New List(Of faqContent), iterate As Integer = 0
theFaq = sqlStuff.getFaqs(cID)
For Each oFaq As faqContent In theFaq
Response.Output.WriteLine("<h4 id={0} class={1}>Q: {2}</h4>", _
addQuotes("gsSwitch{0}-title", iterate), _
addQuotes("handCursor"), _
oFaq.Content.Question)
Response.Output.WriteLine("<div id={0} class={1}><string>A: </strong>{2}</div>", _
addQuotes("gsSwitch{0}", iterate), _
addQuotes("gsSwitch"), _
oFaq.Content.Answer)
iterate += 1
Next
Else
Response.Output.Write("Here you can find a lot of information about eTHOMAS and how to expedite your office tasks.{0}", ControlChars.NewLine)
End If
%></p>
<script type="text/javascript">
var gsContent = new switchcontent("gsSwitch", "div")
var eID = '<%= expandID %>'
gsContent.collapsePrevious(true) // TRUE: only 1; FALSE: any number
gsContent.setPersist(false)
if(eID >= 0){
gsContent.defaultExpanded(eID) // opens the searched FAQ
document.getElementById('gsSwitch' + eID + '-title').scrollIntoView(true) // scrolls to selected FAQ
}
gsContent.init()
</script>
</asp:Content>
<asp:Content ContentPlaceHolderID="subcolumn_right_title" ID="rSideColTitle" runat="server"></asp:Content>
<asp:Content ContentPlaceHolderID="subcolumn_right" ID="rSideColContent" runat="server"></asp:Content>
<asp:Content ContentPlaceHolderID="subcolumn_left_title" ID="lSideColTitle" runat="server"></asp:Content>
<asp:Content ContentPlaceHolderID="subcolumn_left" ID="lSideColContent" runat="server"></asp:Content>
<asp:Content ContentPlaceHolderID="sidecolumn_title" ID="sideColtitle" runat="server">
</asp:Content>
<asp:Content ContentPlaceHolderID="sidecolumn" ID="sideCol" runat="server">
<% If cID >= 0 Then
Response.Write(constructFaqSideMenu(CInt(Request.QueryString("cid"))))
Else
Response.Write(constructFaqSideMenu())
End If
%>
</asp:Content>
He encontrado esto en otro foro link:
Well, it appears it's a bit of both. The message is generated by Firefox, but caused by the framework. For some reason, .NET generates a response type of "application/xml" when it creates an empty page. Firefox parses the file as XML and finding no root element, spits out the error message.
IE no hace que la página, y punto. Aquí es de donde viene el XML.
Aquí es la función constructFaqSideMenu():
Public Shared Function constructFaqSideMenu(ByVal oSelID As Integer) As String
Dim oCatList As New List(Of faqCategory)
Dim oRet As New StringBuilder
Dim iterate As Integer = 1, extraTag As String = ""
oCatList = sqlStuff.getFaqCats
oRet.AppendFormattedLine("<ul id={0}>", addQuotes("submenu"))
oRet.AppendFormattedLine(" <li id={0}>FAQ Categories</li>", addQuotes("title"))
For Each category As faqCategory In oCatList
If iterate = oSelID Then
extraTag = String.Format(" id={0}", addQuotes("active"))
Else
extraTag = ""
End If
oRet.AppendFormattedLine(" <li{0}><a href={1}>{2}</a></li>", extraTag, addQuotes("faq.aspx?cid={0}", iterate), StrConv(category.Title, VbStrConv.ProperCase))
iterate += 1
Next
oRet.AppendLine("</ul>")
Return oRet.ToString
End Function
Y aquí es la fuente de la página en blanco IE regresa:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>
<BODY></BODY></HTML>
que estoy enfrentando el mismo problema con los archivos de SVC, en IE No recibo ninguna respuesta y en Mozilla veo este error xml – Omu