Xml parsing error no element found at line 1

I recently migrated an ASP site from my dev machine to a live server. All the pages except my FAQ page works just fine, but my FAQ brings up: XML Parsing Error: no element found Location: http://

I recently migrated an ASP site from my dev machine to a live server. All the pages except my FAQ page works just fine, but my FAQ brings up:

XML Parsing Error: no element found
Location: http://geniusupdate.com/GSHelp/faq.aspx
Line Number 1, Column 1:

The only changes I have made were changing the connection string on my SQL page from local to the string specified by my hosting service. Any tips on what I can do to find the root of this issue?

here is the source to my FAQ page:

<%@ 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>

I found this on another forum 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 does not render the page, period. This is where the XML is coming from.

Here is the constructFaqSideMenu() function:

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

And here is the source of the blank page IE returns:

<!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>

  • Remove From My Forums
  • Question

  • Our company has recently moved to Azure, but when he hosted our Web Application, with one page we have the following message:

    XML Parsing Error: no element found Line Number 1, Column 1:

    In Windows Server I never had this kind of problems. I have tried the following solutions from

    XML-parser error: no element found,

    http://forums.asp.net/t/1004395.aspx?What+causes+this+XML+Parsing+Error+no+element+found and

    XML Parsing Error: no element found and no result. I have noticed that the Master Page of the application had this code structure:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml">
    <body>
    Content
    </body>
    </html>

    , so I removed the xmlns part, but still the same error appears. Also, with FireBug i have the following message:

    XML Parsing Error: no element found Location:
    http://website.com/Import.aspx Line Number 1, Column 1: ^

    ,and the weird thing is that I cannot find anywhere this ^ character. The page has the following function: With the click of a button, it reads the content of XML files located in a defined path, and after writes it in our Database. The
    error appears always after the page has finished writing the data into the DB.

    Below is the code of my page:

    <%@ Page Language="C#" MasterPageFile="~/Site2.Master" CodeBehind="Import.aspx.cs" Inherits="TiboManagement.ImportXML" %>
        generate csv file with all channels EPG 
        <asp:Button ID="UploadFile" runat="server" onclick="UploadFile_Click" 
            Text="Generate csv" />
        <br />
        <br />
        import epg directly
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" 
            Text="Import EPG" />
            <br />
            <br />
            Logs:<br />
    <asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" Height="138px" 
            Width="618px"></asp:TextBox>
        </asp:Content>

    Any idea why this happens?

    • Edited by

      Tuesday, May 26, 2015 9:37 AM

Answers

  • So it looks like you’re getting a server side error after all. Try enabling
    Detailed Error Logging for your side and repro the issue. You should then get a log file which should tell you what’s failing.

    • Marked as answer by
      Syed Irfan Hussain
      Tuesday, June 2, 2015 9:36 AM

Firefox logo

Hi,

I’ve just installed the latest Firefox update (84.0) and now I get the following message where my bookmarks sidebar should be:

XML Parsing Error: no element found
Location: chrome://browser/content/places/bookmarksSidebar.xhtml
Line Number 1, Column 1:

The history sidebar works, just not the bookmarks one.

Does anyone have any idea how to fix it?

Debbie

Hi,

I’ve just installed the latest Firefox update (84.0) and now I get the following message where my bookmarks sidebar should be:

XML Parsing Error: no element found
Location: chrome://browser/content/places/bookmarksSidebar.xhtml
Line Number 1, Column 1:

The history sidebar works, just not the bookmarks one.

Does anyone have any idea how to fix it?

Debbie

Выбранное решение

@FredmcD,

Verify Integrity didn’t work, but I saw a Clear Startup Cache button at the top of the page and clicked that, which did work. Thanks for the prompt, as I didn’t know that page existed.

@cor-el,

I know a switch it off/switch it on approach solves a lot of problems, but uninstalling/reinstalling Firefox does seem to be a bit of overkill for a problem that was caused by a Firefox update, rather than something I did. Perhaps clearing the startup cache might be a standard task to include in every update, so this kind of problem doesn’t happen in the future?

Anyway, the problem has been fixed now, so no worries for me.

Debbie

Прочитайте этот ответ в контексте
👍 0

Все ответы (4)

