Error: A semi colon character was expected. Error processing resource

Very often people encounter this error when they try to open xml file in IE or try to load it in their code. The most common reason for this error is that your xml file may be containing "&" character. Actually IE misunderstands "&" character with some HTML code that starts with "&" and ends with ";" character like-& nbsp ; means non-breaking space and rendered as a white space.

For Example: here is the content of an xml file which will give this error due to "&" character in the url.

< ?xml version="1.0" encoding="utf-8" ? >
<>
<>
< name="WSACCPURL">
<>http://localhost/Test/webservices?ver=1.1&wsdlxml< /value >
< /setting >
< /appSettings >
< /configuration >

So to resolve this error I replaced the "&" character with HTML code phrase "& amp ;"
Note:- Ignore the space between & and ; there should not be any space. Here I had to give space to avoid their special meaning by IE.

Now the updated xml file is:

< ?xml version="1.0" encoding="utf-8" ? >
<>
<>
< name="WSACCPURL">
<>http://localhost/Test/webservices?ver=1.1& amp ;wsdlxml< /value >
< /setting >
< /appSettings >
< /configuration >


Now when this file is opened in IE the & amp ; is rendered as & character.

4 comments:

Anonymous said...

Thanks Sanjay, your blog helped me solve my issue.

Cheers
Kishore

Anonymous said...

Thanks a lot Sanjay, This is what exactly I was looking for. Keep writing :)

Anonymous said...

Fixed the the same error I was having. Thanks for posting.

Felipe Ingram said...

Look like character “&” is not the only one that throws this exception, i replaced it but keep the error.