The processing instruction target matching “[xX][mM][lL]” is not allowed

 The processing instruction target matching “[xX][mM][lL]” is not allowed

This exception reminds me of quote “Much ado about nothing”.

I experienced this exception while parsing an XML using SAXParser. I searched over the web and found many questions on this and there were several others who experienced the same issue. So thought of putting a solution over here, so that it might help someone if they safe something similar.

Well, the solution is pretty simple. The problem is somewhere with the first line of you XML i.e.

<?xml version=”1.0″ encoding=”utf-8″?

In my case there was a whitespace before the start tag <. I trimmed the XML string and that’s all!

Advertisements


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s