https://www.bing.com/search?q=XML+Parsing+Error

If you have sync, and there is a problem anywhere,
Shut Down Sync Immediately On All Devices to
prevent the problem from spreading. Once the
problem is fixed, perform the same repair on all
computers/profiles before using sync again.

[v57+] Places Maintenance is built into Firefox.

Type about:support<enter> in the address bar.

You will find Places Database near the bottom.
Press the Verify Integrity button.

When done, copy and post the results here.

https://support.mozilla.org/en-US/kb/fix-bookmarks-and-history-will-not-be-functional

Do a clean reinstall of the current Firefox release and delete the Firefox program folder before installing a fresh copy of the current Firefox release.

  • download the Firefox installer and save the file to the desktop
    *https://www.mozilla.org/en-US/firefox/all/#product-desktop-release

If possible uninstall your current Firefox version to cleanup the Windows Registry and settings in security software.

  • do NOT remove «personal data» when you uninstall the current Firefox version, because this will remove all profile folders and you lose personal data like bookmarks and passwords including personal data in profiles created by other Firefox versions

Remove the Firefox program folder before installing that newly downloaded copy of the Firefox installer.

  • (64-bit Firefox) «C:Program FilesMozilla Firefox»
  • (32-bit Firefox) «C:Program Files (x86)Mozilla Firefox»
  • it is important to delete the Firefox program folder to remove all the files and make sure there are no problems with files that were leftover after uninstalling

Your personal data like bookmarks is stored in the Firefox profile folder, so you won’t lose personal data when you reinstall or update Firefox, but make sure NOT to remove personal data when you uninstall Firefox as that will remove all Firefox profile folders and you lose your personal data.

If you keep having problems then you can create a new profile as a quick test to see if your current profile is causing the problem.


  • https://support.mozilla.org/en-US/kb/profiles-where-firefox-stores-user-data
  • https://support.mozilla.org/en-US/kb/back-and-restore-information-firefox-profiles

Reinstall Firefox

  • https://support.mozilla.org/en-US/kb/troubleshoot-and-diagnose-firefox-problems

Выбранное решение

@FredmcD,

Verify Integrity didn’t work, but I saw a Clear Startup Cache button at the top of the page and clicked that, which did work. Thanks for the prompt, as I didn’t know that page existed.

@cor-el,

I know a switch it off/switch it on approach solves a lot of problems, but uninstalling/reinstalling Firefox does seem to be a bit of overkill for a problem that was caused by a Firefox update, rather than something I did. Perhaps clearing the startup cache might be a standard task to include in every update, so this kind of problem doesn’t happen in the future?

Anyway, the problem has been fixed now, so no worries for me.

Debbie

That was very good work. Well Done.

I am getting an error on my pages

XML Parsing Error: no element found
Location: http://localhost:22888/UpdateConfig.aspx
Line Number 1, Column 1:
^

What I have tried:

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Web.Configuration;

namespace Test
{
    public partial class UpdateConfig : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
            try
            {
                
            }
            catch (Exception ex)
            {
                Response.Write("Exception: " + ex.Message);
            } 
        }
    }
}

Comments

Unclear question. Provide some more information, show some code of what you have tried. Just improve your question.

You got an error about the aspx page but posted the aspx.cs code.


Solution 2

By some weird reason, you .aspx is not well-formed. Please check it up. Try to compile your ASP.NET solution with this file; it it’s fine, check up that it is deployed correctly (most likely, it is, because you probably work with the HTTP server embedded in Visual Studio, in this case, you have exact same files an in the project).

Also, for a simple checkup, you can rename your .aspx file to .xml and test with any Web browser; it will show you the wrong point in the file.

—SA

Solution 1

just put Application_error tag in Global.asax

protected void Application_Error(object sender, EventArgs e)
{

}

No need to add any error handling code inside

Comments

The error was about UpdateConfig.aspx. Is there some reason to think global.asax is the problem?

Solution 3

I think you added  <httpErrors errorMode="Custom" existingResponse="PassThrough"/>
in <system.webserver> (web.config).
Please remove this for a while so that you can see the actual error.
After you get error you can search for actual error.
  • Remove From My Forums
  • Question

  • Hello All,

    I am getting the following error when I open the CA. However I am able to open the sites that I created using CA.

    Hope my word are clear enough.

    Thank U


    Thanks & Regards, Chandra Shekhar Rameneni

