Gtting error while reading XML
-
All, I am getting follwing error while reading my XML file directly returned from web service. This occurs normally when XML have some misplaced node, but my XML is returned from webservice with few chances to have node errors. Can any one help me regarding this problem. My error page is: Server Error in '/portal' Application.-------------------------------------------------------------------------------- This is an unexpected token. The expected token is 'NAME'. Line 778, position 626. 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. The expected token is 'NAME'. Line 778, position 626. 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. And my stack trace is:
[XmlException: This is an unexpected token. The expected token is 'NAME'. Line 778, position 626.] System.Xml.XmlTextReader.SetAttributeValues() +323 System.Xml.XmlTextReader.ParseElement() +138 System.Xml.XmlTextReader.Read() +94 System.Xml.XmlValidatingReader.ReadNoCollectTextToken() +38 System.Xml.XmlValidatingReader.Read() +14 System.Xml.XmlLoader.LoadCurrentNode() +612 System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) +49 System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) +102 System.Xml.XmlDocument.Load(XmlReader reader) +72 System.Xml.XmlDocument.LoadXml(String xml) +163 AI.Portal.Web.UI.RailBooking.ProcessGet() AI.Portal.Web.UI.BaseDialog.ProcessRequest() AI.Portal.Web.UI.HttpHandler.ProcessRequest(HttpContext context) System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +179 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +87
I am using Microsoft .NET Framework Version:1.1.4322.2407; ASP.NET Version:1.1.4322.2407 Thanks in advance for any help. Anand -
All, I am getting follwing error while reading my XML file directly returned from web service. This occurs normally when XML have some misplaced node, but my XML is returned from webservice with few chances to have node errors. Can any one help me regarding this problem. My error page is: Server Error in '/portal' Application.-------------------------------------------------------------------------------- This is an unexpected token. The expected token is 'NAME'. Line 778, position 626. 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. The expected token is 'NAME'. Line 778, position 626. 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. And my stack trace is:
[XmlException: This is an unexpected token. The expected token is 'NAME'. Line 778, position 626.] System.Xml.XmlTextReader.SetAttributeValues() +323 System.Xml.XmlTextReader.ParseElement() +138 System.Xml.XmlTextReader.Read() +94 System.Xml.XmlValidatingReader.ReadNoCollectTextToken() +38 System.Xml.XmlValidatingReader.Read() +14 System.Xml.XmlLoader.LoadCurrentNode() +612 System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) +49 System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) +102 System.Xml.XmlDocument.Load(XmlReader reader) +72 System.Xml.XmlDocument.LoadXml(String xml) +163 AI.Portal.Web.UI.RailBooking.ProcessGet() AI.Portal.Web.UI.BaseDialog.ProcessRequest() AI.Portal.Web.UI.HttpHandler.ProcessRequest(HttpContext context) System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +179 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +87
I am using Microsoft .NET Framework Version:1.1.4322.2407; ASP.NET Version:1.1.4322.2407 Thanks in advance for any help. AnandI'd say there is an unexpected token, which is 'NAME'. I'm not sure what else you'd like us to tell you. You haven't posted code or anything, so you can't want to know how to fix the error ? Have you looked at the XML that causes this error ?
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
All, I am getting follwing error while reading my XML file directly returned from web service. This occurs normally when XML have some misplaced node, but my XML is returned from webservice with few chances to have node errors. Can any one help me regarding this problem. My error page is: Server Error in '/portal' Application.-------------------------------------------------------------------------------- This is an unexpected token. The expected token is 'NAME'. Line 778, position 626. 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. The expected token is 'NAME'. Line 778, position 626. 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. And my stack trace is:
[XmlException: This is an unexpected token. The expected token is 'NAME'. Line 778, position 626.] System.Xml.XmlTextReader.SetAttributeValues() +323 System.Xml.XmlTextReader.ParseElement() +138 System.Xml.XmlTextReader.Read() +94 System.Xml.XmlValidatingReader.ReadNoCollectTextToken() +38 System.Xml.XmlValidatingReader.Read() +14 System.Xml.XmlLoader.LoadCurrentNode() +612 System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) +49 System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) +102 System.Xml.XmlDocument.Load(XmlReader reader) +72 System.Xml.XmlDocument.LoadXml(String xml) +163 AI.Portal.Web.UI.RailBooking.ProcessGet() AI.Portal.Web.UI.BaseDialog.ProcessRequest() AI.Portal.Web.UI.HttpHandler.ProcessRequest(HttpContext context) System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +179 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +87
I am using Microsoft .NET Framework Version:1.1.4322.2407; ASP.NET Version:1.1.4322.2407 Thanks in advance for any help. Anand -
Hi Anand, the line numbers mentioned in the error message might not be exact, but check if there are elements in the xml file having multiple attributes but without space between each attribute & value pair i.e. some spacing error.
Thanks Christian & Rajeesh, Thanks for answering. Part of my xml is like this:
<termsAndConditions>Can not be sold to or used by residents of Europe, the Russian Federation and Turkey. Travel on the national rail networks of 20 European countries (Austria, Belgium, Croatia, Denmark, Finland, France, Germany, Greece, Hungary, Italy, Luxembourg, the Netherlands, Norway, Portugal, Republic of Ireland, Romania, Slovenia, Spain, Sweden and Switzerland). VALIDITIES Eurail Global Pass available for 15 days, 21 days, 1 month, 2 months or 3 months of consecutive travel. Flexipass available for 10 or 15 daysof travel in a 2 month period. AGE / SAVER DISCOUNT Saver pass available for 2 or more passengers travelling together. Youth discount: for passengers under 26 (available in 2nd Class only) Children 4-11: half-adult fare Children under 4: free (except ifa reservation for a separate seat/bed is required). OTHER RULES 7:00 p.m. rule applies Free map and timetable must be delivered to customer with purchase Pass must be validated within 6 months of issue. REFUND POLICY A 15% cancellation penalty appliesto completely unused and unvalidated passes returned within 1 year of issue date. Partially used, lost or stolen passes are non-refundable except as covered by the Rail Protection Plan (for North America only). Please refer to general conditions of use for more information</termsAndConditions> <countriesCovered> <country> <name>AUSTRIA</name> <code>AT</code> </country> <country> <name>SPAIN</name> <code>ES</code> </country> <country> <name>SWEDEN</name> <code>SE</code> </country> <country> <name>SWITZERLAND</name> <code>CH</code> </country> <country> <name>BELGIUM</name> <code>BE</code> </country> <country> <name>LUXEMBOURG</name> <code>LU</code> </country> <country> <name>NETHERLANDS</name> <code>NL</code> </country> <country> <name>REPUBLIC OF IRELAND</name> </country> <country> <name>ROMANIA</name> <code>RO</code> </country> <country> <name>DENMARK</name> <code>DK</code> </country> <country> <name>FINLAND</name> <code>FI</code> </country> <coun
-
All, I am getting follwing error while reading my XML file directly returned from web service. This occurs normally when XML have some misplaced node, but my XML is returned from webservice with few chances to have node errors. Can any one help me regarding this problem. My error page is: Server Error in '/portal' Application.-------------------------------------------------------------------------------- This is an unexpected token. The expected token is 'NAME'. Line 778, position 626. 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. The expected token is 'NAME'. Line 778, position 626. 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. And my stack trace is:
[XmlException: This is an unexpected token. The expected token is 'NAME'. Line 778, position 626.] System.Xml.XmlTextReader.SetAttributeValues() +323 System.Xml.XmlTextReader.ParseElement() +138 System.Xml.XmlTextReader.Read() +94 System.Xml.XmlValidatingReader.ReadNoCollectTextToken() +38 System.Xml.XmlValidatingReader.Read() +14 System.Xml.XmlLoader.LoadCurrentNode() +612 System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) +49 System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) +102 System.Xml.XmlDocument.Load(XmlReader reader) +72 System.Xml.XmlDocument.LoadXml(String xml) +163 AI.Portal.Web.UI.RailBooking.ProcessGet() AI.Portal.Web.UI.BaseDialog.ProcessRequest() AI.Portal.Web.UI.HttpHandler.ProcessRequest(HttpContext context) System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +179 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +87
I am using Microsoft .NET Framework Version:1.1.4322.2407; ASP.NET Version:1.1.4322.2407 Thanks in advance for any help. AnandTo, Christian, Rajeesh and all, Regarding to the current thread, I am currently working on this problem and found 1 intresting point. The point is I am getting this error only when my code is uploaded on the server. The same code, I have uploaded, is working smoothly on my local IIS. I think this is related to seme XML version problem?????? please help me. Thanks. Anand