Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2004-05-03
8
Medium Priority
?
1,996 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
Technology Partners: 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 1000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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 would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

916 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