The XML declaration is unexpected. Line 1, position 3.  
Author Message
Anoushka





PostPosted: XML and the .NET Framework, The XML declaration is unexpected. Line 1, position 3. Top

A webservice calls an assembly which reads data from xml file located on the same server. But when a webservice method call is made to the assembly to read from the xml file, it throws one or more of the following xml errors, but only when the webservice is first accessed.

The XML declaration is unexpected. Line 1, position 3.

'<', hexadecimal value 0x3C, is an invalid attribute character. Line 1, position 6.

This is an unexpected token. The expected token is 'TAGEND'

This is an unexpected token. The expected token is 'NAME'.

The '=' character, hexadecimal value 0x3D, cannot begin with a name.

The errors occur mostly initially (when the webservice is first accessed) and then don't appear as long as no iisresets are done. Sometime however the errors occurr random ly, but correct them selves. which is very weird. usually occur when multiple users are accessing, seldom or almost never occurs in single user mode.

Any clues

thanks in advance.



.NET Development4  
 
 
Smallfish





PostPosted: XML and the .NET Framework, The XML declaration is unexpected. Line 1, position 3. Top

You may have some spaces or other chars before the "< xml ..." decleration.

Yair


 
 
Anoushka





PostPosted: XML and the .NET Framework, The XML declaration is unexpected. Line 1, position 3. Top

no there aren't any, beacuse it works perfectly fine all the times. sometimes these xml errors are seen
 
 
Anoushka





PostPosted: XML and the .NET Framework, The XML declaration is unexpected. Line 1, position 3. Top

XmlTextRedaer is used to read the xml and that could be the problem
 
 
Chris Lovett





PostPosted: XML and the .NET Framework, The XML declaration is unexpected. Line 1, position 3. Top

Saying it's expecting 'TAGEND' on line 1 position 3 is a little suspicious. You are creating a new XmlTextReader each time right
 
 
-Anton Lapounov





PostPosted: XML and the .NET Framework, The XML declaration is unexpected. Line 1, position 3. Top

It seems that the input XML stream gets messed up, which causes random errors. One possible reason is using non-thread-safe objects from multiple threads simultaneously. It's difficult to guess, you should really try to debug the issue on your side.

Thanks,
Anton