Eclipse中xml文件报出以下错误:express
The processing instruction target matching "[xX][mM][lL]" is not allowed.
报错的文件是hadoop2.7.1源码中hadoop-common项目中的empty-configuration.xml,此文件存在项目中的目录以下:apache
文件内容以下:app
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <?xml version="1.0"?> <configuration> </configuration>
在网上搜了一下这个错误信息,还真有,内容以下:less
xml文件不能被解析,通常出现这样的问题在于xml格式上,而且问题多出如今xml文件的头部。
缘由:
(1)通常可能是由于xml文件头部有了空格或回车致使的。
(2)字母大小写问题。
例如:<?xml version="1.0" encoding="UTF-8"?>不能写成<?XML version="1.0" encoding="UTF-8"?>
结论:
<?xml version="1.0" encoding="UTF-8"?>前面不要有任何其余字符,如空格、回车、换行这些不然就会出现上面的异常。oop
本人就将<?xml version="1.0"?>挪到了第一行的位置,错误解决,当本人在去查看hadoop刚解压的文件时,发现确实有这个文件,不是Maven下载致使的,因此本人就很纳闷,Apache不至于出这么大的问题吧?ui
修改过的内容以下:this
<?xml version="1.0"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <configuration> </configuration>
至今还是疑惑,有知道的朋友能够留言告知,谢谢!spa