Solved

This is an unexpected token.  Expected 'WHITESPACE'.  Line 2, position 62

Posted on 2004-05-03
8
1,943 Views
Last Modified: 2012-06-21
Hi Guys,

I have a program that reads some XML using XMLTextReader from an ASPX file.  Then assigns the XML to a TREEVIEW.TreeNodeSrc.  Then Databinds to render the TREEVIEW.

When I run the program on my local computer (just build and run it in VS.NET) the treeview correctly displays.  However when I run the program on our development server, I get the following error:

-------------------------------------------------------------------------------------
This is an unexpected token. Expected 'WHITESPACE'. Line 2, position 62.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Xml.XmlException: This is an unexpected token. Expected 'WHITESPACE'. Line 2, position 62.

Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace:
[XmlException: This is an unexpected token. Expected 'WHITESPACE'. Line 2, position 62.]
   System.Xml.Schema.DtdParser.SkipWhitespace(Boolean fRequired) +147
   System.Xml.Schema.DtdParser.ParseExternalID() +484
   System.Xml.Schema.DtdParser.ParseDocTypeDecl() +347
   System.Xml.Schema.DtdParser.Parse() +61
   System.Xml.XmlTextReader.ParseDtd(XmlScanner scanner) +71
   System.Xml.XmlTextReader.ParseTag() +1442
   System.Xml.XmlTextReader.ParseRoot() +234
   System.Xml.XmlTextReader.Read() +127
   salesguides._default.GetXMLString()
   salesguides._default.Page_PreRender(Object sender, EventArgs e)
   System.Web.UI.Control.OnPreRender(EventArgs e) +67
   System.Web.UI.Control.PreRenderRecursiveInternal() +62
   System.Web.UI.Page.ProcessRequestMain() +1470

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.0.3705.209; ASP.NET Version:1.0.3705.0
---------------------------------------------------------------------------------

Any ideas why it works on my local machine and not my development server?

Many thanks,
Dave.
0
Comment
Question by:tidydave
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 1

Expert Comment

by:asrinivask
ID: 10977292
can you please send the code snippet? Also, is the data same on both of your environments?
0
 

Author Comment

by:tidydave
ID: 10978393
Function GetXMLString() As String
        Dim BulidmenuPath As String
        Dim XMLString As String
        Dim wrRequest As WebRequest

        BulidmenuPath = ConfigurationSettings.AppSettings("serverlocation") & "/salesguides/bulidmenu.aspx?userid=" & Session("userid")
        wrRequest = WebRequest.Create(BulidmenuPath)

        Dim wrResponse As WebResponse = wrRequest.GetResponse()

        Dim objStream As Stream = wrResponse.GetResponseStream
        Dim objStreamReader As StreamReader = New StreamReader(objStream)

        XMLString = objStreamReader.ReadToEnd
        Return XMLString
    End Function

    Private Sub Page_PreRender(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.PreRender
        Dim XML As String
        XML = GetXMLString()

        'Putting in this simple XML works!
        'XML = "<TREENODES><TREENODE TEXT=""TESTING""/></TREENODES>"

        Dim strBrowser As HttpBrowserCapabilities = Request.Browser
        Dim strVersion = strBrowser.MajorVersion & "." & strBrowser.MinorVersion
        Me.TreeView1.TreeNodeSrc = XML
        Me.TreeView1.DataBind()
        If strBrowser.Browser = "IE" And strVersion <= "5.5" Or Not strBrowser.Browser = "IE" Then
            Me.TreeView1.ExpandLevel = "1"
        End If
    End Sub
0
 

Author Comment

by:tidydave
ID: 10978409
Yes the data is the same on LOCALHOST and the development server.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:tidydave
ID: 11047619
I will give this question a few more days then I'm going to ask for it to be deleted, as no one has pointed me in the right direction.  Thanks.
0
 
LVL 1

Accepted Solution

by:
asrinivask earned 500 total points
ID: 11049423
does your bulidmenu.aspx page contain the logic for creating the xml string for building the menu. I beleive that there is some problem with the xml string that is being built inside the GetXMLString method.
Can you let me know what is going on inside the bulidmenu.aspx page.
0
 
LVL 1

Expert Comment

by:asrinivask
ID: 11049472
or better can you also give that page's code
0
 

Author Comment

by:tidydave
ID: 11051407
Hi asrinivask!

The bulidmenu.aspx page simply creates an XML file... I have tested it on my localmachine and everything works.  I tested it by creating the most simple of XML files, like the one below:

<TREENODES><TREENODE TEXT="TESTING"/></TREENODES>

And it WORKS on my local machine.

But when I MOVE it to our development server the error occurs that I have stated earlier.

I have checked everything many times, there must be something different about the development server.   This is a weird error.
0
 

Author Comment

by:tidydave
ID: 11489032
Ok... the problem was that I had form authenication switched on.   So when the program executed bulidmenu.aspx it didn't return the XML it returned the login page!
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question