Error: the Processing Instruction Target Matching "[Xx][Mm][Ll]" Is Not Allowed

Error: The processing instruction target matching [xX][mM][lL] is not allowed

Debug your XML file. Either there is space or added extra or fewer tags.

For better understanding build the project through the command line. Windows: gradlew build

In my case, AndroidManifest.xml has a blank space at the very first line

<Empty Row> // This Creates the issue 
<?xml version="1.0" encoding="utf-8"?>

ERROR:The processing instruction target matching [xX][mM][lL] is not allowed

Yes, that xml listing has several mistakes (assuming it's meant to be only one file).

Remove those string resources and place them in their own strings.xml file inside your project's res/values folder. Furthermore, that strings.xml file should also start with its own <?xml version="1.0" encoding="utf-8"?>

<?xml version="1.0" encoding="utf-8"?>
<resources>
<string android:name="app_name"></string>
<string android:name="edit_message"></string>
<string android:name="button_send"></string>
<string android:name="action_settings"></string>
<string android:name="title_activity_main"></string>
</resources>

This is not an error, but you may want to add some possible text labels to those string resources like this:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<string android:name="app_name">My Application Name</string>
<string android:name="edit_message"></string>
<string android:name="button_send">Send</string>
<string android:name="action_settings"></string>
<string android:name="title_activity_main"></string>
</resources>

Don't forget to close your LinearLayout with:

</LinearLayout>

Remove one of the two requestFocus, I would assume that you should only have one per layout (assuming that again, you only meant to show us only one file and not multiple files).

<requestFocus />

And remove that last line (that is what Eclipse is complaining about):

<?xml version="1.0" encoding="utf-8"?>

You do keep the one from the very first line of your xml file, but you remove the one from the last line, because that type of directive doesn't close.

Let me know if this fixed all your problems. I can't be sure it did because I didn't take the time to open my other computer and check with Eclipse.

How to solve [xX][mM][lL] is not allowed error

Leave out the <?xml ...> XML declaration alltogether. This error is reported when an XML declaration (which is syntactically an SGML processing instruction) is found in XML other than at the beginning of the XML. So I'm guessing the XML is composed/appended to some other XML in your app (it's impossible to say without additional info). An XML declaration is optional anyway; it's only used to tell a parser the encoding of the document, and that markup should be parsed according to XML rules (rather than HTML or generic SGML rules). You also might want to double-check you put no invisible garbage characters (by string operations in your app code) into your XML.

Error - The processing instruction target matching [xX][mM][lL] is not allowed

You need to define the color value instead of color name so use (change the name of the color )

 <color name="blue">#ffffff</color>

or you can use inbuilt colors as

 <color name="blue">@android:color/white</color>

Tip: click on the color icon on left to open the color picker

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

marmalad and El Boletaire Underave are right that you can't start with a space, but that's not the full story. According to the XML spec, you can't have anything at all before the XML prolog.

Since you are using an XML declaration, you must start your file with

<?xml version="1.0" ...

In some cases, non-printing characters like the byte order mark (BOM) can cause trouble by taking up the first few bytes of a file.

For a problem more specific to CakePHP, check to see that you don't have stray blank lines/whitespace at the start or end of your files (i.e. after your ?> or before your <?php).

Fatal Error The processing instruction target matching [xX][mM][lL] is not allowed

I don't know the exact reason why it is failing but the same problem was with me:
When I was trying to parse url response xml using DocumentBuilder.parse(url), parsing fails after few trials.

When I fetched response xml using the following function:

public String getHttpGetResponseString(String url) throws Exception
{
HttpClient httpclient = new DefaultHttpClient();
String responseBody ="";
try {
HttpGet httpget = new HttpGet(url);

System.out.println("executing request " + httpget.getURI());

// Create a response handler
ResponseHandler<String> responseHandler = new BasicResponseHandler();
responseBody = httpclient.execute(httpget, responseHandler);


}
finally {
// When HttpClient instance is no longer needed,
// shut down the connection manager to ensure
// immediate deallocation of all system resources
httpclient.getConnectionManager().shutdown();

}
return responseBody;
}

And then loaded the xml into dom, i got rid of the exception.
Hope this may solve your problem.

Android build.gradle ERROR: ParseError at [row,col]:[65,9] Message: expected start or end tag Affected Modules: app

I got the same error, and the wrong character was found in the [row, col] position of the AndroidManifest.xml, not build.gradle



Related Topics



Leave a reply



Submit