Answers

  • Hi Chandra,

    Based on my research, the error message is only generated by FireFox when the render page is blank in Internet. 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.
    Also, based on your description, the other sites are opened correctly, the issue only happened in Central Administration(CA). This means the SharePoint services are working fine.

    Since this issue only occurred in the CA, it might be due the application pool for the CA is corrupted. Please try to restart the application pool for the CA to resove the issue:
    1. Open Internet Information Service(IIS)
    2. List the application pools
    3. Select the application pool used for the CA
    4. Stop it, and then start it again.

    Note, if the application pool is running in Classic mode, please change it to be Integrated mode.

    Additionally, I found a similar thread, which may help you too:
    http://social.msdn.microsoft.com/Forums/en/sharepoint2010general/thread/824d7dda-db03-452b-99c4-531c5c576396

    If you have any more questions, please feel free to ask.

    Thanks,
    Jin Chen


    Jin Chen — MSFT

    • Marked as answer by

      Monday, March 14, 2011 2:44 AM

Going through new questions with new tags in Moderator Tools, I clicked on a tag «machine.config», and got the following error:

XML Parsing Error: no element found
Location: https://stackoverflow.com/questions/tagged/machine.config
Line Number 1, Column 1:

The URL is https://stackoverflow.com/questions/tagged/machine.config.

BTW, the same happens for «web.config». I suppose it’s the dot.

Community's user avatar

asked Jul 26, 2009 at 17:56

John Saunders's user avatar

John SaundersJohn Saunders

15.2k2 gold badges40 silver badges84 bronze badges

2

Brad makes the point about which tags you should use instead… but that doesn’t address the fact that it really is a bug. You shouldn’t be able to «break» SO just by feeding it a tag of a particular format.

It’s not a particularly major bug, I’ll grant you… but definitely one to fix.

I don’t believe it’s the fact that there’s a dot though — I believe it’s ASP.NET trying to prevent people from getting the actual machine.config/web.config etc.

Other interesting finds:

  • https://stackoverflow.com/questions/tagged/foo.aspx: page not found
  • https://stackoverflow.com/questions/tagged/foo.asax: broken (no source)
  • https://stackoverflow.com/questions/tagged/foo.asbx: suitable empty list of questions

When it’s broken, in Chrome I don’t get an XML parsing error — I just get an empty page, with no data at all even when viewing source.

Community's user avatar

answered Jul 26, 2009 at 18:39

Jon Skeet's user avatar

Jon SkeetJon Skeet

93.2k34 gold badges192 silver badges325 bronze badges

3

You must log in to answer this question.

Not the answer you’re looking for? Browse other questions tagged

.

Недавно я перенес сайт ASP с моей машины разработки на рабочий сервер. Все страницы, кроме моей страницы часто задаваемых вопросов, работают нормально, но мой FAQ выводит:

XML Parsing Error: no element found
Location: http://geniusupdate.com/GSHelp/faq.aspx
Line Number 1, Column 1:

Единственными изменениями, которые я сделал, было изменение строки подключения на моей странице SQL с локальной на строку, указанную моей службой хостинга. Любые советы о том, что я могу сделать, чтобы найти корень этой проблемы?

вот источник моей страницы часто задаваемых вопросов:

<%@ 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>

Я нашел это на другом форуме ссылке:

Что ж, похоже, это и то, и другое. Сообщение генерируется Firefox, но вызывается фреймворком. По какой-то причине .NET генерирует тип ответа «application/xml», когда создает пустую страницу. Firefox анализирует файл как XML и, не обнаружив корневого элемента, выдает сообщение об ошибке.

IE не отображает страницу, и точка. Вот откуда исходит XML.

Вот функцияstructFaqSideMenu():

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

А вот источник пустой страницы, которую возвращает IE:

<!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>

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Xml parsing error football manager 2012
  • Xml parsing error at 16 10 error 76 mismatched tag
  • Yamaha majesty 400 коды ошибок
  • Yamaha gear ошибка 42
  • Yale погрузчик коды ошибок

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии