none
XML Parsing Error: not well-formed

    Question

  • I have WinXP Pro SP2.

    I downloaded and installed Visual Web Developer 2005 Express Edition.

    I am going through the Walkthroughs to better understand ASP.NET.

    I got to the Walkthrough: Creating a Web Site with Membership and User Login (ms-help://MS.VSExpressCC.v80/MS.NETFramework.v20.en/dv_vwdcon/html/296c0be6-9ad5-4104-9a1b-a853986fa1a3.htm)

    I performed every step up to Testing Login flawlessly (and every other Walkthrough up to this point). When I press Ctrl+F5 to run the Website I get this error:

    XML Parsing Error: not well-formed
    Location: http://localhost/membership/Default.aspx
    Line Number 1, Column 2:<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
    -^

     I can't find any additional information on the problem in the MS Knowledge Bases so I don't know how to fix it. Suggestions?

     

    Thursday, April 20, 2006 4:46 PM

Answers

All replies

  • What we see that somehow ASPX file is parsed by XML parser.

    ASPX is not an XML and so this error is expected from XML parser.

    I'd recommend you to go to http://forums.asp.net/ to find why this happens.

    Friday, April 21, 2006 9:56 PM
  • .ASPX files can be XML and can be parsed using XML parser. Example:

    <%@ Page Language="VB" %>
    <script language="VB" runat="server">
        Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
            'Set response to XML
            Response.ContentType = "text/xml"
            Dim dt As New System.Data.DataTable
            Try
                'Set connection string
                Dim connStr As String = "Data Source=ServerName;Initial Catalog=DatabaseName;User ID=UserName;Password=Password"
                'Set Select statement
                Dim sql As String = "SELECT * FROM caddb.dbo.GetVehicles()" 'Selects from the table valued function GetVehicles
                'Create Data Adapter specifying the select statement and connection string
                Dim da As New System.Data.SqlClient.SqlDataAdapter(sql, connStr)
                'Fill the DataTable with data
                da.Fill(dt)
            Catch ex As Exception
                'If connection failed, write the error instead
                Response.Write("<Vehicles><error>")
                Response.Write(ex.ToString)
                Response.Write("</error></Vehicles>")
                Exit Sub
            End Try
            'Write the XML Version info not required but is sujested
            Response.Write("<?xml version='1.0' encoding='utf-8'  standalone='yes'?>")
            'Write the parent node begin
            Response.Write("<Vehicles>")
            For Each row As System.Data.DataRow In dt.Rows 'Cycle through the rows of the data table
                writeRowXML(row) 'Write the row to XML
            Next
            'Write the parent node end
            Response.Write("</Vehicles>")
           
        End Sub
        Sub writeRowXML(ByRef row As System.Data.DataRow)
            Response.Write("<Vehicle>")
            Response.Write("    <lat>" + row.Item("lat").ToString + "</lat>")
            Response.Write("    <lng>" + row.Item("lng").ToString + "</lng>")
            Response.Write("    <speed>" + row.Item("speed").ToString + "</speed>")
            Response.Write("    <heading>" + row.Item("heading").ToString + "</heading>")
            Response.Write("    <time>" + row.Item("time").ToString + "</time>")
            Response.Write("</Vehicle>")
        End Sub
    </script>


    The resulting file would be XML. It would look like this:
    <Vehicles>
    <Vehicle>
    <lat>35.3738301</lat>
    <lng>-97.1908954</lng>
    <speed>0</speed>
    <heading>0</heading>
    <time>12/2/2006 1:42:30 AM</time>
    </Vehicle>
    <Vehicle>
    <lat>35.3838409</lat>
    <lng>-97.1908963</lng>
    <speed>45</speed>
    <heading>180</heading>
    <time>12/2/2006 1:42:30 AM</time>
    </Vehicle>
    </Vehicles>


    Tuesday, January 16, 2007 9:59 PM
  • hi did you ever find a solution to this problem

     

    Friday, September 19, 2008 10:28 PM
  • Hi,

     

    .ASPX file itself is not an XML. When you run it, it can produce XML as its output (as in your example). What sergey is saying is, that for some reason instead of the result fo the execution of your ASPX file (which would be an XML) the ASPX file itself is being parsed by the parser. And that fails (as expected).

    This is probably caused by a misconfiguration of the webserver serving the ASPX files (must be set to execute those and not serve them as a content file).

     

    Thanks,

    Monday, September 22, 2008 4:04 PM
  • I figured of this would be a problem with IIS and went to

    Finally I got it fixed this is what I did.

    Start -> settings -> control panel -> Add Remove Programs
    Selected Add Widows components
    Unchecked Internet Information Server (IIS)
    and clicked on  next to uninstall it

    Once I was uninstalled i followed the same process. This timed checked iis insted of
    uncheck to re install iis

    Start -> settings -> control panel -> Add Remove Programs
    Selected Add Widows components
    Checked Internet Information Server (IIS)
    and clicked on  next

    Again registered .net with iis

     

     

    Read More.

    http://muruganad.com/ASP.NET/XML-Parsing-Error-not-well-formed.html




    Thanks!
      Murugan
    www.muruganad.com
    Friday, August 28, 2009 7:55 PM
  • This Doesn't help I still get the error in vs 2008 of

    XML Parsing Error: syntax error
    Location: file:///C:/Users/Matthew.Matthew-PC/Documents/Visual%20Studio%202008/Projects/Go%204%20Ward/special.aspx
    Line Number 1, Column 1:This is a marker file generated by the precompilation tool, and should not be deleted!
    ^
    Monday, September 14, 2009 3:45 AM
  • I recently encountered this issue and it was solved very easy for me. I encountered it to due to a VS2008 Web Deployment Project. I marked for it to create a virtual directory however under the virtual directory settings it did not have a version of ASP.NET selected. Changing this in IIS fixed this occurrence for me.

    InetMGR

    Right click virtual directory < Properties

    ASP.NET

    Change drop down as appropriate.
    • Proposed as answer by Chris Marisic Monday, September 21, 2009 5:34 PM
    • Edited by Chris Marisic Monday, September 21, 2009 5:35 PM spelling
    Monday, September 21, 2009 5:34 PM
  • This Doesn't help I still get the error in vs 2008 of

    XML Parsing Error: syntax error
    Location: file:///C:/Users/Matthew.Matthew-PC/Documents/Visual%20Studio%202008/Projects/Go%204%20Ward/special.aspx
    Line Number 1, Column 1:This is a marker file generated by the precompilation tool, and should not be deleted!
    ^

    You are loading an .aspx file from the file system. Load it over HTTP from a web server where ASP.NET is installed then it will work. With Visual Studio you have a development server or you can use IIS.

    MVP XML My blog
    Monday, September 21, 2009 5:55 PM
  • Not sure if you figured out this problem yet but try the following solution.

    Click on Start ->Run and type in the following command if you are using .NET 2.0 framework:
    %Windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -i

    Once done the .NET Framework will be reinstalled. Your problem had to do with the fact that you no doubt installed the IIS after installing the .NET Framework. If the .NET Framework is not registered with IIS then it will not parse it properly.
    Wednesday, December 09, 2009 1:36 AM
  • Thank you. Reinstalling .NET 2.0 solved the issue.
    Friday, May 27, 2011 2:46 PM