Solved

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

Posted on 2004-05-03
8
1,924 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
  • 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
ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

 

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Select distinct 25 101
Error viewing ASP page 12 164
Using Classic ASP inside HTML pages 2 60
Help with query 3 25
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

777 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